From nobody Mon Jun  3 02:42:54 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vsygy6pvpz5LmXS;
	Mon, 03 Jun 2024 02:42:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vsygy6C1Rz4TWX;
	Mon,  3 Jun 2024 02:42:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717382574;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ShvYrX4WyoRR7WX5XE07PyZL8LCoqVXdZNyw1Bjx7RM=;
	b=S0xp669vCdWtsiTiFXgCK/L5OzoluEc+QaZJdSivNOnoQofKFhY9kjuf7VGoQ3qfdrLAEd
	ryfw79xvbY68R7qUaV35DGp2+6n/tD7rZ6Fjts0meMB2q/kaWsvoPz+Ty69pXaFIn+vZ/k
	arkjI4UNhsUPuX+qr+W5Z98Oz5HS1IIIdkoxHuAvzO6kbrVrqHMmf9/0Ne0PejavDl8rJ4
	FF4WOqCN9QAwrTZEHkWtlnGwtlpS3rD0cGSUXvnoA+GBCzJvmk5s8ztx/4QLujjnzajwsG
	6xCs2fMATSM/HBnggxkboNByr8F3Jyj5BWvM9hCul4FoZCG7VvK2zJ3y04LYMw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717382574; a=rsa-sha256; cv=none;
	b=pg+yD/iHhb7r4STL7vpL/hhvvRTeWqDVvDt7tP0KCPZMZSxaWEkve2wwl1//6bKFPnQeSR
	PFjuiEU5VXXZpRx4l6snowYc5lrkCAE6nzpO0lqDV+/YvTvD5MEQ9umkwJXRY8NHHG4AdR
	E2ahA3jFgY3B1ldg9/IobZRMpbV24Ec74B+uxiXskMWqAEYccXNRIU6V4xHHe4U95dvWmq
	3T1PsG9VZ6g6bZNlG2LODOyVNKt4dNRqwOH5CE06k1DphXZJCgQ+LFJny7WZLGKIkclhI+
	STSw5f8bCbQxbyWiEVKgXJXCiue+pWa0ZV6Rq7QqAMS7MovxVCz9wudcBXHqcQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717382574;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ShvYrX4WyoRR7WX5XE07PyZL8LCoqVXdZNyw1Bjx7RM=;
	b=q+jOB1jSisl4dALJP6dHA46sCZL98ZaOMSPj6x1ztVDq1h7k28vuAGWSKMxE034OxD9uxR
	nOVk2KlY4DohxZX3C0QDQZF9fDSrCIyZU7kr8OKdaGT9YDOROwhfoBAxZZ3saqL7VDGveB
	ColJQfMxhSqe6XF8r9eK0MrcID6KFUYxqvkysr9bru1wr+AshDvOq20ovg4SK1qqVkix8m
	govAKSsTsg4vaexu0Pm8XqiFQiy6WOBlwxqKp37XGzBff6R8GmD+KsxAg7ywZxcgGqI/FC
	/Jte+aw6LFis+XsXjOe/RxuBTwKPlX8ZekMEI3j22rKfANBm/uAl6DcxSlPMHQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vsygy5nj0zH7G;
	Mon,  3 Jun 2024 02:42:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4532gsNr060210;
	Mon, 3 Jun 2024 02:42:54 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4532gsq4060205;
	Mon, 3 Jun 2024 02:42:54 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 02:42:54 GMT
Message-Id: <202406030242.4532gsq4060205@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Cy Schubert <cy@FreeBSD.org>
Subject: git: 0f996f45418e - main - sqlite3: Vendor import of sqlite3
  3.46.0
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: cy
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 0f996f45418e82dae151e5d1da478da38d70049f
Auto-Submitted: auto-generated

The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=0f996f45418e82dae151e5d1da478da38d70049f

commit 0f996f45418e82dae151e5d1da478da38d70049f
Merge: 542f9494b747 259d29fd8c01
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2024-06-03 01:40:14 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2024-06-03 02:28:53 +0000

    sqlite3: Vendor import of sqlite3 3.46.0
    
    Release notes at https://www.sqlite.org/releaselog/3_46_0.html.
    
    Obtained from:  https://www.sqlite.org/2024/sqlite-autoconf-3460000.tar.gz
    
    Merge commit '259d29fd8c012d4392fa59ff803b691ead5b304d' into main

 contrib/sqlite3/Makefile.msc     |    7 +
 contrib/sqlite3/configure        |   20 +-
 contrib/sqlite3/configure.ac     |    2 +-
 contrib/sqlite3/shell.c          | 1943 +++++++--
 contrib/sqlite3/sqlite3.c        | 8935 +++++++++++++++++++++++---------------
 contrib/sqlite3/sqlite3.h        |  116 +-
 contrib/sqlite3/sqlite3rc.h      |    2 +-
 contrib/sqlite3/tea/configure    |   18 +-
 contrib/sqlite3/tea/configure.ac |    2 +-
 9 files changed, 7287 insertions(+), 3758 deletions(-)


From nobody Mon Jun  3 06:26:50 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vt3fZ6pVcz5L9tf;
	Mon, 03 Jun 2024 06:27:02 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "anubis.delphij.net", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vt3fY284Rz3y2C;
	Mon,  3 Jun 2024 06:27:01 +0000 (UTC)
	(envelope-from delphij@delphij.net)
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=delphij.net header.s=y07n header.b=PZMwhvg4;
	dkim=pass header.d=delphij.net header.s=w44o header.b=HHWCNoIR;
	dmarc=pass (policy=reject) header.from=delphij.net;
	spf=pass (mx1.freebsd.org: domain of delphij@delphij.net designates 64.62.153.212 as permitted sender) smtp.mailfrom=delphij@delphij.net
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=delphij.net;
 i=@delphij.net; q=dns/txt; s=y07n; t=1717396013; h=message-id : date :
 mime-version : reply-to : subject : to : references : from :
 in-reply-to : content-type : from;
 bh=Zj/s7p70149eCOsTFDSz9/8IK5PMNHjNh1ulzaDorXs=;
 b=PZMwhvg4az/+NV+UvOn9Hd28PbnoYge80AFHoY6D3kXYeK8/Pcdlwh/QrWvVvnj7de118
 po0bwowIGvjW/7ACA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=delphij.net;
 i=@delphij.net; q=dns/txt; s=w44o; t=1717396013; h=message-id : date :
 mime-version : reply-to : subject : to : references : from :
 in-reply-to : content-type : from;
 bh=Zj/s7p70149eCOsTFDSz9/8IK5PMNHjNh1ulzaDorXs=;
 b=HHWCNoIR4U/5pqMJXgBQRlwi+WyuBpbLJ0J0BBQ88QUxQNjN/u1co6uTdk7W8ih8ymISU
 1wxkCo3dWXfv/r5D6IeBuaYpnI7PjjS2oPFng2R+soJb0w0/NyyjB6K2PrGT6GHhbcDR93i
 jkyZCYmjfEuN2yRIQBtdR5OtI7zZYfZfzn1LSL5Dnww71IjA98M3ALhOLhW0dyitewMBOs/
 BZvzP8rgCMmfHpDCVzgmBSNo8ahVsig4HylB4Bpc43jCypvjanSGr9Nyk3Ykai8+oyeDt8M
 DIfPmCjjb8kq26zwFfDq7v901//BwFpPqjyh9gJYM4WV4gf5fm426yFOEEAw==
Received: by anubis.delphij.net (Postfix) with ESMTPSA id 183B930ACF;
	Sun, 02 Jun 2024 23:26:53 -0700 (PDT)
Message-ID: <8288d7d3-c4e1-4387-a4c2-b6783c3a0c79@delphij.net>
Date: Sun, 2 Jun 2024 23:26:50 -0700
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Reply-To: d@delphij.net
Subject: Re: git: 14a5c1068d37 - main - man: do not ignore the exit status of
 roff tools
To: Wolfram Schneider <wosch@FreeBSD.org>, src-committers@FreeBSD.org,
 dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
References: <202404200830.43K8UkDt000569@gitrepo.freebsd.org>
Content-Language: en-US
From: Xin Li <delphij@delphij.net>
Autocrypt: addr=delphij@delphij.net; keydata=
 xjMEZPbDoRYJKwYBBAHaRw8BAQdAsUNmxEWz6QiGdFbBrVVEpjNpgQV9FXjDWsLsY0UwRPvN
 HFhpbiBMSSA8ZGVscGhpakBkZWxwaGlqLm5ldD7ClgQTFgoAPhYhBLskk2pXNatsapeNzxED
 4uuXWeTFBQJk9sRMAhsDBQkKBDXmBQsJCAcDBRUKCQgLBRYCAwEAAh4FAheAAAoJEBED4uuX
 WeTF6yIA/2Ls3Rb/qC8mQZ6D2S0UO5vblPghJfboFJLNJFw3i4GYAQCsTmQg3ahgbNEJu/vU
 xgtro2kTxa6kKnZ35IbqPqPcCc44BGT2w6ESCisGAQQBl1UBBQEBB0Cxji+sQgVPajLNA/Lw
 yHx0ogSalPQszdkfVgeg3iR3FAMBCAfCeAQYFgoAIBYhBLskk2pXNatsapeNzxED4uuXWeTF
 BQJk9sOhAhsMAAoJEBED4uuXWeTF3BQBAIx/gPCTFN2DPBrKLkE3oC/+j9EkmNLMUCGidlP/
 Zb6HAP4nL1kStTsOldIGhi/3m1LvU7r3Kel3MnlIK8/9BlLPAg==
In-Reply-To: <202404200830.43K8UkDt000569@gitrepo.freebsd.org>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="------------La05vMXNZBfhDzg1hDQGlOtz"
X-Spamd-Bar: ----
X-Spamd-Result: default: False [-4.50 / 15.00];
	SIGNED_PGP(-2.00)[];
	MIME_BASE64_TEXT_BOGUS(1.00)[];
	NEURAL_HAM_LONG(-1.00)[-1.000];
	NEURAL_HAM_MEDIUM(-1.00)[-1.000];
	NEURAL_HAM_SHORT(-0.61)[-0.611];
	DMARC_POLICY_ALLOW(-0.50)[delphij.net,reject];
	R_DKIM_ALLOW(-0.20)[delphij.net:s=y07n,delphij.net:s=w44o];
	R_SPF_ALLOW(-0.20)[+mx];
	MIME_GOOD(-0.20)[multipart/signed,multipart/mixed,text/plain];
	MIME_BASE64_TEXT(0.10)[];
	ONCE_RECEIVED(0.10)[];
	XM_UA_NO_VERSION(0.01)[];
	RCVD_TLS_ALL(0.00)[];
	MIME_TRACE(0.00)[0:+,1:+,2:+,3:~];
	ARC_NA(0.00)[];
	TO_MATCH_ENVRCPT_ALL(0.00)[];
	DKIM_TRACE(0.00)[delphij.net:+];
	HAS_ATTACHMENT(0.00)[];
	FROM_HAS_DN(0.00)[];
	TO_DN_SOME(0.00)[];
	MLMMJ_DEST(0.00)[dev-commits-src-all@FreeBSD.org,dev-commits-src-main@FreeBSD.org];
	REPLYTO_DOM_EQ_FROM_DOM(0.00)[];
	FROM_EQ_ENVFROM(0.00)[];
	RCPT_COUNT_THREE(0.00)[4];
	MID_RHS_MATCH_FROM(0.00)[];
	ASN(0.00)[asn:6939, ipnet:64.62.128.0/18, country:US];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	RCVD_COUNT_ONE(0.00)[1];
	FREEFALL_USER(0.00)[delphij];
	HAS_REPLYTO(0.00)[d@delphij.net]
X-Rspamd-Queue-Id: 4Vt3fY284Rz3y2C

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------------La05vMXNZBfhDzg1hDQGlOtz
Content-Type: multipart/mixed; boundary="------------xuJiGFuvKwsbfqeMLJXXs7Vc";
 protected-headers="v1"
From: Xin Li <delphij@delphij.net>
Reply-To: d@delphij.net
To: Wolfram Schneider <wosch@FreeBSD.org>, src-committers@FreeBSD.org,
 dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Message-ID: <8288d7d3-c4e1-4387-a4c2-b6783c3a0c79@delphij.net>
Subject: Re: git: 14a5c1068d37 - main - man: do not ignore the exit status of
 roff tools
References: <202404200830.43K8UkDt000569@gitrepo.freebsd.org>
In-Reply-To: <202404200830.43K8UkDt000569@gitrepo.freebsd.org>
Autocrypt-Gossip: addr=d@delphij.net; keydata=
 xsFNBFuSR4oBEACvvEgwRIHs6IcSP/yaDtySF78Ji3rP29qdiQsxhMsOtvtffdbS56VApIWO
 UFb3/iN2gA8HwLvrmjijN0HEoLVX7na1WARmxRYzQMtApsZIUTtx7hnUYlsi2F5odZa6CDW9
 a954DLRzYxiUwYDcu5Zjl9bglK1H8e/N9uC0Vuigr4teWfh86brzOyf819QzwFVYfMIK4ihw
 QGwMvTzbyVuCFy+LENkmcVYni70oQy6rZ5ktSuYbuOFvu7inRRfhSWPHziV7k+bW88sJ7xhv
 lBlegcnhkSudWX2M8tZ3MO1PJOcyys0CJlsBY5Weiog2lIPi05h/E9pZ9mc1Vud17iqDaL6w
 RaggOUhuPfDGCdO5ro82W4BZGeQMRnRF5Ntk+t2ShIH4nn3xRLV0E5nziCiKlgiMqOrz/ZTL
 QTVbHrCuiwD+fSK14y0oHbkOLYTYLlgh1JbwfY2Ty7elOYiWzyeJ7sJh2dF91NSEneWIOys3
 mBpuvtU3nSzzTvAB48VV+Nbg1CpIOgNlPjj7uhIum/Z/VjUaJEyaLpTIRh0MVJVcbP7hXSqZ
 NA35EEZZVnWEOYdycm4CmEdeNPWkrAf2Ya77iR5VLGypwMlsUMQPh+sKVWDD38M8stFGBBNm
 d01Hi74Bsq5hKan654dOqMt5eYklrVj0ucMzFQtus7oE502UswARAQABzRZYaW4gTEkgPGRA
 ZGVscGhpai5uZXQ+wsGUBBMBCgA+FiEEceNg5NEMZIki80nQQHl/fJX0g08FAluSSJkCGwMF
 CQmuhAAFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQQHl/fJX0g0+Utg/9ED4Mw4K82Asp
 3vYnVeziDlXOAif9EAhEpU989DUfk++p7BV6OOWLU1EwdpLBxqcz1kSNJmAbZWoiH3E3tYit
 2jP304+lZ0vtEDhu8MFrCAaFCQmerDP2pLI784/rwT6yZPLvFHqqa9gWH41LILhev/L9pNE2
 ygQ+fnU7pT5xp5/ebNnAwDrgbFdFLXZi5e1TWnbaEanKBKHoXwzm1C4ERDJSIVvUpuQsXsPa
 AObnEIwScagJFKZoEywCe9+CwA3cXOPYtBThZdduM7yIjXgwOn4k/EOpP2AqpzAE+kK7llxu
 rNhm8dw3Pf5mIehl4BKxsZGmxau2CSPe695gqG9hdeJSxQ4FXvnAMObhaioPQntrcEajSop0
 jb8vOJat6ZHeSvzqsMxPkT4cEIF6njUepCNiGebVUn2SALqBsve9n4Ur1Y7fkRDyIld+hz/l
 sD8/lEeYjnr5ft43OT+Y38SV/g+EwXpyptlZOTV9mQWrj8cd1ROSBZber2BRMlLWzVfsmX1w
 fFUrBMo6tupflcfvvIRtQyu1A6CAJ9veRRispNJ1tjo0WFpKRA1ou5hX2gHs0EjusV1wrD+Y
 WQDf0QP1PZHwW8V21gOZ4p7n8kTe/7vEFsARLQ4Weq7g5Kn7/qApXzona6nbj9J+PWD4l8eA
 4O8wPCXZE61M/JyZwsfLuB7OwU0EW5JHigEQANiBmIFAfRNH3nzYNWC0yC+tfx3zsUwAsH1V
 aBM/cTib+yKtbBOSIlXWjJZWX3MHwoI/1LeGghB2mxkkX1L0pJ/vj1eXNR+sFZ320pYcl61F
 xg/5fioG4QDTM4i3i7NR5PxDnc6UVaynSlII93DedRhZ1ROtdn4vyMgzsDiqhbL7BthDOt5K
 xjqdRk4qRPSw7BovEqZLOcG5IJtf/zZUzRbM7SBljEbOAfekDGx1Br+RrYSD7/EfPwwzou9T
 8315IpBpIHyQF/dZNk3iFiB9Ed5CA71ZRYV5YoLWE9lL0j9kxOLQ5vHnX3mVq7QZBc7nzwZ6
 UhQgYmrG5+RWvuiPpGwvDRIsugJUGXucYkAQh5kuNblmkwpv6u9rNMjCNbzAylOaqdogra5E
 W+RUSbRz0b4iIr8nnZeAlh7BihCe7JjOwbDjoBEEEtSfVc4hD/LENqpcYVrChphfaOLB9YIX
 hnVDTVvMc9OklWT/81HzAaDQqOQCzEfY92199Ct9/CwRoQ2OpO8TO5+8A7b9Nb33nmxMn09m
 b48ruRacMrfHxCWbgU4w9SEfbip4GcS5wGG6yTC+hw55Iwnnwus40NrJ0GEr8a4rcdsLbkvl
 yoNHB8ZGgyJ4aFCQ1V4qE1BnlTk7Z8BYBUkJM1odPSkVvHpCnMUjVpJ3hEOC+73ZYH1dh7lZ
 ABEBAAHCwXYEGAEKACACGwwWIQRx42Dk0QxkiSLzSdBAeX98lfSDTwUCZPl6RwAKCRBAeX98
 lfSDT1iFEACK+s6CnjVbEXn5I1s6HptCeXiwYxkOfSzSRDAZZDNWzUxu/2dwl/55Wf9AdJsI
 It08WOoH405nHSvyp4enicRUyk6tNi4C52qtU7lK9ESpKN8MlICgSd4bdnPxxGFbZE7nDgfF
 LWSaDmEjLDBDBFN+Oi7dRrWX8LZxUvHrYdO9BiYWVtFJC+hTpdFQbefJ3gLvrZhiwmDPhPq/
 IVPPe+IFWcRPnwvSVFAg/hSjNRyRA05MaW7PuEWzciiXhw2oENddyLihZVqJlka0L2ceoDe4
 Mf9PpOOmk1z73i42RfQ1Farfyl9MuxzA4DIUEXro0gutao1FVIwGK5cXDOu1vsARSYJ2Qz4M
 xeOWnObadCJEDLIuQM3XYo9FbCr44dhnwFK8tXSkHBw8NUpVlFIbofcs10qf2ZwbCHKjgISh
 PtxN9oYM42lNjnhaXtxtaxQagnDv6ynnLaQ2nxfD4ZClr1qUOmC79d67joY+FWncKtqqxNym
 KaETklfpmBG15tysTQY2MHlfUq9UiROTz+xcvmLZq5q09B/QfOyAt28ugm3MK37xdkPCpUeQ
 XktNLVlta74Eysucda7PBgqICp2AmrVdq1uKk4kj6IxqG5X3SPeSouU8LWpQSHSrsWKOSMif
 0mUVLlzzSNbp5P/y0bXs/7Muw2bPLfLiofmULRXlbXvuhQ==

--------------xuJiGFuvKwsbfqeMLJXXs7Vc
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: base64

SGksIFdvbGZyYW0sDQoNCk9uIDIwMjQtMDQtMjAgMDE6MzAsIFdvbGZyYW0gU2NobmVpZGVy
IHdyb3RlOg0KPiBUaGUgYnJhbmNoIG1haW4gaGFzIGJlZW4gdXBkYXRlZCBieSB3b3NjaDoN
Cj4gDQo+IFVSTDogaHR0cHM6Ly9jZ2l0LkZyZWVCU0Qub3JnL3NyYy9jb21taXQvP2lkPTE0
YTVjMTA2OGQzNzUxMTczZGM0MWYzMDk3YjEyZTk1NzkxYjIxNjANCj4gDQo+IGNvbW1pdCAx
NGE1YzEwNjhkMzc1MTE3M2RjNDFmMzA5N2IxMmU5NTc5MWIyMTYwDQo+IEF1dGhvcjogICAg
IFdvbGZyYW0gU2NobmVpZGVyIDx3b3NjaEBGcmVlQlNELm9yZz4NCj4gQXV0aG9yRGF0ZTog
MjAyNC0wNC0yMCAwODoyNDo1OCArMDAwMA0KPiBDb21taXQ6ICAgICBXb2xmcmFtIFNjaG5l
aWRlciA8d29zY2hARnJlZUJTRC5vcmc+DQo+IENvbW1pdERhdGU6IDIwMjQtMDQtMjAgMDg6
MzA6MzMgKzAwMDANCj4gDQo+ICAgICAgbWFuOiBkbyBub3QgaWdub3JlIHRoZSBleGl0IHN0
YXR1cyBvZiByb2ZmIHRvb2xzDQo+ICAgICAgDQo+ICAgICAgUFI6ICAgICAgICAgICAgIDIy
MzUxNg0KPiAgICAgIEFwcHJvdmVkIGJ5OiAgICBlbWFzdGUsIGJhcHQNCj4gICAgICBEaWZm
ZXJlbnRpYWwgUmV2aXNpb246ICBodHRwczovL3Jldmlld3MuZnJlZWJzZC5vcmcvRDQ0Nzk4
DQo+IC0tLQ0KPiAgIHVzci5iaW4vbWFuL21hbi5zaCB8IDggKysrKysrKy0NCj4gICAxIGZp
bGUgY2hhbmdlZCwgNyBpbnNlcnRpb25zKCspLCAxIGRlbGV0aW9uKC0pDQo+IA0KPiBkaWZm
IC0tZ2l0IGEvdXNyLmJpbi9tYW4vbWFuLnNoIGIvdXNyLmJpbi9tYW4vbWFuLnNoDQo+IGlu
ZGV4IGZkNTE2NDg3NTdhOS4uMDM4MDNiNzc3NDYzIDEwMDc1NQ0KPiAtLS0gYS91c3IuYmlu
L21hbi9tYW4uc2gNCj4gKysrIGIvdXNyLmJpbi9tYW4vbWFuLnNoDQo+IEBAIC0zMyw2ICsz
MywxMiBAQA0KPiAgICMgaXQgaXMgYmV0dGVyIHRvIHRlcm1pbmF0ZSBpdC4NCj4gICB1bGlt
aXQgLXQgMjANCj4gICANCj4gKyMgZG8gbm90IGlnbm9yZSB0aGUgZXhpdCBzdGF0dXMgb2Yg
cm9mZiB0b29scw0KPiArc2V0IC1vIHBpcGVmYWlsDQo+ICsNCj4gKyMgaWdub3JlIFNJR1BJ
UEUgZXhpdHMgYmVjYXVzZSBwYWdlcnMgbWF5IGV4aXQgYmVmb3JlIHJlYWRpbmcgYWxsIHRo
ZWlyIGlucHV0Lg0KPiArdHJhcCAnJyBTSUdQSVBFDQo+ICsNCj4gICAjIFVzYWdlOiBhZGRf
dG9fbWFucGF0aCBwYXRoDQo+ICAgIyBBZGRzIGEgdmFyaWFibGUgdG8gbWFucGF0aCB3aGls
ZSBlbnN1cmluZyB3ZSBkb24ndCBoYXZlIGR1cGxpY2F0ZXMuDQo+ICAgIyBSZXR1cm5zIHRy
dWUgaWYgd2Ugd2VyZSBhYmxlIHRvIGFkZCBzb21ldGhpbmcuIEZhbHNlIG90aGVyd2lzZS4N
Cj4gQEAgLTMxMiw3ICszMTgsNyBAQCBtYW5fY2hlY2tfZm9yX3NvKCkgew0KPiAgIAkjIFdl
IG5lZWQgdG8gbG9vcCB0byBhY2NvbW1vZGF0ZSBtdWx0aXBsZSAuc28gZGlyZWN0aXZlcy4N
Cj4gICAJd2hpbGUgdHJ1ZQ0KPiAgIAlkbw0KPiAtCQlsaW5lPSQoJGNhdHRvb2wgIiRtYW5w
YWdlIiB8IGhlYWQgLW4xKQ0KPiArCQlsaW5lPSQoJGNhdHRvb2wgIiRtYW5wYWdlIiAyPi9k
ZXYvbnVsbCB8IGhlYWQgLW4xKQ0KPiAgIAkJY2FzZSAiJGxpbmUiIGluDQo+ICAgCQkuc28q
KQl0cmltICIke2xpbmUjLnNvfSINCj4gICAJCQlkZWNobyAiJG1hbnBhZ2UgaW5jbHVkZXMg
JHRzdHIiDQoNCkkgbm90aWNlZCB0aGF0IGFmdGVyIHRoaXMgY2hhbmdlLCBtYW4oMSknaW5n
IHNoKDEpIHdvdWxkIGdpdmUgbWU6DQoNCm1hbmRvYzogPHN0ZGluPjogU1lTRVJSOiB3cml0
ZTogQnJva2VuIHBpcGUNCm1hbmRvYzogc2VlIGFib3ZlIHRoZSBvdXRwdXQgZm9yIFNZU0VS
UiBtZXNzYWdlcw0KDQppZiBJIGRvbid0IGZpbmlzaCBzY3JvbGxpbmcgdGhyb3VnaCB0aGUg
d2hvbGUgbWFucGFnZSBmaXJzdCwgd2hpY2ggSSANCnRoaW5rIGlzIG5vdCBkZXNpcmFibGUg
KHdlIHNob3VsZCBiZSBhYmxlIHRvIHF1aXQgJE1BTlBBR0VSIGVhcmx5KS4NCg0KSWYgSSBk
byB0aGlzIHRoZW4gdGhlIGVycm9yIG1lc3NhZ2Ugd291bGQgYmUgZ29uZToNCg0KZGlmZiAt
LWdpdCBhL3Vzci5iaW4vbWFuL21hbi5zaCBiL3Vzci5iaW4vbWFuL21hbi5zaA0KaW5kZXgg
MjRhMDQ2NDY4OWNjLi40MmFlODZjZmVjNWIgMTAwNzU1DQotLS0gYS91c3IuYmluL21hbi9t
YW4uc2gNCisrKyBiL3Vzci5iaW4vbWFuL21hbi5zaA0KQEAgLTM4MSw3ICszODEsNyBAQCBt
YW5fZGlzcGxheV9wYWdlKCkgew0KICAgICAgICAgaWYgWyAtbiAiJHRmbGFnIiBdOyB0aGVu
DQogICAgICAgICAgICAgICAgIHBpcGVsaW5lPSJtYW5kb2MgLVRwcyAkbWFuZG9jX2FyZ3Mi
DQogICAgICAgICBlbHNlDQotICAgICAgICAgICAgICAgcGlwZWxpbmU9Im1hbmRvYyAkbWFu
ZG9jX2FyZ3MgfCAkTUFOUEFHRVIiDQorICAgICAgICAgICAgICAgcGlwZWxpbmU9Im1hbmRv
YyAkbWFuZG9jX2FyZ3MgMj4vZGV2L251bGwgfCAkTUFOUEFHRVIiDQogICAgICAgICBmaQ0K
DQogICAgICAgICBpZiAhICRjYXR0b29sICIkbWFucGFnZSIgfCBldmFsICIkdGVzdGxpbmUi
OyB0aGVuDQoNCmJ1dCBJJ20gbm90IHN1cmUgaWYgdGhhdCB3b3VsZCBkZWZlYXQgdGhlIHB1
cnBvc2Ugb2YgdGhlIG9yaWdpbmFsIA0KY2hhbmdlLiAgQ291bGQgeW91IHBsZWFzZSB0YWtl
IGEgbG9vaz8NCg0KQ2hlZXJzLA0K

--------------xuJiGFuvKwsbfqeMLJXXs7Vc--

--------------La05vMXNZBfhDzg1hDQGlOtz
Content-Type: application/pgp-signature; name="OpenPGP_signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="OpenPGP_signature.asc"

-----BEGIN PGP SIGNATURE-----

wnsEABYIACMWIQS7JJNqVzWrbGqXjc8RA+Lrl1nkxQUCZl1iKwUDAAAAAAAKCRARA+Lrl1nkxWN4
AP9fj5sIe7TcJu21aSAXTPF5MX8D4QLUsRS4Vn4VAOQgvgEA/F/dyme/P5v1KFsFEdn5MHo1GLKw
Lr42Y0PyYVNiMwY=
=Ho4L
-----END PGP SIGNATURE-----

--------------La05vMXNZBfhDzg1hDQGlOtz--

From nobody Mon Jun  3 14:19:01 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtG791yWxz5Mb1v;
	Mon, 03 Jun 2024 14:19:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtG791Th2z4l6m;
	Mon,  3 Jun 2024 14:19:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717424341;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=TL7SGeErpvJF2fJktyJC7ItLeg4kPw76fAR+XubAkDQ=;
	b=UOJrWajyCa9eTZspE8On9u+BpnoYfKbTR9mhR9GbB8tW6Wk9QTXDH7Im6oMkWQtbuNOeKn
	wJEes7eAUayA+nu/gVUEWduHBhMNCht6sARQrfGtrDsS7+Lz9YZkf7ighx1nEBwItwztNQ
	V6iNEElv9slGKnlmMnj8AE6O5zYEbaV/LKs/X5B3moUHBvb58K7X08bhNOaN9dEGd053KV
	ujJO6WWqCOZxJYHRzoKjZ+G656LIk1hy7pBmaGZD+PkKK6a5e4j2EALjBDjMK9dlWnNbai
	XljBLfOxMrXOglslmrrfrnc1zYYzvByK3abWktoeWFJOoSz4jT2P4zgCBUEy1w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717424341; a=rsa-sha256; cv=none;
	b=pAhCby29xsoVInD82fK/Zn0i0uewdBxIhSjGXlRqYLH2uMM4ehidNGcI8rYzQ5wy8DUx1K
	srmU/gnZjyckXv+dlho2hkQtMJZlTPRioQsIKKqA7U20bAPITVbXaU/F7Z/ORN0r+LgNa8
	mZRMCDvA/ekRjxSO82dHD/BeC7stdiI2GOxPQ41pVVJW19KZJJ1aWzhtJoMuSgK1Zw8S7m
	QQxZuUcnCN5RGoCGsvc2+jGv4m98e1Ib0ZL6UeBMMUv1zjHF/rNK2/42envRCaLYNv+OPk
	vRCaNdTBA/gDM1KxN1jgn49xcD6QNRHM8o6K119FvPwAvONWIME2GiKFBARGUQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717424341;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=TL7SGeErpvJF2fJktyJC7ItLeg4kPw76fAR+XubAkDQ=;
	b=Bv3Oq0OWfif1tiu4RgN2gKA7HgMyhbKwSdjcm0qG51YVk23QRVELPV5G5uiveJINbtkZho
	nh4tncSy6b5Sqd0+5/KCpOqwcrmPrmOo22LGrv7s3E7qmmPkXeGprHptL7k2ITpEhfPbJD
	XfF1p4VG7uCDXFIc7imu0On1UhmWtbBB7RJlcWYf6S61+4gaRI6JEokfu4VrL7m/tGZcUf
	muCsdoXLBDVe2DqeYkYXPtjYPuvlKTh3cmgYzML2j/HwifEB6bkCIKTJUFMgWQKhFYPNHu
	vcB1OCm7TxUYB9xGpL4aBY9AwwaCaVy6UdQr01ZJWbVSoBz0PhHZDxFKoVr3ng==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtG7914cRzdvn;
	Mon,  3 Jun 2024 14:19:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453EJ1ox040040;
	Mon, 3 Jun 2024 14:19:01 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453EJ11G040037;
	Mon, 3 Jun 2024 14:19:01 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 14:19:01 GMT
Message-Id: <202406031419.453EJ11G040037@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Dmitry Salychev <dsl@FreeBSD.org>
Subject: git: 645a228481c7 - main - ds1307: Return error code instead
  of boolean
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dsl
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 645a228481c778b62fcd6c23e6f4786ceb8f1300
Auto-Submitted: auto-generated

The branch main has been updated by dsl:

URL: https://cgit.FreeBSD.org/src/commit/?id=645a228481c778b62fcd6c23e6f4786ceb8f1300

commit 645a228481c778b62fcd6c23e6f4786ceb8f1300
Author:     Dmitry Salychev <dsl@FreeBSD.org>
AuthorDate: 2024-06-03 13:41:11 +0000
Commit:     Dmitry Salychev <dsl@FreeBSD.org>
CommitDate: 2024-06-03 13:41:11 +0000

    ds1307: Return error code instead of boolean
    
    It's probably a copy-paste leftover from the other functions which
    return a boolean value and generates annoying "CLOCK_SETTIME error 1"
    from subr_rtc.c on Traverse Ten64 in verbose mode.
    
    No functional changes intended.
    
    MFC after:      3 days
---
 sys/dev/iicbus/rtc/ds1307.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/iicbus/rtc/ds1307.c b/sys/dev/iicbus/rtc/ds1307.c
index e8aa6a258edc..67a753bb3edb 100644
--- a/sys/dev/iicbus/rtc/ds1307.c
+++ b/sys/dev/iicbus/rtc/ds1307.c
@@ -346,7 +346,7 @@ mark_epson_time_valid(struct ds1307_softc *sc)
 	if (error) {
 		device_printf(dev, "%s cannot read Control 2 register: %d\n",
 		    __func__, error);
-		return (false);
+		return (error);
 	}
 
 	control_mask = (RX8035_CTRL_2_PON | RX8035_CTRL_2_XSTP | RX8035_CTRL_2_VDET);
@@ -356,9 +356,9 @@ mark_epson_time_valid(struct ds1307_softc *sc)
 	if (error) {
 		device_printf(dev, "%s cannot write to Control 2 register: %d\n",
 		    __func__, error);
-		return (false);
+		return (error);
 	}
-	return (true);
+	return (0);
 }
 
 static bool is_dev_time_valid(struct ds1307_softc *sc)

From nobody Mon Jun  3 15:14:58 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtHMl0M1Cz5Mh66;
	Mon, 03 Jun 2024 15:14:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtHMk6yPnz4v8p;
	Mon,  3 Jun 2024 15:14:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717427699;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=erDQUiHYCs8CKKK4OMTgoV8tF0z6XvBrT/Li9QQLcLs=;
	b=FEyoB4VzHdAOQzhYcEznUZK5ubzoGlBJHkfHqcIhV14zXgOldGXmNlXtvHuJiyQLlX3IKj
	lvK13JJlkWLolN082Sb032XF4o64VlhdojlmXONs0xvu/NLC4TbN4BnKjF2valP6rhO9j3
	i7iufTNmVkVnHaWKu7sLYBGpfuoTyI9Qv/cHHqeaS9uyacPP8QExyqJY0MfR4yEUJ+AYSq
	y3evkAeLWQNyMowta+dUW2dwl+YeEtSs0/lZJP1B5ybWSKi1lrKPnMet6/I3iPOwLDIBth
	nkzI5c8pvToueaUtu38t4h/rrySCrh/FKY4D5Ib4w6BRuBRIdfa34wTMbHlKxg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717427699; a=rsa-sha256; cv=none;
	b=gYoHAnOGW3qsbW5q6PwqXvadjCvzDMDUuGeiOkG2cLCftqIFRlYC2OaryfuUp4bIlPZ2DI
	q2ahArHbgTOpRqCcHqIJPTKKeZmDGKLr4UlprFWLr/Dhha+QHhl4UD6ZxWokB9LvBdoevZ
	n3AySS8ma9Y0L8Sy9onYZU5rTCK3LXxQvC+Kf3BMWQjfE74dbvxjgR8fHaq7KMC0mHaK6W
	S4WT6k842cnQl2EBh/Z9Lvxzy21uBRH4Sm+dYpAKvUWhFdYjc+JvcetygK6mLHUlQgDTzT
	wlYxiL4175pWs0nB+N4DkrbQkS2JWgbA3+LN911+/wo1kuPO6e/sLcZ10Y1sqQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717427699;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=erDQUiHYCs8CKKK4OMTgoV8tF0z6XvBrT/Li9QQLcLs=;
	b=puXeYLkLhbpqA7L+NezQxLrqcg8w3vs363roQNTSkJNzl0ZGHbrTsjuLPiS/PT6LUuTh2c
	NtYE6zQeUprZgYvgasZujOr6jJxRQXabJGhThbBIsBedVWmCEXelHnpFJn53rAFnkWAgF6
	EXJ1zBIpLIVgQZwX8rl0E8G8B7tprqWGjADJdv2tralnRRvtY9IO+Rexii5g0u5YS4aTta
	6W1yzR32ULgCNATVUE+mFvd5LyTvGZsNAQ7g1rVNQKvVz6Ua4f5ZIMtn2F/frquj5It3nR
	j6U27rdvCQIPz4yYpk4UXI5RFhI/V4VCoGh2WCv0HOKehZfjoNJoxqUJFVf2+g==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtHMk6YXBzg8x;
	Mon,  3 Jun 2024 15:14:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453FEwTu043348;
	Mon, 3 Jun 2024 15:14:58 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453FEws3043345;
	Mon, 3 Jun 2024 15:14:58 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 15:14:58 GMT
Message-Id: <202406031514.453FEws3043345@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Warner Losh <imp@FreeBSD.org>
Subject: git: 079d67b1d861 - main - sys: Disable C standards prior
  to C99 from kernel build
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: imp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 079d67b1d8618f1bc02b6507d7ee934529818a49
Auto-Submitted: auto-generated

The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=079d67b1d8618f1bc02b6507d7ee934529818a49

commit 079d67b1d8618f1bc02b6507d7ee934529818a49
Author:     Minsoo Choo <minsoochoo0122@proton.me>
AuthorDate: 2024-06-03 14:58:18 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-06-03 14:58:18 +0000

    sys: Disable C standards prior to C99 from kernel build
    
    The kernel hasn't built with anything less than c99 for a long
    time. Retire support in the build for it.  In addition, retire the
    translation of c99 to -std=iso9899:1999, since all latter day C
    compilers that we support have had this for maybe 15 years or so (gcc
    since 4.5, clang since the earliest version) and it simplifies the code.
    
    Reviewed-by: imp, emaste
    Differential-Revision: https://reviews.freebsd.org/D44145
---
 sys/conf/kern.mk | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index 5cd3a43f01b8..d51aa1f1dfa9 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -284,14 +284,10 @@ PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
 
 CSTD?=		gnu99
 
-.if ${CSTD} == "k&r"
-CFLAGS+=        -traditional
-.elif ${CSTD} == "c89" || ${CSTD} == "c90"
-CFLAGS+=        -std=iso9899:1990
-.elif ${CSTD} == "c94" || ${CSTD} == "c95"
-CFLAGS+=        -std=iso9899:199409
-.elif ${CSTD} == "c99"
-CFLAGS+=        -std=iso9899:1999
+# c99/gnu99 is the minimum C standard version supported for kernel build
+.if ${CSTD} == "k&r" || ${CSTD} == "c89" || ${CSTD} == "c90" || \
+    ${CSTD} == "c94" || ${CSTD} == "c95"
+.error "Only c99/gnu99 or later is supported"
 .else # CSTD
 CFLAGS+=        -std=${CSTD}
 .endif # CSTD

From nobody Mon Jun  3 15:52:06 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtJBZ64Hwz5Mk4Q;
	Mon, 03 Jun 2024 15:52:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtJBZ5ZY4z40l2;
	Mon,  3 Jun 2024 15:52:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717429926;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=fS4+Hu3dL66RadJfbsqlCrLYh6T1nyWBhJehzjt5ZVk=;
	b=YHC33m/NMKPZwuCSWjGbrWf3zViUw21dpJ+lkOjXtmaic02jbB8fFcQOj3e5dNeb4Ixfe5
	pASI5RBGwDR7zcluymGqcNAEPEouNdW8aULtybvpDgnQ+Ld5RLo6+xu7rlGoaGiyST4t1s
	T9wK1umPDrP81E2tfFt60KXSg7L6by7uzwNl3ISdWq2edsvo38n4dLgguoQ4SVrjwzXf28
	0qdEzr0USZ4lKxRp5HL8kDWgQG9xxgBb/etkeq6opi8AMk74N5E2fH7Knc7ZleZ9UHa+p+
	1Z6tgXzQussu83xNcp/2F7bwbgSqNnlMmt/YJwbtetZ/mx1PvfVyw06/0Xy8mA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717429926; a=rsa-sha256; cv=none;
	b=EsEcJB+MocLFpPk6eFSt1SzJ7c9jegFYN8O/vEU+WF9SRMnb6M3S0yXFRlAcg0JnNyf5nv
	no9wjJU+aDjgOmypnlnPWHVfZjvp9sYPUhGeM2eMg2Tdc7E7jZChAEn/LqppzgS2WMuUmy
	4+dsx/NFJ8bXdvhN6mlhFvqTqk29E88CrUCmN7LPgAcpj2PbGdhlGnjFjP/fD2lH6Pg3Rp
	DnwnpKWzIkRZLyf9BPL4e1DxHPJ/1UBUJ/tO23lkVWqqS3jk/1H8DK5sUMOUxzDGgbk3hk
	3/IOOB6yxW5r4b9OG41j1S0tJruklTk+nU5lc4XbMRLqDDqBKYuDXxrakeuoQw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717429926;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=fS4+Hu3dL66RadJfbsqlCrLYh6T1nyWBhJehzjt5ZVk=;
	b=pfJWGKWEnHrFfOMs7DWhvzuDzsqUyq/j6+s6m42hI/GDhIWkVFxaTvk+67/aJ6cead2QT3
	KysnldlKh4PAE3k+DkSMo4iKaS7wDZMMZI3WnpyZYYB+JSboVFT9ayKCpClMH0kNCTHM2B
	vGe4SzRZi1y4wobxsQpmV94FtmckKXYoXp8prpO93pclKbFUk1wFQmWrev64uEzhZ3Umni
	+gnax6QNwsh2a93Re9eZwwzjZRPJS0etw0UhvfTUsaJ+0NsA+UQWHvkyQyKKxUZmVoqVCQ
	XjEsSlngq5rKlasddEw0aTJjqZ2qCOMl4aAc9r2JaY4f3GWLMiCEXhfa9Zr9vw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtJBZ4sZBzhSR;
	Mon,  3 Jun 2024 15:52:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453Fq6sc008789;
	Mon, 3 Jun 2024 15:52:06 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453Fq6dC008786;
	Mon, 3 Jun 2024 15:52:06 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 15:52:06 GMT
Message-Id: <202406031552.453Fq6dC008786@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Gordon Tetlow <gordon@FreeBSD.org>
Subject: git: c3e9423743d9 - main - Move print_bits to ifconfig.c
  and make available to other src files.
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: gordon
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: c3e9423743d91ae5b5865602a905900a1855055e
Auto-Submitted: auto-generated

The branch main has been updated by gordon:

URL: https://cgit.FreeBSD.org/src/commit/?id=c3e9423743d91ae5b5865602a905900a1855055e

commit c3e9423743d91ae5b5865602a905900a1855055e
Author:     Gordon Tetlow <gordon@FreeBSD.org>
AuthorDate: 2024-05-31 17:48:10 +0000
Commit:     Gordon Tetlow <gordon@FreeBSD.org>
CommitDate: 2024-06-03 15:48:35 +0000

    Move print_bits to ifconfig.c and make available to other src files.
    
    Reviewed by:    emaste
    Event:          Kitchener-Waterloo Hackathon 202406
    Differential Revision:  https://reviews.freebsd.org/D45441
---
 sbin/ifconfig/ifconfig.c         | 23 +++++++++++++++++++++++
 sbin/ifconfig/ifconfig.h         |  2 ++
 sbin/ifconfig/ifconfig_netlink.c | 23 -----------------------
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index a8bd5a0c89db..92543a281959 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1877,6 +1877,29 @@ Perror(const char *cmd)
 	Perrorc(cmd, errno);
 }
 
+void
+print_bits(const char *btype, uint32_t *v, const int v_count,
+    const char **names, const int n_count)
+{
+	int num = 0;
+
+	for (int i = 0; i < v_count * 32; i++) {
+		bool is_set = v[i / 32] & (1U << (i % 32));
+		if (is_set) {
+			if (num++ == 0)
+				printf("<");
+			if (num != 1)
+				printf(",");
+			if (i < n_count)
+				printf("%s", names[i]);
+			else
+				printf("%s_%d", btype, i);
+		}
+	}
+	if (num > 0)
+		printf(">");
+}
+
 /*
  * Print a value a la the %b format of the kernel's printf
  */
diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h
index 76a5aeb718b1..555e7dbaca64 100644
--- a/sbin/ifconfig/ifconfig.h
+++ b/sbin/ifconfig/ifconfig.h
@@ -260,6 +260,8 @@ void	setifcap(if_ctx *ctx, const char *, int value);
 void	setifcapnv(if_ctx *ctx, const char *vname, const char *arg);
 
 void	Perror(const char *cmd);
+void	print_bits(const char *btype, uint32_t *v, const int v_count,
+		const char **names, const int n_count);
 void	printb(const char *s, unsigned value, const char *bits);
 
 void	ifmaybeload(struct ifconfig_args *args, const char *name);
diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c
index 8964b63caf7b..729d4ca56545 100644
--- a/sbin/ifconfig/ifconfig_netlink.c
+++ b/sbin/ifconfig/ifconfig_netlink.c
@@ -81,29 +81,6 @@ static const char	*IFFBITS[] = {
 	"LOWER_UP",		/* 24:0x1000000 IFF_NETLINK_1*/
 };
 
-static void
-print_bits(const char *btype, uint32_t *v, const int v_count,
-    const char **names, const int n_count)
-{
-	int num = 0;
-
-	for (int i = 0; i < v_count * 32; i++) {
-		bool is_set = v[i / 32] & (1U << (i % 32));
-		if (is_set) {
-			if (num++ == 0)
-				printf("<");
-			if (num != 1)
-				printf(",");
-			if (i < n_count)
-				printf("%s", names[i]);
-			else
-				printf("%s_%d", btype, i);
-		}
-	}
-	if (num > 0)
-		printf(">");
-}
-
 static void
 nl_init_socket(struct snl_state *ss)
 {

From nobody Mon Jun  3 15:52:07 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtJBc22Vsz5MkHg;
	Mon, 03 Jun 2024 15:52:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtJBb6bv5z40X4;
	Mon,  3 Jun 2024 15:52:07 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717429927;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ca3uAXzlAkBfgpKcl9Nb8XjBleMCU/0dehQWaDXEUoU=;
	b=LfN7VooIyNd5l+mJ4fzbidUHLVFI7CTzg9hVm+X0zI8vXSajGvoH3wdnxzcTlLx0KRcD0z
	GvggVPL0bC9SH5HAN35GGR9kFrk2RDFPWVodc9EevpvUzme1weyhvmR5pDx4sryL+dJ+UH
	eZlJ1W+BaeMuFqVC0kpKQiGkYqh7zaQ+PDDs5I5Nh+2GNISteXNT1LyGtj3mQYI9BHtEe9
	5XIoI4alHrK20iL61L7bk7KjU0y6N5XwwORQIFDHRA8rCIYhnoXgeFLMMY8VWN3f7cLffc
	ZlZMGxS7je40xmeNFptD3zxX3IfYLJPbu4RI0ugy/25n/bYpDAYcNksT16zRIQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717429927; a=rsa-sha256; cv=none;
	b=NqQr2dLSI154qwnKtU9QmbcTKjEYH6yoWB6iyfTuoT7zkMSElfOslBjLcJ7oS49hEJ7qvO
	pB9yzlZhD1Z2JcN79fv7FLen0Ljbk1V9RIQb3MmIkIHDziE62l5WVFhRkx2AiVX+iHoetc
	P7P4JEzbM3w8XZmtRX6ocOZYvYOODwjBi3gGS02rbKTiXcVtR0Hv5Yb/CiVK6I0HwWWeFk
	a/pW26O+/4uJkZSFBhVogMi29JuESp2DYs1IKURD17hr3ZtcjGarcx6YmqTtemm7UnZYTD
	9J2qxYfF+aAz2dMEiC9zI42yXO4umzmekhaxI+0CWrbBohvOFDgLygqsAOabnA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717429927;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ca3uAXzlAkBfgpKcl9Nb8XjBleMCU/0dehQWaDXEUoU=;
	b=Mu483yT3ry6sU3k+F7+z1W9UM+4VLqNpZ0zjqsLyPZ356busIaJeDsMe82IBOUF9jDrRnO
	OKAk/I4CPnfQzoaxPqPES5eXU3BvvYvyp1ZKGCv0AVfJK/8LRxlZ5xWU94/a5V4LlcsS6A
	wIY0a3E7+U2prIpOQTcKhqgKvYeM2PJVxCOtj2YFriYdk5c97Nv0xh7efloilyMt7oVay+
	mbZkjsVvnNvpVrGQsLVyVPQ6GBv+x6X9JDqb3dF54iTzkSiViqSQNb8Ymyuw/E6vvEfhkn
	YfX7Hm83oImPZmQu20fJ18hiadHluMUf9K7694pY4efw1Tr7n9iLoEsed3k31w==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtJBb6CLSzh9M;
	Mon,  3 Jun 2024 15:52:07 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453Fq71S008846;
	Mon, 3 Jun 2024 15:52:07 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453Fq7MT008843;
	Mon, 3 Jun 2024 15:52:07 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 15:52:07 GMT
Message-Id: <202406031552.453Fq7MT008843@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Gordon Tetlow <gordon@FreeBSD.org>
Subject: git: a68e4f7a0652 - main - Migrate from printb to print_bits
  for locally defined bit fields.
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: gordon
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: a68e4f7a065218f0bcc5b34ff8d2e73a240b59b2
Auto-Submitted: auto-generated

The branch main has been updated by gordon:

URL: https://cgit.FreeBSD.org/src/commit/?id=a68e4f7a065218f0bcc5b34ff8d2e73a240b59b2

commit a68e4f7a065218f0bcc5b34ff8d2e73a240b59b2
Author:     Gordon Tetlow <gordon@FreeBSD.org>
AuthorDate: 2024-05-31 20:58:52 +0000
Commit:     Gordon Tetlow <gordon@FreeBSD.org>
CommitDate: 2024-06-03 15:48:35 +0000

    Migrate from printb to print_bits for locally defined bit fields.
    
    Reviewed by:    emaste
    Event:          Kitchener-Waterloo Hackathon 202406
    Differential Revision:  https://reviews.freebsd.org/D45441
---
 sbin/ifconfig/af_nd6.c   | 29 ++++++++++++-------
 sbin/ifconfig/ifconfig.c | 75 ++++++++++++++++++++++++++++++++++++++----------
 sbin/ifconfig/ifgif.c    |  7 +++--
 sbin/ifconfig/ifgre.c    |  9 ++++--
 4 files changed, 90 insertions(+), 30 deletions(-)

diff --git a/sbin/ifconfig/af_nd6.c b/sbin/ifconfig/af_nd6.c
index 73044e95740a..2899ad6a0778 100644
--- a/sbin/ifconfig/af_nd6.c
+++ b/sbin/ifconfig/af_nd6.c
@@ -52,17 +52,22 @@
 #include "ifconfig.h"
 
 #define	MAX_SYSCTL_TRY	5
+static const char *ND6BITS[] = {
+	[0]  = "PERFORMNUD",
+	[1]  = "ACCEPT_RTADV",
+	[2]  = "PREFER_SOURCE",
+	[3]  = "IFDISABLED",
+	[4]  = "DONT_SET_IFROUTE",
+	[5]  = "AUTO_LINKLOCAL",
+	[6]  = "NO_RADR",
+	[7]  = "NO_PREFER_IFACE",
+	[8]  = "NO_DAD",
 #ifdef DRAFT_IETF_6MAN_IPV6ONLY_FLAG
-#define	ND6BITS	"\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
-		"\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
-		"\007NO_RADR\010NO_PREFER_IFACE\011NO_DAD" \
-		"\012IPV6_ONLY\013IPV6_ONLY_MANUAL" \
-		"\020DEFAULTIF"
-#else
-#define	ND6BITS	"\020\001PERFORMNUD\002ACCEPT_RTADV\003PREFER_SOURCE" \
-		"\004IFDISABLED\005DONT_SET_IFROUTE\006AUTO_LINKLOCAL" \
-		"\007NO_RADR\010NO_PREFER_IFACE\011NO_DAD\020DEFAULTIF"
+	[9]  = "IPV6_ONLY",
+	[10] = "IPV6_ONLY_MANUAL",
 #endif
+	[15] = "DEFAULTIF",
+};
 
 static int isnd6defif(if_ctx *ctx, int s);
 void setnd6flags(if_ctx *, const char *, int);
@@ -141,6 +146,7 @@ nd6_status(if_ctx *ctx)
 	int s6;
 	int error;
 	int isdefif;
+	uint32_t bits;
 
 	strlcpy(nd.ifname, ctx->ifname, sizeof(nd.ifname));
 	if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
@@ -159,7 +165,8 @@ nd6_status(if_ctx *ctx)
 	close(s6);
 	if (nd.ndi.flags == 0 && !isdefif)
 		return;
-	printb("\tnd6 options",
-	    (unsigned int)(nd.ndi.flags | (isdefif << 15)), ND6BITS);
+	bits = (nd.ndi.flags | (isdefif << 15));
+	printf("\tnd6 options=%x", bits);
+	print_bits("options", &bits, 1, ND6BITS, nitems(ND6BITS));
 	putchar('\n');
 }
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 92543a281959..615de5d4ae14 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1617,17 +1617,60 @@ unsetifdescr(if_ctx *ctx, const char *val __unused, int value __unused)
 
 #ifdef WITHOUT_NETLINK
 
-#define	IFFBITS \
-"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\7RUNNING" \
-"\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \
-"\20MULTICAST\22PPROMISC\23MONITOR\24STATICARP\25STICKYARP"
-
-#define	IFCAPBITS \
-"\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\33NOMAP\34TXTLS4\35TXTLS6" \
-"\36VXLAN_HWCSUM\37VXLAN_HWTSO\40TXTLS_RTLMT"
+static const char *IFFBITS[] = {
+	[0]  = "UP",
+	[1]  = "BROADCAST",
+	[2]  = "DEBUG",
+	[3]  = "LOOPBACK",
+	[4]  = "POINTOPOINT",
+	[6]  = "RUNNING",
+	[7]  = "NOARP",
+	[8]  = "PROMISC",
+	[9]  = "ALLMULTI",
+	[10] = "OACTIVE",
+	[11] = "SIMPLEX",
+	[12] = "LINK0",
+	[13] = "LINK1",
+	[14] = "LINK2",
+	[15] = "MULTICAST",
+	[17] = "PPROMISC",
+	[18] = "MONITOR",
+	[19] = "STATICARP",
+	[20] = "STICKYARP",
+};
+
+static const char *IFCAPBITS[] = {
+	[0]  = "RXCSUM",
+	[1]  = "TXCSUM",
+	[2]  = "NETCONS",
+	[3]  = "VLAN_MTU",
+	[4]  = "VLAN_HWTAGGING",
+	[5]  = "JUMBO_MTU",
+	[6]  = "POLLING",
+	[7]  = "VLAN_HWCSUM",
+	[8]  = "TSO4",
+	[9]  = "TSO6",
+	[10] = "LRO",
+	[11] = "WOL_UCAST",
+	[12] = "WOL_MCAST",
+	[13] = "WOL_MAGIC",
+	[14] = "TOE4",
+	[15] = "TOE6",
+	[16] = "VLAN_HWFILTER",
+	[18] = "VLAN_HWTSO",
+	[19] = "LINKSTATE",
+	[20] = "NETMAP",
+	[21] = "RXCSUM_IPV6",
+	[22] = "TXCSUM_IPV6",
+	[24] = "TXRTLMT",
+	[25] = "HWRXTSTMP",
+	[26] = "NOMAP",
+	[27] = "TXTLS4",
+	[28] = "TXTLS6",
+	[29] = "VXLAN_HWCSUM",
+	[30] = "VXLAN_HWTSO",
+	[31] = "TXTLS_RTLMT",
+};
 
 static void
 print_ifcap_nv(if_ctx *ctx)
@@ -1699,10 +1742,12 @@ print_ifcap(if_ctx *ctx)
 	if ((ifr.ifr_curcap & IFCAP_NV) != 0)
 		print_ifcap_nv(ctx);
 	else {
-		printb("\toptions", ifr.ifr_curcap, IFCAPBITS);
+		printf("\toptions=%x", ifr.ifr_curcap);
+		print_bits("options", &ifr.ifr_curcap, 1, IFCAPBITS, nitems(IFCAPBITS));
 		putchar('\n');
 		if (ctx->args->supmedia && ifr.ifr_reqcap != 0) {
-			printb("\tcapabilities", ifr.ifr_reqcap, IFCAPBITS);
+			printf("\tcapabilities=%x", ifr.ifr_reqcap);
+			print_bits("capabilities", &ifr.ifr_reqcap, 1, IFCAPBITS, nitems(IFCAPBITS));
 			putchar('\n');
 		}
 	}
@@ -1790,8 +1835,8 @@ status(if_ctx *ctx, const struct sockaddr_dl *sdl __unused, struct ifaddrs *ifa)
 	old_s = ctx->io_s;
 	ctx->io_s = s;
 
-	printf("%s: ", ctx->ifname);
-	printb("flags", ifa->ifa_flags, IFFBITS);
+	printf("%s: flags=%x", ctx->ifname, ifa->ifa_flags);
+	print_bits("flags", &ifa->ifa_flags, 1, IFFBITS, nitems(IFFBITS));
 	print_metric(ctx);
 	print_mtu(ctx);
 	putchar('\n');
diff --git a/sbin/ifconfig/ifgif.c b/sbin/ifconfig/ifgif.c
index 6a4bb8b5a240..991cf110678f 100644
--- a/sbin/ifconfig/ifgif.c
+++ b/sbin/ifconfig/ifgif.c
@@ -48,7 +48,9 @@
 
 #include "ifconfig.h"
 
-#define	GIFBITS	"\020\2IGNORE_SOURCE"
+static const char *GIFBITS[] = {
+	[1] = "IGNORE_SOURCE",
+};
 
 static void
 gif_status(if_ctx *ctx)
@@ -60,7 +62,8 @@ gif_status(if_ctx *ctx)
 		return;
 	if (opts == 0)
 		return;
-	printb("\toptions", opts, GIFBITS);
+	printf("\toptions=%x", opts);
+	print_bits("options", &opts, 1, GIFBITS, nitems(GIFBITS));
 	putchar('\n');
 }
 
diff --git a/sbin/ifconfig/ifgre.c b/sbin/ifconfig/ifgre.c
index 3eeed8f3d200..43c86a546167 100644
--- a/sbin/ifconfig/ifgre.c
+++ b/sbin/ifconfig/ifgre.c
@@ -41,7 +41,11 @@
 
 #include "ifconfig.h"
 
-#define	GREBITS	"\020\01ENABLE_CSUM\02ENABLE_SEQ\03UDPENCAP"
+static const char *GREBITS[] = {
+	[0] = "ENABLE_CSUM",
+	[1] = "ENABLE_SEQ",
+	[2] = "UDPENCAP",
+};
 
 static void
 gre_status(if_ctx *ctx)
@@ -60,7 +64,8 @@ gre_status(if_ctx *ctx)
 	ifr.ifr_data = (caddr_t)&port;
 	if (ioctl_ctx_ifr(ctx, GREGPORT, &ifr) == 0 && port != 0)
 		printf("\tudpport: %u\n", port);
-	printb("\toptions", opts, GREBITS);
+	printf("\toptions=%x", opts);
+	print_bits("options", &opts, 1, GREBITS, nitems(GREBITS));
 	putchar('\n');
 }
 

From nobody Mon Jun  3 15:53:22 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtJD318ZQz5Mkp6;
	Mon, 03 Jun 2024 15:53:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtJD30CJ2z41PL;
	Mon,  3 Jun 2024 15:53:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717430003;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=7WKw9+O3RqaVaoXIllQSqe8TvR1+gSC+p3Wq+KQ24xI=;
	b=yntVO+55g+ulyHZ8SfjJbD9xPrWEDQ0qtv1cPQUv/lM4WGY1+byZIQBTL0q8FBzio2e2w8
	iPrG33BVkdKP2PK5/dIgkWC3ETlUDflOpGV7h9XVBionCUWajC8au9VcuCI6/bw5sjYrwM
	7OyvNDb+3DVmOKzKamYKuo5/3PjUKSPPSKTumd4U0XeK8bulLAENR3mvp1L/WCrVBPGk/7
	Rxh5JFcClVRmjgo+Ti1MzN5EWBhVAIm0QZaKAFqJ4VHfZb7IWHPvAxoj8ZednxyPKy3TPm
	M2P+Bp8WDqj7PBjM0Nb41OF0Mi6r6d+L1K20Zgp3FmIigKmAcnvyNxXPVJN/0Q==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717430003; a=rsa-sha256; cv=none;
	b=QLMqQ/EhxhS2STu/QMYEuc3KVpY90r3SIzNuOvfRewXN0BfILU7Dxz6dFwlE57PggJLE7O
	VvAHT6HydSGtGaokACV6v7l6WOWmsK2VmSZBqj9yqsOR84qBeq837glECPZueUs5Ghln3Q
	BByAcbbGrEeB7Jf7M0MDMIkGSGqJJ4ymJgJOKxqVUlZvlU37OzYB5YajzkY/gcTAN/HCfp
	DOImeDxSAMZhmjZSc3sSl0MCJe3/n8LK2TnPMAsqTnMq7Yk1Xn+xXgsmheJRHKgz4BwA4n
	Tx1zJg9rwhtedLp+nxa5ADI18b5suz2FmN7rcr+/b+OXwPdO8bvSXCRfVq2KwQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717430003;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=7WKw9+O3RqaVaoXIllQSqe8TvR1+gSC+p3Wq+KQ24xI=;
	b=cU9Mt2kG3svZnLpVP6FiWGaKDlx1PfKcnQwvfsW+OUTnXqvxxUtZXy9/ny8il3yLU8+Z28
	RYm9xOOssbQkT5dzPVfWTkIEWG2FMQbpncCFUzMbdb8YnYSiCeWd/jjoL3OzlgL/VpEb+c
	U08pyJt0XgKOTPLf3ExYCEwSst373CJfCzVOte0u2P0kVMoSiTYZFyTyw5tWmYSFAmBhn9
	+Dpf5UUjc6pMxHCgWLRJ+6B26Czj/tLZC3f3Evq2lPb452ggX9qexAchjEd40e4VcQVy34
	ksr0OncYkQVK+DTZEOje0Lp87KSB2KxSOSN77OKQMJcOT2ylzlwCisblmvuc1A==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtJD26wRhzh9X;
	Mon,  3 Jun 2024 15:53:22 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453FrMIH010184;
	Mon, 3 Jun 2024 15:53:22 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453FrMlG010181;
	Mon, 3 Jun 2024 15:53:22 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 15:53:22 GMT
Message-Id: <202406031553.453FrMlG010181@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: 80828c6fab02 - main - kern: Remove leftover saf1761otg
  bits
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 80828c6fab0292b5c5a34a63558d837cb9308fbd
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=80828c6fab0292b5c5a34a63558d837cb9308fbd

commit 80828c6fab0292b5c5a34a63558d837cb9308fbd
Author:     Joshua Kinard <freebsd@kumba.dev>
AuthorDate: 2024-05-25 20:26:28 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-03 15:52:58 +0000

    kern: Remove leftover saf1761otg bits
    
    Almost all code related to the saf1761 driver was removed in commit
    44796b7e822e, except for two small bits related to saf1761otg support.
    This patch completes the removal.
    
    PR:             279302
    Signed-off-by:  Joshua Kinard <freebsd@kumba.dev>
    Reviewed by:    mhorne
    MFC after:      3 days
    Fixes:          44796b7e822e ("mips: remove saf1761")
---
 sys/conf/files                          | 2 --
 sys/dev/usb/controller/usb_controller.c | 1 -
 2 files changed, 3 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index 4685d7a63227..875021aaa357 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3247,8 +3247,6 @@ dev/usb/controller/uhci.c		optional uhci
 dev/usb/controller/uhci_pci.c		optional uhci pci
 dev/usb/controller/xhci.c		optional xhci
 dev/usb/controller/xhci_pci.c		optional xhci pci
-dev/usb/controller/saf1761_otg.c	optional saf1761otg
-dev/usb/controller/saf1761_otg_fdt.c	optional saf1761otg fdt
 dev/usb/controller/uss820dci.c		optional uss820dci
 dev/usb/controller/usb_controller.c	optional usb
 #
diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c
index 163ee14bd097..838bd6bf7621 100644
--- a/sys/dev/usb/controller/usb_controller.c
+++ b/sys/dev/usb/controller/usb_controller.c
@@ -135,7 +135,6 @@ DRIVER_MODULE(usbus, octusb, usb_driver, 0, 0);
 
 /* Dual Mode Drivers */
 DRIVER_MODULE(usbus, dwcotg, usb_driver, 0, 0);
-DRIVER_MODULE(usbus, saf1761otg, usb_driver, 0, 0);
 
 /*------------------------------------------------------------------------*
  *	usb_probe

From nobody Mon Jun  3 16:04:48 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtJTF2rJyz5MmDv;
	Mon, 03 Jun 2024 16:04:49 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtJTF0Pwlz42RP;
	Mon,  3 Jun 2024 16:04:49 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717430689;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=CKKMdtGCn2AkIzImopcd2RKmAMOCTsSiO/kBs++wF8A=;
	b=Nguc6xHtAU1haF/7jnJ85pNBd6Ohxwxyeky23XIvAQXOxoFoOF/MpoU5cDa9md5MN0Vpk/
	fsU7sRXFGg/7O5YDHY+RN9eDqcRHLGoPpxioNWjiSzBCsUNoNYYwJvxrRXCHT8m6EaibMG
	awHnBmTtGJ7Jp6fEV2lmwR/pRqJ1lr9VBsCrAiSp76WJQUGz/vNpBNPyN2bu2jF8MoxJ/7
	wHMy+EYzVYlvcWvxnJ7IHUhJ553JJsqrmxgVtWFLDPn4jS3T1NDAAFMktH4mpzbXvay3QY
	XDZFn7oyssB0/7ahaJhoHkptYJtMAHNNeKdR3qmJhvxewH326M0eILQDq43JIg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717430689; a=rsa-sha256; cv=none;
	b=s6maDrhKVKjQMY9cXI8luNYb7jvYChRCj9pfyPMjqc7I1GUDq14tOL/HvtQ7uMg8xjDnsJ
	j7i0qSu12pLFPkJlRulHivtWxQnSio94ehRXUBbNL3mDe2TOV9guvZkBRRFwYbKIBJL2US
	x7e09fSXWWzCzSgScdf9sYELGBRSFqCfkUqcMyAX/m3LqhU+iGdlykP3FYZWQ2i7bcIGmr
	8MEK6wIyiDWPQa3h2IlUZqbjW1iI0wsx/JuEGPPsid4Wug6hjFgsG26l2SXAE2SRivXLJl
	muMB3ZIfIJWQ0zQmD+1BgkH8q+B+1JVqcN90cim+Sbq/ITSa5zsBk7hTfEKDTQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717430689;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=CKKMdtGCn2AkIzImopcd2RKmAMOCTsSiO/kBs++wF8A=;
	b=msc4S0zcn/YQJopTwC/dDMGsrF8GsWkeXJFAyo9lYIOpmPa/t12VEF4VQaTAcvGAhNKD1/
	kqhqXPE4JiVhU/MBmDU+NIUU9hFI1xaAUe8bxf06S+91J2lDQW1SKKOELxuyarCHW/I+Aa
	WsscPE96PFbpJ6OH9GNrwhl1XDdVHFYncifDHoCYQVaYLJo403MurD70sqVEEg0xoYiCq4
	OofvT1ks0BQlxKW4ZkcVAoNceue75iYGkrAb2/Vnkde88UPWDWMQF3Nlrnoax2UmePXxoc
	Ghjr57cNxqEJmhSMkLCRvsZJuJzihBev9TiCNWn7T9zO+/E1mrf5n/rICnXAVQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtJTF014DzhlL;
	Mon,  3 Jun 2024 16:04:49 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453G4mLh027974;
	Mon, 3 Jun 2024 16:04:48 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453G4mGY027971;
	Mon, 3 Jun 2024 16:04:48 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 16:04:48 GMT
Message-Id: <202406031604.453G4mGY027971@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Wolfram Schneider <wosch@FreeBSD.org>
Subject: git: 965fff98260f - main - man(1): ignore absolute path
  for .so include
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: wosch
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 965fff98260ff53707b4ba38ff44fc5683a7189f
Auto-Submitted: auto-generated

The branch main has been updated by wosch:

URL: https://cgit.FreeBSD.org/src/commit/?id=965fff98260ff53707b4ba38ff44fc5683a7189f

commit 965fff98260ff53707b4ba38ff44fc5683a7189f
Author:     Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2024-06-03 16:00:42 +0000
Commit:     Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2024-06-03 16:00:42 +0000

    man(1): ignore absolute path for .so include
    
    We want only a relative include, as ".so man1/foobar.1"
    
    MFC after:      1 week
---
 usr.bin/man/man.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh
index 24a0464689cc..7461153942f5 100755
--- a/usr.bin/man/man.sh
+++ b/usr.bin/man/man.sh
@@ -324,7 +324,8 @@ man_check_for_so() {
 	do
 		line=$($cattool "$manpage" 2>/dev/null | grep -E -m1 -v '^\.\\"[ ]*|^[ ]*$')
 		case "$line" in
-		.so*)	trim "${line#.so}"
+               '.so /'*) break ;; # ignore absolute path
+               '.so '*) trim "${line#.so}"
 			decho "$manpage includes $tstr"
 			# Glob and check for the file.
 			if ! check_man "$1/$tstr" ""; then

From nobody Mon Jun  3 16:54:51 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtKb00tL8z5Mr35;
	Mon, 03 Jun 2024 16:54:52 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtKZz5pY9z49dt;
	Mon,  3 Jun 2024 16:54:51 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717433691;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=IoepO2uCpBaLT0z1S9jyUjamqmR4V6Ndpnw3orAgXZ4=;
	b=gRsz/1XsBy6IYCrCmtQjzINQRYdE+Y+4shqSVBEvjGFHRPJRuB49KVa13F6Am7THHOraDu
	pAYZhCHMguQ45d1hKly3nxwdwNfSC727THld6SaK5RQ2b0SaWoEL+bPuaAK8gYrN/Yx64g
	x5CpogjW129TkomfPBaQHIcZ1EV8b8tOe9cF26dbP3B1R78y82xVA9qELDhxs3g/+O6VWj
	FxoAvgQGvHNNQMYgOLyUKndG6MHeS5JOrpS7qllep6k7HVWqMg8+wck0uT6Yu9urtBz1Xh
	WxTq40ROTNHxBCMk8hofN7zI6y9tAHJODXPb8vRbaoXmBujjeEZ3oT/scTQyuw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717433691; a=rsa-sha256; cv=none;
	b=vFSEcrp8y6/XCTB9sbwl900huFKFkv9OC0wAxTCUSxgzVkM0xILEPmtYmdd26U+b8DDZij
	Z5w05emyNp/O3NengMNyAmt78G3cOElpZYT5BjqjwCevQkk1AssgJ3H5NmbQc7rOuGKr4q
	ddVJAEAWk+2fCikzd/9QXTYcZC3aEheW5JU0LiJhU1MBqMkvyss+yzauAWlAOOLAmm1z3T
	8pcFuxSI1PEACx6Zfai/v+HRBd8dLDbSKL8D2ok/ycuG6+tYlkSGypAdOQ0McynQDnE3W5
	iWLML7aZG8hncROMORtVhgUALTKI+34bJfqw5o/YQLD5zzH7k8fCewK86yg1Zg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717433691;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=IoepO2uCpBaLT0z1S9jyUjamqmR4V6Ndpnw3orAgXZ4=;
	b=UAIczTi9yYJ9LZ2G7TzqI7brdV1wRYKPNk3QqBdp/1pvjWRHOwN3QDJ5jCsNXDEAWeJ3S3
	BNaDIeJKxTeJP8RCrYRmkXieBNn+AqVDQK5qYyOxnbqrOYi9nyYMgHuG+Pk6fXhmToe2Pm
	YJ2NffZ6ZrYyEhgKQ44A5zvfUAHQgpJp23GOVw+yoAdRc828/K7GnR4HygPqqRuqpnGguc
	qpwrn02T8ipDLIOrDsPKqZorMb5gmTH/HxCDxr3yQVmdA3ph8QL6LgMVsP3MwJarwOmJ2i
	f1+9EJQQQCNQukh3Lw0gI/8oohQqm7ABLGK3VcaRNRNErxJTDhBry8blxSz6XA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtKZz5Hcqzk7H;
	Mon,  3 Jun 2024 16:54:51 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453Gsphd012243;
	Mon, 3 Jun 2024 16:54:51 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453Gspu0012240;
	Mon, 3 Jun 2024 16:54:51 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 16:54:51 GMT
Message-Id: <202406031654.453Gspu0012240@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: b0056b31e900 - main - libkern: add ilog2 macro
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: b0056b31e90029553894d17c441cbb2c06d31412
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=b0056b31e90029553894d17c441cbb2c06d31412

commit b0056b31e90029553894d17c441cbb2c06d31412
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-03 16:37:55 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-03 16:37:55 +0000

    libkern: add ilog2 macro
    
    The kernel source contains several definitions of an ilog2 function;
    some are slower than necessary, and one of them is incorrect.
    Elimininate them all and define an ilog2 macro in libkern to replace
    them, in a way that is fast, correct for all argument types, and, in a
    GENERIC kernel, includes a check for an invalid zero parameter.
    
    Folks at Microsoft have verified that having a correct ilog2
    definition for their MANA driver doesn't break it.
    
    Reviewed by:    alc, markj, mhorne (older version), jhibbits (older version)
    Differential Revision:  https://reviews.freebsd.org/D45170
    Differential Revision:  https://reviews.freebsd.org/D45235
---
 sys/amd64/include/cpufunc.h                     |   4 -
 sys/arm64/iommu/smmu.c                          |   9 --
 sys/compat/linuxkpi/common/include/linux/log2.h |  73 ----------------
 sys/dev/bxe/bxe.h                               |  10 ---
 sys/dev/bxe/ecore_sp.h                          |   2 +-
 sys/dev/cxgbe/osdep.h                           |   8 --
 sys/dev/enetc/enetc_hw.h                        |   1 -
 sys/dev/mana/gdma_util.h                        |   9 --
 sys/dev/qat/qat/qat_ocf.c                       |   2 +-
 sys/i386/include/cpufunc.h                      |   9 --
 sys/powerpc/booke/pmap.c                        |   1 -
 sys/powerpc/booke/pmap_32.c                     |  13 ---
 sys/powerpc/booke/pmap_64.c                     |  13 ---
 sys/sys/libkern.h                               | 106 ++++++++++++++++++++++++
 14 files changed, 108 insertions(+), 152 deletions(-)

diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 44d93494d830..62e782304fca 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -65,10 +65,6 @@ breakpoint(void)
 
 #define	bsfq(mask)	__builtin_ctzl(mask)
 
-#define	bsrl(mask)	(__builtin_clz(mask) ^ 0x1f)
-
-#define	bsrq(mask)	(__builtin_clzl(mask) ^ 0x3f)
-
 static __inline void
 clflush(u_long addr)
 {
diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c
index 1d1996a69027..76a7d29dc2db 100644
--- a/sys/arm64/iommu/smmu.c
+++ b/sys/arm64/iommu/smmu.c
@@ -309,15 +309,6 @@ smmu_write_ack(struct smmu_softc *sc, uint32_t reg,
 	return (0);
 }
 
-static inline int
-ilog2(long x)
-{
-
-	KASSERT(x > 0 && powerof2(x), ("%s: invalid arg %ld", __func__, x));
-
-	return (flsl(x) - 1);
-}
-
 static int
 smmu_init_queue(struct smmu_softc *sc, struct smmu_queue *q,
     uint32_t prod_off, uint32_t cons_off, uint32_t dwords)
diff --git a/sys/compat/linuxkpi/common/include/linux/log2.h b/sys/compat/linuxkpi/common/include/linux/log2.h
index 27e91a8bdbe0..2d54c75c7c23 100644
--- a/sys/compat/linuxkpi/common/include/linux/log2.h
+++ b/sys/compat/linuxkpi/common/include/linux/log2.h
@@ -51,79 +51,6 @@ rounddown_pow_of_two(unsigned long x)
 	return (1UL << (flsl(x) - 1));
 }
 
-#define	ilog2(n)				\
-(						\
-	__builtin_constant_p(n) ? (		\
-		(n) < 1 ? -1 :			\
-		(n) & (1ULL << 63) ? 63 :	\
-		(n) & (1ULL << 62) ? 62 :	\
-		(n) & (1ULL << 61) ? 61 :	\
-		(n) & (1ULL << 60) ? 60 :	\
-		(n) & (1ULL << 59) ? 59 :	\
-		(n) & (1ULL << 58) ? 58 :	\
-		(n) & (1ULL << 57) ? 57 :	\
-		(n) & (1ULL << 56) ? 56 :	\
-		(n) & (1ULL << 55) ? 55 :	\
-		(n) & (1ULL << 54) ? 54 :	\
-		(n) & (1ULL << 53) ? 53 :	\
-		(n) & (1ULL << 52) ? 52 :	\
-		(n) & (1ULL << 51) ? 51 :	\
-		(n) & (1ULL << 50) ? 50 :	\
-		(n) & (1ULL << 49) ? 49 :	\
-		(n) & (1ULL << 48) ? 48 :	\
-		(n) & (1ULL << 47) ? 47 :	\
-		(n) & (1ULL << 46) ? 46 :	\
-		(n) & (1ULL << 45) ? 45 :	\
-		(n) & (1ULL << 44) ? 44 :	\
-		(n) & (1ULL << 43) ? 43 :	\
-		(n) & (1ULL << 42) ? 42 :	\
-		(n) & (1ULL << 41) ? 41 :	\
-		(n) & (1ULL << 40) ? 40 :	\
-		(n) & (1ULL << 39) ? 39 :	\
-		(n) & (1ULL << 38) ? 38 :	\
-		(n) & (1ULL << 37) ? 37 :	\
-		(n) & (1ULL << 36) ? 36 :	\
-		(n) & (1ULL << 35) ? 35 :	\
-		(n) & (1ULL << 34) ? 34 :	\
-		(n) & (1ULL << 33) ? 33 :	\
-		(n) & (1ULL << 32) ? 32 :	\
-		(n) & (1ULL << 31) ? 31 :	\
-		(n) & (1ULL << 30) ? 30 :	\
-		(n) & (1ULL << 29) ? 29 :	\
-		(n) & (1ULL << 28) ? 28 :	\
-		(n) & (1ULL << 27) ? 27 :	\
-		(n) & (1ULL << 26) ? 26 :	\
-		(n) & (1ULL << 25) ? 25 :	\
-		(n) & (1ULL << 24) ? 24 :	\
-		(n) & (1ULL << 23) ? 23 :	\
-		(n) & (1ULL << 22) ? 22 :	\
-		(n) & (1ULL << 21) ? 21 :	\
-		(n) & (1ULL << 20) ? 20 :	\
-		(n) & (1ULL << 19) ? 19 :	\
-		(n) & (1ULL << 18) ? 18 :	\
-		(n) & (1ULL << 17) ? 17 :	\
-		(n) & (1ULL << 16) ? 16 :	\
-		(n) & (1ULL << 15) ? 15 :	\
-		(n) & (1ULL << 14) ? 14 :	\
-		(n) & (1ULL << 13) ? 13 :	\
-		(n) & (1ULL << 12) ? 12 :	\
-		(n) & (1ULL << 11) ? 11 :	\
-		(n) & (1ULL << 10) ? 10 :	\
-		(n) & (1ULL <<  9) ?  9 :	\
-		(n) & (1ULL <<  8) ?  8 :	\
-		(n) & (1ULL <<  7) ?  7 :	\
-		(n) & (1ULL <<  6) ?  6 :	\
-		(n) & (1ULL <<  5) ?  5 :	\
-		(n) & (1ULL <<  4) ?  4 :	\
-		(n) & (1ULL <<  3) ?  3 :	\
-		(n) & (1ULL <<  2) ?  2 :	\
-		(n) & (1ULL <<  1) ?  1 :	\
-		(n) & (1ULL <<  0) ?  0 :	\
-		-1) :				\
-	(sizeof(n) <= 4) ?			\
-	fls((u32)(n)) - 1 : flsll((u64)(n)) - 1	\
-)
-
 #define	order_base_2(x) ilog2(roundup_pow_of_two(x))
 
 #endif	/* _LINUXKPI_LINUX_LOG2_H_ */
diff --git a/sys/dev/bxe/bxe.h b/sys/dev/bxe/bxe.h
index 0c7e6232dbdb..79d2792f7d6f 100644
--- a/sys/dev/bxe/bxe.h
+++ b/sys/dev/bxe/bxe.h
@@ -126,16 +126,6 @@
 #ifndef roundup
 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
 #endif
-#ifndef ilog2
-static inline
-int bxe_ilog2(int x)
-{
-    int log = 0;
-    while (x >>= 1) log++;
-    return (log);
-}
-#define ilog2(x) bxe_ilog2(x)
-#endif
 
 #include "ecore_sp.h"
 
diff --git a/sys/dev/bxe/ecore_sp.h b/sys/dev/bxe/ecore_sp.h
index f39c908f7530..917f27549c1b 100644
--- a/sys/dev/bxe/ecore_sp.h
+++ b/sys/dev/bxe/ecore_sp.h
@@ -159,7 +159,7 @@ typedef struct mtx ECORE_MUTEX_SPIN;
 #define ECORE_FREE(_s, _buf, _size) free(_buf, M_TEMP)
 
 #define SC_ILT(sc)  ((sc)->ilt)
-#define ILOG2(x)    bxe_ilog2(x)
+#define ILOG2(x)    ilog2(x)
 
 #define ECORE_ILT_ZALLOC(x, y, size)                                       \
     do {                                                                   \
diff --git a/sys/dev/cxgbe/osdep.h b/sys/dev/cxgbe/osdep.h
index 39675339dd2c..b8692692fd43 100644
--- a/sys/dev/cxgbe/osdep.h
+++ b/sys/dev/cxgbe/osdep.h
@@ -130,14 +130,6 @@ typedef boolean_t bool;
 #define PCI_EXP_LNKSTA_NLW	PCIEM_LINK_STA_WIDTH
 #define PCI_EXP_DEVCTL2		PCIER_DEVICE_CTL2
 
-static inline int
-ilog2(long x)
-{
-	KASSERT(x > 0 && powerof2(x), ("%s: invalid arg %ld", __func__, x));
-
-	return (flsl(x) - 1);
-}
-
 static inline char *
 strstrip(char *s)
 {
diff --git a/sys/dev/enetc/enetc_hw.h b/sys/dev/enetc/enetc_hw.h
index 507c4657453d..323d5529f50a 100644
--- a/sys/dev/enetc/enetc_hw.h
+++ b/sys/dev/enetc/enetc_hw.h
@@ -9,7 +9,6 @@
 
 #define BIT(x)	(1UL << (x))
 #define GENMASK(h, l)	(((~0U) - (1U << (l)) + 1) & (~0U >> (32 - 1 - (h))))
-#define ilog2(x)	(flsl(x) - 1)
 
 #define PCI_VENDOR_FREESCALE	0x1957
 
diff --git a/sys/dev/mana/gdma_util.h b/sys/dev/mana/gdma_util.h
index 822c831b9d70..37c2653d5ec9 100644
--- a/sys/dev/mana/gdma_util.h
+++ b/sys/dev/mana/gdma_util.h
@@ -170,15 +170,6 @@ find_first_zero_bit(const unsigned long *p, unsigned long max)
 	return (max);
 }
 
-static inline unsigned long
-ilog2(unsigned long x)
-{
-	unsigned long log = x;
-	while (x >>= 1)
-		log++;
-	return (log);
-}
-
 static inline unsigned long
 roundup_pow_of_two(unsigned long x)
 {
diff --git a/sys/dev/qat/qat/qat_ocf.c b/sys/dev/qat/qat/qat_ocf.c
index 8958c7b82e49..b25135b6a678 100644
--- a/sys/dev/qat/qat/qat_ocf.c
+++ b/sys/dev/qat/qat/qat_ocf.c
@@ -517,7 +517,7 @@ qat_ocf_session_init(device_t dev,
 				  M_NOWAIT,
 				  0,
 				  ~1UL,
-				  1 << (bsrl(sessionCtxSize - 1) + 1),
+				  1 << (ilog2(sessionCtxSize - 1) + 1),
 				  0);
 	if (NULL == sessionCtx) {
 		device_printf(dev, "unable to allocate memory for session\n");
diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h
index bf643e6da21f..4bed57b5afbf 100644
--- a/sys/i386/include/cpufunc.h
+++ b/sys/i386/include/cpufunc.h
@@ -63,15 +63,6 @@ bsfl(u_int mask)
 	return (result);
 }
 
-static __inline __pure2 u_int
-bsrl(u_int mask)
-{
-	u_int	result;
-
-	__asm("bsrl %1,%0" : "=r" (result) : "rm" (mask) : "cc");
-	return (result);
-}
-
 static __inline void
 clflush(u_long addr)
 {
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index fe84a2a3c213..9f96255ea00e 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -239,7 +239,6 @@ static __inline uint32_t tlb_calc_wimg(vm_paddr_t pa, vm_memattr_t ma);
 
 static vm_size_t tsize2size(unsigned int);
 static unsigned int size2tsize(vm_size_t);
-static unsigned long ilog2(unsigned long);
 
 static void set_mas4_defaults(void);
 
diff --git a/sys/powerpc/booke/pmap_32.c b/sys/powerpc/booke/pmap_32.c
index 580c54c3642f..efeefb6a91c5 100644
--- a/sys/powerpc/booke/pmap_32.c
+++ b/sys/powerpc/booke/pmap_32.c
@@ -116,7 +116,6 @@ static unsigned int kernel_ptbls;	/* Number of KVA ptbls. */
 #define	VM_MAPDEV_BASE	((vm_offset_t)VM_MAXUSER_ADDRESS + PAGE_SIZE)
 
 static void tid_flush(tlbtid_t tid);
-static unsigned long ilog2(unsigned long);
 
 /**************************************************************************/
 /* Page table management */
@@ -931,18 +930,6 @@ mmu_booke_quick_remove_page(vm_offset_t addr)
 /* TID handling */
 /**************************************************************************/
 
-/*
- * Return the largest uint value log such that 2^log <= num.
- */
-static unsigned long
-ilog2(unsigned long num)
-{
-	long lz;
-
-	__asm ("cntlzw %0, %1" : "=r" (lz) : "r" (num));
-	return (31 - lz);
-}
-
 /*
  * Invalidate all TLB0 entries which match the given TID. Note this is
  * dedicated for cases when invalidations should NOT be propagated to other
diff --git a/sys/powerpc/booke/pmap_64.c b/sys/powerpc/booke/pmap_64.c
index 802f37e921a4..affa08ebee3f 100644
--- a/sys/powerpc/booke/pmap_64.c
+++ b/sys/powerpc/booke/pmap_64.c
@@ -125,7 +125,6 @@ static pte_t ****kernel_ptbl_root;
 #define	VM_MAPDEV_PA_MAX	0x4000000000000000 /* Don't encroach on DMAP */
 
 static void tid_flush(tlbtid_t tid);
-static unsigned long ilog2(unsigned long);
 
 /**************************************************************************/
 /* Page table management */
@@ -746,18 +745,6 @@ mmu_booke_quick_remove_page(vm_offset_t addr)
 /* TID handling */
 /**************************************************************************/
 
-/*
- * Return the largest uint value log such that 2^log <= num.
- */
-static unsigned long
-ilog2(unsigned long num)
-{
-	long lz;
-
-	__asm ("cntlzd %0, %1" : "=r" (lz) : "r" (num));
-	return (63 - lz);
-}
-
 /*
  * Invalidate all TLB0 entries which match the given TID. Note this is
  * dedicated for cases when invalidations should NOT be propagated to other
diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h
index 6fbb97e48dac..84d982c43a76 100644
--- a/sys/sys/libkern.h
+++ b/sys/sys/libkern.h
@@ -186,6 +186,112 @@ flsll(long long mask)
 	    8 * sizeof(mask) - __builtin_clzll((unsigned long long)mask));
 }
 
+static __inline __pure2 int
+ilog2_int(int n)
+{
+
+	MPASS(n != 0);
+	return (8 * sizeof(n) - 1 - __builtin_clz((u_int)n));
+}
+
+static __inline __pure2 int
+ilog2_long(long n)
+{
+
+	MPASS(n != 0);
+	return (8 * sizeof(n) - 1 - __builtin_clzl((u_long)n));
+}
+
+static __inline __pure2 int
+ilog2_long_long(long long n)
+{
+
+	MPASS(n != 0);
+	return (8 * sizeof(n) - 1 -
+	    __builtin_clzll((unsigned long long)n));
+}
+
+#define ilog2_var(n)				\
+	_Generic((n),				\
+	    default: ilog2_int,			\
+	    long: ilog2_long,			\
+	    unsigned long: ilog2_long,		\
+	    long long: ilog2_long_long,		\
+	    unsigned long long: ilog2_long_long	\
+	)(n)
+
+#define	ilog2(n)				\
+(						\
+	__builtin_constant_p(n) ? (		\
+	    (n) < 1 ? -1 :			\
+	    (n) & (1ULL << 63) ? 63 :		\
+	    (n) & (1ULL << 62) ? 62 :		\
+	    (n) & (1ULL << 61) ? 61 :		\
+	    (n) & (1ULL << 60) ? 60 :		\
+	    (n) & (1ULL << 59) ? 59 :		\
+	    (n) & (1ULL << 58) ? 58 :		\
+	    (n) & (1ULL << 57) ? 57 :		\
+	    (n) & (1ULL << 56) ? 56 :		\
+	    (n) & (1ULL << 55) ? 55 :		\
+	    (n) & (1ULL << 54) ? 54 :		\
+	    (n) & (1ULL << 53) ? 53 :		\
+	    (n) & (1ULL << 52) ? 52 :		\
+	    (n) & (1ULL << 51) ? 51 :		\
+	    (n) & (1ULL << 50) ? 50 :		\
+	    (n) & (1ULL << 49) ? 49 :		\
+	    (n) & (1ULL << 48) ? 48 :		\
+	    (n) & (1ULL << 47) ? 47 :		\
+	    (n) & (1ULL << 46) ? 46 :		\
+	    (n) & (1ULL << 45) ? 45 :		\
+	    (n) & (1ULL << 44) ? 44 :		\
+	    (n) & (1ULL << 43) ? 43 :		\
+	    (n) & (1ULL << 42) ? 42 :		\
+	    (n) & (1ULL << 41) ? 41 :		\
+	    (n) & (1ULL << 40) ? 40 :		\
+	    (n) & (1ULL << 39) ? 39 :		\
+	    (n) & (1ULL << 38) ? 38 :		\
+	    (n) & (1ULL << 37) ? 37 :		\
+	    (n) & (1ULL << 36) ? 36 :		\
+	    (n) & (1ULL << 35) ? 35 :		\
+	    (n) & (1ULL << 34) ? 34 :		\
+	    (n) & (1ULL << 33) ? 33 :		\
+	    (n) & (1ULL << 32) ? 32 :		\
+	    (n) & (1ULL << 31) ? 31 :		\
+	    (n) & (1ULL << 30) ? 30 :		\
+	    (n) & (1ULL << 29) ? 29 :		\
+	    (n) & (1ULL << 28) ? 28 :		\
+	    (n) & (1ULL << 27) ? 27 :		\
+	    (n) & (1ULL << 26) ? 26 :		\
+	    (n) & (1ULL << 25) ? 25 :		\
+	    (n) & (1ULL << 24) ? 24 :		\
+	    (n) & (1ULL << 23) ? 23 :		\
+	    (n) & (1ULL << 22) ? 22 :		\
+	    (n) & (1ULL << 21) ? 21 :		\
+	    (n) & (1ULL << 20) ? 20 :		\
+	    (n) & (1ULL << 19) ? 19 :		\
+	    (n) & (1ULL << 18) ? 18 :		\
+	    (n) & (1ULL << 17) ? 17 :		\
+	    (n) & (1ULL << 16) ? 16 :		\
+	    (n) & (1ULL << 15) ? 15 :		\
+	    (n) & (1ULL << 14) ? 14 :		\
+	    (n) & (1ULL << 13) ? 13 :		\
+	    (n) & (1ULL << 12) ? 12 :		\
+	    (n) & (1ULL << 11) ? 11 :		\
+	    (n) & (1ULL << 10) ? 10 :		\
+	    (n) & (1ULL <<  9) ?  9 :		\
+	    (n) & (1ULL <<  8) ?  8 :		\
+	    (n) & (1ULL <<  7) ?  7 :		\
+	    (n) & (1ULL <<  6) ?  6 :		\
+	    (n) & (1ULL <<  5) ?  5 :		\
+	    (n) & (1ULL <<  4) ?  4 :		\
+	    (n) & (1ULL <<  3) ?  3 :		\
+	    (n) & (1ULL <<  2) ?  2 :		\
+	    (n) & (1ULL <<  1) ?  1 :		\
+	    (n) & (1ULL <<  0) ?  0 :		\
+	    -1) :				\
+	ilog2_var(n)				\
+)
+
 #define	bitcount64(x)	__bitcount64((uint64_t)(x))
 #define	bitcount32(x)	__bitcount32((uint32_t)(x))
 #define	bitcount16(x)	__bitcount16((uint16_t)(x))

From nobody Mon Jun  3 17:14:04 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtL190Wcjz5Ms4H;
	Mon, 03 Jun 2024 17:14:05 +0000 (UTC)
	(envelope-from brooks@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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtL18722vz4D0R;
	Mon,  3 Jun 2024 17:14:04 +0000 (UTC)
	(envelope-from brooks@freebsd.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717434845;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=Goo78YMjGJcDPxOzrR/uAXPZKJd55/7B16J3WtlU3KU=;
	b=Gin1bDd6mYzxxkaUvlcYGPS2vqHvlXsoayr411RLhvshmxx7he7vECYEouwK6Ae+fVU5QK
	rVi9JCvibwY/CCI+GYzslId2TlLKIb8gks5Q6SL2xvT3cFLB6qTxpnE6nOT59t6vdY3Ma2
	WaH1D/RkTUc9xUYPYKRF6n/Sy6X0KQkOZJ8ergxTom+pC4c8gQIPzfDgZyxqsUfoHYOZYz
	ZVi5FAcvEs1sXDJdChY0ZvZQ4w7GVR3oDZuZIVpLB0rG2xRdDKcodnH/iAMDW5zN7v/vw0
	mDLQmO0wtHvats5CYKV8O1huPVqK4VsYuzilpNjHLYyVQ6GoPszlUa6sXlou3g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717434845; a=rsa-sha256; cv=none;
	b=JjiealKeZQ09Eou5vFUf2eE0HD3ba/Qq5jdeVJQGCXGvJzwrA0q/S/RM9TF6wQRupOKPYz
	bF15k57oZcUyj6qLhFeZJnXvq/N6kH158D4UjPy0QhAk5rS/SVMfWmpshjtHZw0GRCfh0O
	taxC9bz66pPp7xonK/DI5q1XPqIF2T7xqoon/ZQCRJRzkAPayPVWk7lhZHfq2VIJjOwtvN
	tc19/yjVeFTUtXnTPyH+qw0ywXfrN+hxwn1Pg4HdyNvuEP3lWpw2jmdcy3eCTivNKcEoWn
	/MrgwfSTm8OVLPZ3Fk19LpUKSlXsNXmGfdfYk/IewlP/L0YclyvKbCBxm7Op1g==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717434845;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=Goo78YMjGJcDPxOzrR/uAXPZKJd55/7B16J3WtlU3KU=;
	b=OWx/YGS4Cagn4ns3ya1zxlxqfGXdP8MPCw83iZ9Wjgi2PlBdQMwWGjTkgEhAmI08R92w/x
	b1bKo8l30V4BBDk3ArDPaxTdRmXhDHhRBdUx0TkQ9ktiihZk0OlQJ5AINprPyLup9XQJmR
	k7qjO0yshJjQWMn2fJ+0UUmcCwOMvSo+t/bbK+87twhSdmRdez+uoIMVKqp7zT8M87dnKk
	bz7QydbL+SpyVlPF/G4eBQWNkCrwxnTzsZVLEnCcHIaUOM4xXjuK+luSHVqPgw9vm818RL
	pFgB7tBVA8PVGz2ygiiO8o3Jtl6RzQSKqIfmgVB5QUtihIRgS7JxPaaqksmpMQ==
Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: brooks/mail)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4VtL186Q2Rz11VP;
	Mon,  3 Jun 2024 17:14:04 +0000 (UTC)
	(envelope-from brooks@freebsd.org)
Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001)
	id 192D93C019B; Mon,  3 Jun 2024 17:14:04 +0000 (UTC)
Date: Mon, 3 Jun 2024 17:14:04 +0000
From: Brooks Davis <brooks@freebsd.org>
To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org,
	dev-commits-src-main@freebsd.org
Subject: Re: git: af8cafb2a380 - main - iovec: macros to manipulate len and
 base together
Message-ID: <Zl353BrBC56PvVrB@spindle.one-eyed-alien.net>
References: <202406021843.452Ih9Us047105@gitrepo.freebsd.org>
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <202406021843.452Ih9Us047105@gitrepo.freebsd.org>

On Sun, Jun 02, 2024 at 06:43:09PM +0000, Brooks Davis wrote:
> The branch main has been updated by brooks:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=af8cafb2a38070907ed5c4d872599617ce9d6d48
> 
> commit af8cafb2a38070907ed5c4d872599617ce9d6d48
> Author:     Brooks Davis <brooks@FreeBSD.org>
> AuthorDate: 2024-06-02 18:36:55 +0000
> Commit:     Brooks Davis <brooks@FreeBSD.org>
> CommitDate: 2024-06-02 18:41:22 +0000
> 
>     iovec: macros to manipulate len and base together
>     
>     A set of convenience macros to initialize struct iovec's and increment
>     the base and length together.
>     
>     IOVEC_INIT - sets iov_base and iov_len
>     IOVEC_INIT_CSTR - takes a string and sets iov_len to strlen + 1
>     IOVEC_INIT_OBJ - takes an object and sets iov_len to sizeof obj
>     IOVEC_ADVANCE - increments iov_base and decrements iov_len

I've got the vast majority of iovec initializations and simple uses of
IOVEC_ADVANCE handled in CheriBSD.  I'll be bringing those over in
batches as time permits.  It's straightforward, but files tend to have
multiple unrelated changes so I need to extract the diffs by hand.  I
plan to leave contrib code alone for now.

Thanks,
Brooks

From nobody Mon Jun  3 17:25:59 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtLH90Qktz5Msn5
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Mon, 03 Jun 2024 17:26:13 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtLH82wMxz4F6V
	for <dev-commits-src-main@freebsd.org>; Mon,  3 Jun 2024 17:26:12 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Authentication-Results: mx1.freebsd.org;
	dkim=none;
	dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none);
	spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.128.41 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com
Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42133f8432aso17477085e9.3
        for <dev-commits-src-main@freebsd.org>; Mon, 03 Jun 2024 10:26:12 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717435570; x=1718040370;
        h=to:references:message-id:content-transfer-encoding:cc:date
         :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=aotK3EbxMfIJbPwXG9b6gyGvEnCLD4+tut4M1NaEkW8=;
        b=DBaOvwiEqoFLNh3RfX9+QRpf6GKy0AqrhzG3v69X5jn37fvNK9SIAdOq8ppssbx7EG
         qzd15pb/ZyFmhhvO2b/XpB6dlkY2mmnS1tvmHTe2VLk7eK0a5Jc7IY3PPM+EougWdxib
         D/n5a9HhIFgJyGnBD7lyBrgP+ZXaoJMQwv7sqvRzyp7c2tpfIeVVz7Mp4zTTN0IeMmKr
         uVxo+oi/brN932kakJdvBC5ArIgWNi+dI+y8RqbWXokLfpOpg2UzOsHryHCerVrSGRmV
         bVnbz6jpWWNEbBx7pD23SxiXGB1UO87ZEkhD/cbI/gDqaJ128BMru9Iq7OuZCHXg7xzO
         HKNg==
X-Forwarded-Encrypted: i=1; AJvYcCXr3HIZyL60Za7iTZ6KoMtwipHxyPvyvWaY3kBx7gBkin6FiP6T5Sts9goKZdh1RTpYr/tecUxFabVOJgfSRucyG/onoos8bfR0pYbQvj488A==
X-Gm-Message-State: AOJu0YxHhjgiHFSQt+uTLk8HXR46LV85o1N4EAkTvyQROr1su4BGiPFr
	8vDSkztPDCaNU5RFGqH3dZS5KrTOwesZcmdP1Xq2CsC3izOH1/8Hw098OFilNLs=
X-Google-Smtp-Source: AGHT+IEXOOlSGiQ0e2oPMNJvI5I1LacTXMrv2Hl9GCUzRwNE8RAdAlvMP2weKvzMYPBZWPWFl9Roqw==
X-Received: by 2002:a05:600c:4754:b0:421:2a0c:b5ad with SMTP id 5b1f17b1804b1-4212e049ccamr99693315e9.10.1717435570139;
        Mon, 03 Jun 2024 10:26:10 -0700 (PDT)
Received: from smtpclient.apple ([131.111.5.246])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd04d9c73sm9287436f8f.58.2024.06.03.10.26.09
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 03 Jun 2024 10:26:09 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
Subject: Re: git: 077f757d72e5 - main - newfs_msdos: align data area to VM
 page boundary by default
From: Jessica Clarke <jrtc27@freebsd.org>
In-Reply-To: <202406021227.452CRx8I007470@gitrepo.freebsd.org>
Date: Mon, 3 Jun 2024 18:25:59 +0100
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>
References: <202406021227.452CRx8I007470@gitrepo.freebsd.org>
To: =?utf-8?Q?Stefan_E=C3=9Fer?= <se@FreeBSD.org>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
X-Spamd-Bar: --
X-Spamd-Result: default: False [-2.39 / 15.00];
	NEURAL_HAM_LONG(-1.00)[-1.000];
	NEURAL_HAM_MEDIUM(-1.00)[-1.000];
	NEURAL_HAM_SHORT(-0.99)[-0.994];
	MV_CASE(0.50)[];
	FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com];
	R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c];
	MIME_GOOD(-0.10)[text/plain];
	DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none];
	MIME_TRACE(0.00)[0:+];
	TO_DN_SOME(0.00)[];
	TO_DN_EQ_ADDR_SOME(0.00)[];
	RCPT_COUNT_THREE(0.00)[4];
	RCVD_TLS_LAST(0.00)[];
	ARC_NA(0.00)[];
	FREEFALL_USER(0.00)[jrtc27];
	ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
	FROM_HAS_DN(0.00)[];
	RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.128.41:from];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	RCVD_COUNT_TWO(0.00)[2];
	FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org];
	R_DKIM_NA(0.00)[];
	MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org];
	MID_RHS_MATCH_FROM(0.00)[];
	RCVD_IN_DNSWL_NONE(0.00)[209.85.128.41:from]
X-Rspamd-Queue-Id: 4VtLH82wMxz4F6V

On 2 Jun 2024, at 13:27, Stefan E=C3=9Fer <se@FreeBSD.org> wrote:
>=20
> The branch main has been updated by se:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D077f757d72e561eb84193d8e58f63e96=
e69b8096
>=20
> commit 077f757d72e561eb84193d8e58f63e96e69b8096
> Author:     Stefan E=C3=9Fer <se@FreeBSD.org>
> AuthorDate: 2024-06-02 12:07:52 +0000
> Commit:     Stefan E=C3=9Fer <se@FreeBSD.org>
> CommitDate: 2024-06-02 12:07:52 +0000
>=20
>    newfs_msdos: align data area to VM page boundary by default
>=20
>    Without alignment, the data area will not be aligned with the =
buffer
>    cache, leading to overhead, higher write multiplication on SSD =
devices
>    and issues with very large cluster sizes (see PR 277414).
>=20
>    The -A option used to align the start of the root directory to a
>    multiple of the cluster size, which happens to align the start of =
the
>    data area with a buffer page boundary in case of large clusters and
>    the default number of directory entries (512 entries requiring 16 =
KB
>    for FAT12 or FAT16, FAT32 puts the root directory into the data =
area).
>=20
>    This commit aligns the start of the data area with the page size, =
if
>    neither -A nor -r is used. It changes -A to align the start of the
>    data area (end of the root directory) to a multiple of the cluster
>    size, since this is the alignment that prevents write =
multiplication
>    due to clusters crossing erase block boundaries of a SSD device.
>    The -r option is unchanged and will prevent any automatic alignment
>    from occuring.

Hi,
This has completely broken[1] all of the Linux and macOS cross-build CI
jobs (which pass -DWITH_DISK_IMAGE_TOOLS_BOOTSTRAP). Please either fix
this promptly or back it out until you can do so.

Jess

[1] See https://github.com/freebsd/freebsd-src/actions/runs/9338256762


From nobody Mon Jun  3 17:49:45 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtLpK3671z5MvkJ;
	Mon, 03 Jun 2024 17:49:45 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtLpK2SNRz4Gdm;
	Mon,  3 Jun 2024 17:49:45 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717436985;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=VveQMbggL9xsGzl/g3lkNy6kEBmgkK7rhieKW0HOEgk=;
	b=LEgA4sbYJcEs1zvj0wGSKDEM8hMGT1+Cd4C4IvH3a1yiSFYWWNKKWkAwdgQn+G20uIzJSn
	DJOYI2F1e7gwvdQ4Bj/nVksHmjzJ9/fPb0OXkkq3ZnorhblKHZkNeSRyWFDLENKQXBcupy
	/ohVCUhpsERkRgLcVprJvmcG7Vqpvfrq8aNt3TXxsx5clfMC2tW2V+n05F0fdH2cgSNVQp
	Abf7+goGTikly7nde7l+n6ZlQtCxxXsQg9zxUsFzllWZV4LyQxNnSGnyN1+ssNOaJxc6Y0
	DdbHkCdFl2raoqNenNSfxWgTJHutIT4DnhF0004GPo1zF8hoFjUZujnE4ovn8w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717436985; a=rsa-sha256; cv=none;
	b=tGNJQ6TMFPSKGCVcVaCTrdsEXKueZOAS7T3UoWiJtP+Tdbn91RMw4jkW2lKIfJrIk3bKJA
	sxCE4in52PzEYza4wBQoeYnIJOap0wfv9RR5dfx1pOW5Dci9ga2uH75U/DIrNGLgLJLK/p
	SIQk9YdLVx+qGM9Fa7zVmf6o7Stt4hylyX+i/tKa568eAtJr/TDsStjoCWF/BiUfc40Yix
	7dICjjDAOK8AVehDGOn47JR1xEVo3IoX17TeMvabUK2NDuN8JOKwFYsPMwIM4Ca6u5gpSJ
	iZ900wvgaIa6NPQKpJOFCLyjahK4dSO6SKyqlcThazf1fxKlsinVT1N2lXZ+aQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717436985;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=VveQMbggL9xsGzl/g3lkNy6kEBmgkK7rhieKW0HOEgk=;
	b=tDdp7PNXHwQEGGz68G/r+vZsbjdwMuxWfMNCp0GIRtGXYdudReJ7XPjYGr1HdqbLgxjIuK
	vpqo1qQPCRxOoOEvjh4qFOpmG1y+MDursbW5cukFpJa9zzxQmzGmGIgeuw8fKTjQ2fjGR0
	4aOeaIuChFtn9GSuJtGC9S7CeTkrJaOFCb/cWi+FAVggio7VYS0Kg3PJ1vbVcmGls+5isi
	j8+n9xAUW3WdY+IkVI7C+bK14mnIHHr247ExgaXc/f5UM9MLCYdLJAjzObcn6Lj70ID3Km
	sUQ6R2+FfVxiymF7jGrGBUK4kLP2CEy2q6Ep4nx8WlLhf3RSEgcgh8WQq9fDsQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtLpK23SWzlDY;
	Mon,  3 Jun 2024 17:49:45 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453HnjJN097498;
	Mon, 3 Jun 2024 17:49:45 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453HnjKC097495;
	Mon, 3 Jun 2024 17:49:45 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 17:49:45 GMT
Message-Id: <202406031749.453HnjKC097495@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: 574ef6506950 - main - subr_pctrie: use ilog2(x) instead
  of fls(x)-1
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 574ef650695088d56ea12df7da76155370286f9f
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=574ef650695088d56ea12df7da76155370286f9f

commit 574ef650695088d56ea12df7da76155370286f9f
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-03 17:45:45 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-03 17:45:45 +0000

    subr_pctrie: use ilog2(x) instead of fls(x)-1
    
    In three instances where fls(x)-1 is used, the compiler does not know
    that x is nonzero and so adds needless zero checks.  Using ilog(x)
    instead saves, in each instance, about 4 instructions, including a
    conditional, and 16 or so bytes, on an amd64 build.
    
    Reviewed by:    alc
    Differential Revision:  https://reviews.freebsd.org/D45330
---
 sys/kern/subr_pctrie.c |   6 +--
 sys/vm/_vm_phys.h      |   4 +-
 sys/vm/vm_page.c       |   5 +-
 sys/vm/vm_phys.c       | 123 ++++++++++++++++++++++++++++++-------------------
 sys/vm/vm_phys.h       |   2 +-
 sys/vm/vm_reserv.c     |  33 +++++++------
 6 files changed, 104 insertions(+), 69 deletions(-)

diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c
index 85df0a9bf9e4..76f4ee17a8ca 100644
--- a/sys/kern/subr_pctrie.c
+++ b/sys/kern/subr_pctrie.c
@@ -350,7 +350,7 @@ pctrie_insert_node(void *parentp, struct pctrie_node *parent, uint64_t *val)
 	    "uint64 too wide");
 	_Static_assert(sizeof(uint64_t) * NBBY <=
 	    (1 << (sizeof(parent->pn_clev) * NBBY)), "pn_clev too narrow");
-	parent->pn_clev = rounddown(flsll(index ^ newind) - 1, PCTRIE_WIDTH);
+	parent->pn_clev = rounddown(ilog2(index ^ newind), PCTRIE_WIDTH);
 	parent->pn_owner = PCTRIE_COUNT;
 	parent->pn_owner = index & -(parent->pn_owner << parent->pn_clev);
 
@@ -546,14 +546,14 @@ pctrie_lookup_le(struct pctrie *ptree, uint64_t index)
 		KASSERT((pred->pn_popmap & ((1 << slot) - 1)) != 0,
 		    ("%s: no popmap siblings before slot %d in node %p",
 		    __func__, slot, pred));
-		slot = fls(pred->pn_popmap & ((1 << slot) - 1)) - 1;
+		slot = ilog2(pred->pn_popmap & ((1 << slot) - 1));
 		pred = pctrie_node_load(&pred->pn_child[slot], NULL,
 		    PCTRIE_LOCKED);
 	}
 	while (!pctrie_isleaf(pred)) {
 		KASSERT(pred->pn_popmap != 0,
 		    ("%s: no popmap children in node %p",  __func__, pred));
-		slot = fls(pred->pn_popmap) - 1;
+		slot = ilog2(pred->pn_popmap);
 		pred = pctrie_node_load(&pred->pn_child[slot], NULL,
 		    PCTRIE_LOCKED);
 	}
diff --git a/sys/vm/_vm_phys.h b/sys/vm/_vm_phys.h
index 36e1074568e9..e3cf09081537 100644
--- a/sys/vm/_vm_phys.h
+++ b/sys/vm/_vm_phys.h
@@ -51,6 +51,8 @@ struct vm_freelist {
 	int lcnt;
 };
 
+typedef struct vm_freelist vm_freelist_tbl[VM_NFREEPOOL][VM_NFREEORDER_MAX];
+
 struct vm_phys_seg {
 	vm_paddr_t	start;
 	vm_paddr_t	end;
@@ -62,7 +64,7 @@ struct vm_phys_seg {
 	void		*md_first;
 #endif
 	int		domain;
-	struct vm_freelist (*free_queues)[VM_NFREEPOOL][VM_NFREEORDER_MAX];
+	vm_freelist_tbl *free_queues;
 };
 
 extern struct vm_phys_seg vm_phys_segs[];
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 9ba31cb9e1b3..7c2bed8339ed 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -509,7 +509,7 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind)
 	m->psind = 0;
 	m->segind = segind;
 	m->order = VM_NFREEORDER;
-	m->pool = VM_FREEPOOL_DEFAULT;
+	m->pool = VM_NFREEPOOL;
 	m->valid = m->dirty = 0;
 	pmap_page_init(m);
 }
@@ -785,7 +785,8 @@ vm_page_startup(vm_offset_t vaddr)
 			m = seg->first_page + atop(startp - seg->start);
 			vmd = VM_DOMAIN(seg->domain);
 			vm_domain_free_lock(vmd);
-			vm_phys_enqueue_contig(m, pagecount);
+			vm_phys_enqueue_contig(m, VM_FREEPOOL_DEFAULT,
+			    pagecount);
 			vm_domain_free_unlock(vmd);
 			vm_domain_freecnt_inc(vmd, pagecount);
 			vm_cnt.v_page_count += (u_int)pagecount;
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 66ad9c13dceb..945e018710a1 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -669,6 +669,7 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order,
     int tail)
 {
 	vm_page_t m_buddy;
+	int pool = m->pool;
 
 	while (oind > order) {
 		oind--;
@@ -676,6 +677,10 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order,
 		KASSERT(m_buddy->order == VM_NFREEORDER,
 		    ("vm_phys_split_pages: page %p has unexpected order %d",
 		    m_buddy, m_buddy->order));
+		KASSERT(m_buddy->pool == VM_NFREEPOOL,
+		    ("vm_phys_split_pages: page %p has unexpected pool %d",
+		    m_buddy, m_buddy->pool));
+		m_buddy->pool = pool;
 		vm_freelist_add(fl, m_buddy, oind, tail);
         }
 }
@@ -693,7 +698,8 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order,
  * The physical page m's buddy must not be free.
  */
 static void
-vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
+vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
+    int tail)
 {
         int order;
 
@@ -709,6 +715,7 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
                 order = fls(npages) - 1;
 		KASSERT(order < VM_NFREEORDER,
 		    ("%s: order %d is out of range", __func__, order));
+		m->pool = pool;
                 vm_freelist_add(fl, m, order, tail);
 		m += 1 << order;
                 npages -= 1 << order;
@@ -729,7 +736,8 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
  * parameter m.  Otherwise, the physical page m's buddy must not be free.
  */
 static vm_page_t
-vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
+vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
+    int tail)
 {
 	int order;
 
@@ -745,6 +753,7 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
 		order = ffs(npages) - 1;
 		KASSERT(order < VM_NFREEORDER,
 		    ("vm_phys_enq_range: order %d is out of range", order));
+		m->pool = pool;
 		vm_freelist_add(fl, m, order, tail);
 		m += 1 << order;
 		npages -= 1 << order;
@@ -752,18 +761,6 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
 	return (m);
 }
 
-/*
- * Set the pool for a contiguous, power of two-sized set of physical pages. 
- */
-static void
-vm_phys_set_pool(int pool, vm_page_t m, int order)
-{
-	vm_page_t m_tmp;
-
-	for (m_tmp = m; m_tmp < &m[1 << order]; m_tmp++)
-		m_tmp->pool = pool;
-}
-
 /*
  * Tries to allocate the specified number of pages from the specified pool
  * within the specified domain.  Returns the actual number of allocated pages
@@ -772,7 +769,8 @@ vm_phys_set_pool(int pool, vm_page_t m, int order)
  * The returned pages may not be physically contiguous.  However, in contrast
  * to performing multiple, back-to-back calls to vm_phys_alloc_pages(..., 0),
  * calling this function once to allocate the desired number of pages will
- * avoid wasted time in vm_phys_split_pages().
+ * avoid wasted time in vm_phys_split_pages().  Sets the pool field for
+ * every allocated page.
  *
  * The free page queues for the specified domain must be locked.
  */
@@ -801,14 +799,18 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 				vm_freelist_rem(fl, m, oind);
 				avail = i + (1 << oind);
 				end = imin(npages, avail);
-				while (i < end)
+				ma[i++] = m++;
+				while (i < end) {
+					m->pool = pool;
 					ma[i++] = m++;
+				}
 				if (i == npages) {
 					/*
 					 * Return excess pages to fl.  Its order
 					 * [0, oind) queues are empty.
 					 */
-					vm_phys_enq_range(m, avail - i, fl, 1);
+					vm_phys_enq_range(m, avail - i, fl,
+					    pool, 1);
 					return (npages);
 				}
 			}
@@ -819,11 +821,12 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 				while ((m = TAILQ_FIRST(&alt[oind].pl)) !=
 				    NULL) {
 					vm_freelist_rem(alt, m, oind);
-					vm_phys_set_pool(pool, m, oind);
 					avail = i + (1 << oind);
 					end = imin(npages, avail);
-					while (i < end)
+					do {
+						m->pool = pool;
 						ma[i++] = m++;
+					} while (i < end);
 					if (i == npages) {
 						/*
 						 * Return excess pages to fl.
@@ -831,7 +834,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 						 * are empty.
 						 */
 						vm_phys_enq_range(m, avail - i,
-						    fl, 1);
+						    fl, pool, 1);
 						return (npages);
 					}
 				}
@@ -843,7 +846,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 
 /*
  * Allocate a contiguous, power of two-sized set of physical pages
- * from the free lists.
+ * from the free lists.  Sets the pool field in the first page only.
  *
  * The free page queues must be locked.
  */
@@ -864,7 +867,8 @@ vm_phys_alloc_pages(int domain, int pool, int order)
 /*
  * Allocate a contiguous, power of two-sized set of physical pages from the
  * specified free list.  The free list must be specified using one of the
- * manifest constants VM_FREELIST_*.
+ * manifest constants VM_FREELIST_*.  Sets the pool field in the first page
+ * only.
  *
  * The free page queues must be locked.
  */
@@ -915,7 +919,7 @@ vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order)
 			m = TAILQ_FIRST(&alt[oind].pl);
 			if (m != NULL) {
 				vm_freelist_rem(alt, m, oind);
-				vm_phys_set_pool(pool, m, oind);
+				m->pool = pool;
 				/* The order [order, oind) queues are empty. */
 				vm_phys_split_pages(m, oind, fl, order, 1);
 				return (m);
@@ -1122,7 +1126,8 @@ vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end)
 }
 
 /*
- * Free a contiguous, power of two-sized set of physical pages.
+ * Free a contiguous, power of two-sized set of physical pages.  Assumes that
+ * only the first page has a valid pool field.
  *
  * The free page queues must be locked.
  */
@@ -1133,18 +1138,19 @@ vm_phys_free_pages(vm_page_t m, int order)
 	struct vm_phys_seg *seg;
 	vm_paddr_t pa;
 	vm_page_t m_buddy;
+	int pool = m->pool;
 
 	KASSERT(m->order == VM_NFREEORDER,
 	    ("vm_phys_free_pages: page %p has unexpected order %d",
 	    m, m->order));
-	KASSERT(m->pool < VM_NFREEPOOL,
-	    ("vm_phys_free_pages: page %p has unexpected pool %d",
-	    m, m->pool));
+	KASSERT(pool < VM_NFREEPOOL,
+	    ("vm_phys_free_pages: page %p has unexpected pool %d", m, pool));
 	KASSERT(order < VM_NFREEORDER,
 	    ("vm_phys_free_pages: order %d is out of range", order));
 	seg = &vm_phys_segs[m->segind];
 	vm_domain_free_assert_locked(VM_DOMAIN(seg->domain));
 	if (order < VM_NFREEORDER - 1) {
+		vm_page_t m_start = m;
 		pa = VM_PAGE_TO_PHYS(m);
 		do {
 			pa ^= ((vm_paddr_t)1 << (PAGE_SHIFT + order));
@@ -1155,25 +1161,28 @@ vm_phys_free_pages(vm_page_t m, int order)
 				break;
 			fl = (*seg->free_queues)[m_buddy->pool];
 			vm_freelist_rem(fl, m_buddy, order);
-			if (m_buddy->pool != m->pool)
-				vm_phys_set_pool(m->pool, m_buddy, order);
+			m_buddy->pool = VM_NFREEPOOL;
 			order++;
 			pa &= ~(((vm_paddr_t)1 << (PAGE_SHIFT + order)) - 1);
 			m = &seg->first_page[atop(pa - seg->start)];
 		} while (order < VM_NFREEORDER - 1);
+		if (m != m_start) {
+			m_start->pool = VM_NFREEPOOL;
+			m->pool = pool;
+		}
 	}
-	fl = (*seg->free_queues)[m->pool];
+	fl = (*seg->free_queues)[pool];
 	vm_freelist_add(fl, m, order, 1);
 }
 
 /*
- * Free a contiguous, arbitrarily sized set of physical pages, without
- * merging across set boundaries.
+ * Free a contiguous, arbitrarily sized set of physical pages, without merging
+ * across set boundaries.  Assumes no pages have a valid pool field.
  *
  * The free page queues must be locked.
  */
 void
-vm_phys_enqueue_contig(vm_page_t m, u_long npages)
+vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages)
 {
 	struct vm_freelist *fl;
 	struct vm_phys_seg *seg;
@@ -1187,14 +1196,15 @@ vm_phys_enqueue_contig(vm_page_t m, u_long npages)
 	 */
 	vm_domain_free_assert_locked(vm_pagequeue_domain(m));
 	seg = &vm_phys_segs[m->segind];
-	fl = (*seg->free_queues)[m->pool];
+	fl = (*seg->free_queues)[pool];
 	m_end = m + npages;
 	/* Free blocks of increasing size. */
 	lo = atop(VM_PAGE_TO_PHYS(m));
 	if (m < m_end &&
 	    (diff = lo ^ (lo + npages - 1)) != 0) {
 		order = min(flsll(diff) - 1, VM_NFREEORDER - 1);
-		m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl, 1);
+		m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl,
+		    pool, 1);
 	}
 
 	/* Free blocks of maximum size. */
@@ -1203,15 +1213,17 @@ vm_phys_enqueue_contig(vm_page_t m, u_long npages)
 		KASSERT(seg == &vm_phys_segs[m->segind],
 		    ("%s: page range [%p,%p) spans multiple segments",
 		    __func__, m_end - npages, m));
+		m->pool = pool;
 		vm_freelist_add(fl, m, order, 1);
 		m += 1 << order;
 	}
 	/* Free blocks of diminishing size. */
-	vm_phys_enq_beg(m, m_end - m, fl, 1);
+	vm_phys_enq_beg(m, m_end - m, fl, pool, 1);
 }
 
 /*
  * Free a contiguous, arbitrarily sized set of physical pages.
+ * Assumes that every page has the same, valid, pool field value.
  *
  * The free page queues must be locked.
  */
@@ -1221,17 +1233,22 @@ vm_phys_free_contig(vm_page_t m, u_long npages)
 	vm_paddr_t lo;
 	vm_page_t m_start, m_end;
 	unsigned max_order, order_start, order_end;
+	int pool = m->pool;
+
+	KASSERT(pool < VM_NFREEPOOL,
+	    ("%s: pool %d is out of range", __func__, pool));
 
 	vm_domain_free_assert_locked(vm_pagequeue_domain(m));
 
 	lo = atop(VM_PAGE_TO_PHYS(m));
 	max_order = min(flsll(lo ^ (lo + npages)) - 1, VM_NFREEORDER - 1);
-
-	m_start = m;
+	m_end = m + npages;
+	for (m_start = m; m < m_end; m++)
+		m->pool = VM_NFREEPOOL;
+	m = m_start;
 	order_start = ffsll(lo) - 1;
 	if (order_start < max_order)
 		m_start += 1 << order_start;
-	m_end = m + npages;
 	order_end = ffsll(lo + npages) - 1;
 	if (order_end < max_order)
 		m_end -= 1 << order_end;
@@ -1240,11 +1257,15 @@ vm_phys_free_contig(vm_page_t m, u_long npages)
 	 * end of the range last.
 	 */
 	if (m_start < m_end)
-		vm_phys_enqueue_contig(m_start, m_end - m_start);
-	if (order_start < max_order)
+		vm_phys_enqueue_contig(m_start, pool, m_end - m_start);
+	if (order_start < max_order) {
+		m->pool = pool;
 		vm_phys_free_pages(m, order_start);
-	if (order_end < max_order)
+	}
+	if (order_end < max_order) {
+		m_end->pool = pool;
 		vm_phys_free_pages(m_end, order_end);
+	}
 }
 
 /*
@@ -1292,7 +1313,7 @@ vm_phys_unfree_page(vm_page_t m)
 	struct vm_phys_seg *seg;
 	vm_paddr_t pa, pa_half;
 	vm_page_t m_set, m_tmp;
-	int order;
+	int order, pool;
 
 	/*
 	 * First, find the contiguous, power of two-sized set of free
@@ -1324,7 +1345,8 @@ vm_phys_unfree_page(vm_page_t m)
 	 * is larger than a page, shrink "m_set" by returning the half
 	 * of "m_set" that does not contain "m" to the free lists.
 	 */
-	fl = (*seg->free_queues)[m_set->pool];
+	pool = m_set->pool;
+	fl = (*seg->free_queues)[pool];
 	order = m_set->order;
 	vm_freelist_rem(fl, m_set, order);
 	while (order > 0) {
@@ -1336,8 +1358,10 @@ vm_phys_unfree_page(vm_page_t m)
 			m_tmp = m_set;
 			m_set = &seg->first_page[atop(pa_half - seg->start)];
 		}
+		m_tmp->pool = pool;
 		vm_freelist_add(fl, m_tmp, order, 0);
 	}
+	m_set->pool = pool;
 	KASSERT(m_set == m, ("vm_phys_unfree_page: fatal inconsistency"));
 	return (true);
 }
@@ -1477,7 +1501,8 @@ vm_phys_find_queues_contig(
  * alignment of the first physical page in the set.  If the given value
  * "boundary" is non-zero, then the set of physical pages cannot cross
  * any physical address boundary that is a multiple of that value.  Both
- * "alignment" and "boundary" must be a power of two.
+ * "alignment" and "boundary" must be a power of two.  Sets the pool
+ * field in every allocated page.
  */
 vm_page_t
 vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high,
@@ -1536,14 +1561,16 @@ vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high,
 		fl = (*queues)[m->pool];
 		oind = m->order;
 		vm_freelist_rem(fl, m, oind);
-		if (m->pool != VM_FREEPOOL_DEFAULT)
-			vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind);
 	}
 	/* Return excess pages to the free lists. */
 	fl = (*queues)[VM_FREEPOOL_DEFAULT];
-	vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl, 0);
+	vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl,
+	    VM_FREEPOOL_DEFAULT, 0);
 
 	/* Return page verified to satisfy conditions of request. */
+	for (m = m_run; m < &m_run[npages]; m++)
+		m->pool = VM_FREEPOOL_DEFAULT;
+	
 	pa_start = VM_PAGE_TO_PHYS(m_run);
 	KASSERT(low <= pa_start,
 	    ("memory allocated below minimum requested range"));
diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h
index 1f502ad745c4..8b2d2f7e2251 100644
--- a/sys/vm/vm_phys.h
+++ b/sys/vm/vm_phys.h
@@ -66,7 +66,7 @@ vm_page_t vm_phys_alloc_freelist_pages(int domain, int freelist, int pool,
 int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]);
 vm_page_t vm_phys_alloc_pages(int domain, int pool, int order);
 int vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high);
-void vm_phys_enqueue_contig(vm_page_t m, u_long npages);
+void vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages);
 int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end,
     vm_memattr_t memattr);
 void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end);
diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c
index a4bbccdfb428..80f62981dee0 100644
--- a/sys/vm/vm_reserv.c
+++ b/sys/vm/vm_reserv.c
@@ -889,30 +889,35 @@ out:
 static void
 vm_reserv_break(vm_reserv_t rv)
 {
-	int hi, lo, pos;
+	int pool, pos, pos0, pos1;
 
 	vm_reserv_assert_locked(rv);
 	CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d",
 	    __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq);
 	vm_reserv_remove(rv);
 	rv->pages->psind = 0;
-	hi = lo = -1;
-	pos = 0;
-	for (;;) {
-		bit_ff_at(rv->popmap, pos, VM_LEVEL_0_NPAGES, lo != hi, &pos);
-		if (lo == hi) {
-			if (pos == -1)
-				break;
-			lo = pos;
-			continue;
-		}
+	pool = rv->pages->pool;
+	rv->pages->pool = VM_NFREEPOOL;
+	pos0 = bit_test(rv->popmap, 0) ? -1 : 0;
+	pos1 = -1 - pos0;
+	for (pos = 0; pos < VM_LEVEL_0_NPAGES; ) {
+		/* Find the first different bit after pos. */
+		bit_ff_at(rv->popmap, pos + 1, VM_LEVEL_0_NPAGES,
+		    pos1 < pos0, &pos);
 		if (pos == -1)
 			pos = VM_LEVEL_0_NPAGES;
-		hi = pos;
+		if (pos0 <= pos1) {
+			/* Set pool for pages from pos1 to pos. */
+			pos0 = pos1;
+			while (pos0 < pos)
+				rv->pages[pos0++].pool = pool;
+			continue;
+		}
+		/* Free unused pages from pos0 to pos. */
+		pos1 = pos;
 		vm_domain_free_lock(VM_DOMAIN(rv->domain));
-		vm_phys_enqueue_contig(&rv->pages[lo], hi - lo);
+		vm_phys_enqueue_contig(&rv->pages[pos0], pool, pos1 - pos0);
 		vm_domain_free_unlock(VM_DOMAIN(rv->domain));
-		lo = hi;
 	}
 	bit_nclear(rv->popmap, 0, VM_LEVEL_0_NPAGES - 1);
 	rv->popcnt = 0;

From nobody Mon Jun  3 17:50:02 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtLpk1y20z5Mvn8;
	Mon, 03 Jun 2024 17:50:06 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32])
	(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 4VtLpj6lJ8z4Gtb;
	Mon,  3 Jun 2024 17:50:05 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227])
	by cmsmtp with ESMTPS
	id E8BZsUKQY2Ui5EBorsIQrm; Mon, 03 Jun 2024 17:50:05 +0000
Received: from spqr.komquats.com ([70.66.152.170])
	by cmsmtp with ESMTPSA
	id EBopsAefrWhyfEBoqskJLu; Mon, 03 Jun 2024 17:50:05 +0000
X-Auth-User: cschuber
X-Authority-Analysis: v=2.4 cv=MenPuI/f c=1 sm=1 tr=0 ts=665e024d
 a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17
 a=kj9zAlcOel0A:10 a=T1WGqf2p2xoA:10 a=6I5d2MoRAAAA:8 a=NEAV23lmAAAA:8
 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=gdmwz_W1BZgnn1yQzGQA:9 a=CjuIK1q_8ugA:10
 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22
Received: from slippy.cwsent.com (slippy [10.1.1.91])
	by spqr.komquats.com (Postfix) with ESMTP id 11AAB862;
	Mon, 03 Jun 2024 10:50:03 -0700 (PDT)
Received: by slippy.cwsent.com (Postfix, from userid 1000)
	id 07A7430E; Mon, 03 Jun 2024 10:50:03 -0700 (PDT)
X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev
Reply-to: Cy Schubert <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Jessica Clarke <jrtc27@freebsd.org>
cc: =?utf-8?Q?Stefan_E=C3=9Fer?= <se@FreeBSD.org>,
    "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
    "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
    "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject: Re: git: 077f757d72e5 - main - newfs_msdos: align data area to VM 
 page boundary by default
In-reply-to: <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>
References: <202406021227.452CRx8I007470@gitrepo.freebsd.org> 
 <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>
Comments: In-reply-to Jessica Clarke <jrtc27@freebsd.org>
   message dated "Mon, 03 Jun 2024 18:25:59 +0100."
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Mon, 03 Jun 2024 10:50:02 -0700
Message-Id: <20240603175003.07A7430E@slippy.cwsent.com>
X-CMAE-Envelope: MS4xfEF3Z7rLHFm2F9nv0sdg30FL+tI4E7qJmh+RJCRiTDDk/nhnIUV5yKo3GLND7UJVvmw2QowU/udaJQHnEp22G4o6+yJFCZBwx+jxxvyDKdqWooMCsEx4
 i7YFOQYw6ct8Yd/m2iRdoaO5CTRqtbIz4h2/bGcRz8OkQDraF+BAoK5Oe8XpEiKv6Ls5BIXxu6/mfoQrBZjWlnUOnnsn6/L4W++SHUtK/Rq2UhfrR37xTeVg
 oA5RQ5rbwiIQU1I3EmkNLVquIXy0DcTAUeulaTWxd3xi6EH1qGq5UhNhC9nKKlgNZtJMW+doWtqGvhXJ0lEN/EqpYRV0+hnGfWEc2TUtVkz5SkZJNsTUj0LZ
 M4iWBFVq
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]
X-Rspamd-Queue-Id: 4VtLpj6lJ8z4Gtb

In message <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>, Jessica 
Clarke w
rites:
> On 2 Jun 2024, at 13:27, Stefan E=C3=9Fer <se@FreeBSD.org> wrote:
> >=20
> > The branch main has been updated by se:
> >=20
> > URL: =
> https://cgit.FreeBSD.org/src/commit/?id=3D077f757d72e561eb84193d8e58f63e96=
> e69b8096
> >=20
> > commit 077f757d72e561eb84193d8e58f63e96e69b8096
> > Author:     Stefan E=C3=9Fer <se@FreeBSD.org>
> > AuthorDate: 2024-06-02 12:07:52 +0000
> > Commit:     Stefan E=C3=9Fer <se@FreeBSD.org>
> > CommitDate: 2024-06-02 12:07:52 +0000
> >=20
> >    newfs_msdos: align data area to VM page boundary by default
> >=20
> >    Without alignment, the data area will not be aligned with the =
> buffer
> >    cache, leading to overhead, higher write multiplication on SSD =
> devices
> >    and issues with very large cluster sizes (see PR 277414).
> >=20
> >    The -A option used to align the start of the root directory to a
> >    multiple of the cluster size, which happens to align the start of =
> the
> >    data area with a buffer page boundary in case of large clusters and
> >    the default number of directory entries (512 entries requiring 16 =
> KB
> >    for FAT12 or FAT16, FAT32 puts the root directory into the data =
> area).
> >=20
> >    This commit aligns the start of the data area with the page size, =
> if
> >    neither -A nor -r is used. It changes -A to align the start of the
> >    data area (end of the root directory) to a multiple of the cluster
> >    size, since this is the alignment that prevents write =
> multiplication
> >    due to clusters crossing erase block boundaries of a SSD device.
> >    The -r option is unchanged and will prevent any automatic alignment
> >    from occuring.
>
> Hi,
> This has completely broken[1] all of the Linux and macOS cross-build CI
> jobs (which pass -DWITH_DISK_IMAGE_TOOLS_BOOTSTRAP). Please either fix
> this promptly or back it out until you can do so.
>
> Jess
>
> [1] See https://github.com/freebsd/freebsd-src/actions/runs/9338256762
>

Because PAGE_SIZE is undefined during non-FreeBSD prebuild phase.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0



From nobody Mon Jun  3 18:08:15 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtMCg3Ynpz5JkXl;
	Mon, 03 Jun 2024 18:08:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtMCg3Cr7z4Jp2;
	Mon,  3 Jun 2024 18:08:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717438095;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3oCjMTbIfjiJ4JbiSPOvWbHyoI+fqWT7yy4Ku/8Rcsg=;
	b=Mfk9Yp9w0zHC0ArlXYTjw4qhez+hEjmBx0uLSjGDXueOwGGC46Lq2L3X6aNL1sqg8I1+2c
	HUKP1AdGXMSqF6NiJ3IEH1jqoNKQK6SWbhkyubHMaQ2wJEximdGxH9SzKgi3BNESoFhdI/
	cUqNaUpb3grS2H34iy5h2lhQvpKxu7RLfFB02XAc7FLN6BrZJmD8vJzJUfn+AFGlurgMNJ
	CrGLF65rr5H6j1NOzD3qPEdmvs6Hyudibz7yaPqy+RrR8MSgdhDEuYtf+b4rxopWHyXPFv
	nJqJY8sLW71I45tnSZ/QZzRcFYPFNxc6K6BwW7ptUnPI0V48pm615fX5xLo+dA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717438095; a=rsa-sha256; cv=none;
	b=Lx8VZqDRz0F6HsHZYDsVvVXNOxbZLMVI3X6yDWpyQMT6QsT7Hv1c0UmAO2MxVXkwmk8ehv
	QsWpQFNmx9iFpTcqZaAiMkFXSAo1q5q2By3GlHnn27IBNrXmQL8cGfzWOybGzCt0YmaFGr
	cpeUJW8TDYm60NrDvujH4KQmrlj8AG+OMhRKFth+qllomk8A2MpEKnzAsmwupO7CbKQBnr
	DmfbV/SU/owv8ohilKQBPK1t6P5uw+lacnUY5XrNudFf+5/WrrDIbkg8CHF+drRXTuBLGt
	xeliFQR8ETqYqrdzBaUC1ZhnA0Vn6dL5oyOxRJ4TdqS+tT05OR0ahptY95ZCww==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717438095;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3oCjMTbIfjiJ4JbiSPOvWbHyoI+fqWT7yy4Ku/8Rcsg=;
	b=wSxsrJRqSt8j62/7FDIM4+tPwRbOT2DZubYUWmINdMdx4P+Z6Y84t8Yg4ZySMQymdlValH
	RUBmfSm+jzLyNflE2+DHi1lWZbl3l1wuhWXEiELkmceuixXPGDOQ1hq34OejzekBPnIKGb
	YbSw+FNKxJdtB+MNyj7Ugr9hNnj1sMj8mQDookCjEsXcsshpbplYAv+5QVEiO8Xaiof17f
	7xzE+ee0Dnm0r1WzdaoJFy0A7n0aAAwkdwTTgI3vxNpWW0yHKvl1k0wdMijJipfAyfmepW
	/fOyMZteNgbX9FI6ebLnVY11NMrCIExStpexFVFuSDz+sjOXorDOxVfy68aumA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtMCg2q0Bzktt;
	Mon,  3 Jun 2024 18:08:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453I8FFX031944;
	Mon, 3 Jun 2024 18:08:15 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453I8Fi8031941;
	Mon, 3 Jun 2024 18:08:15 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 18:08:15 GMT
Message-Id: <202406031808.453I8Fi8031941@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: e3537f9235ba - main - Revert "subr_pctrie: use ilog2(x)
  instead of fls(x)-1"
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: e3537f9235ba237b7f35d88c3d8147c164f2a86c
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=e3537f9235ba237b7f35d88c3d8147c164f2a86c

commit e3537f9235ba237b7f35d88c3d8147c164f2a86c
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-03 18:07:42 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-03 18:07:42 +0000

    Revert "subr_pctrie: use ilog2(x) instead of fls(x)-1"
    
    This reverts commit 574ef650695088d56ea12df7da76155370286f9f.
---
 sys/kern/subr_pctrie.c |   6 +--
 sys/vm/_vm_phys.h      |   4 +-
 sys/vm/vm_page.c       |   5 +-
 sys/vm/vm_phys.c       | 123 +++++++++++++++++++------------------------------
 sys/vm/vm_phys.h       |   2 +-
 sys/vm/vm_reserv.c     |  33 ++++++-------
 6 files changed, 69 insertions(+), 104 deletions(-)

diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c
index 76f4ee17a8ca..85df0a9bf9e4 100644
--- a/sys/kern/subr_pctrie.c
+++ b/sys/kern/subr_pctrie.c
@@ -350,7 +350,7 @@ pctrie_insert_node(void *parentp, struct pctrie_node *parent, uint64_t *val)
 	    "uint64 too wide");
 	_Static_assert(sizeof(uint64_t) * NBBY <=
 	    (1 << (sizeof(parent->pn_clev) * NBBY)), "pn_clev too narrow");
-	parent->pn_clev = rounddown(ilog2(index ^ newind), PCTRIE_WIDTH);
+	parent->pn_clev = rounddown(flsll(index ^ newind) - 1, PCTRIE_WIDTH);
 	parent->pn_owner = PCTRIE_COUNT;
 	parent->pn_owner = index & -(parent->pn_owner << parent->pn_clev);
 
@@ -546,14 +546,14 @@ pctrie_lookup_le(struct pctrie *ptree, uint64_t index)
 		KASSERT((pred->pn_popmap & ((1 << slot) - 1)) != 0,
 		    ("%s: no popmap siblings before slot %d in node %p",
 		    __func__, slot, pred));
-		slot = ilog2(pred->pn_popmap & ((1 << slot) - 1));
+		slot = fls(pred->pn_popmap & ((1 << slot) - 1)) - 1;
 		pred = pctrie_node_load(&pred->pn_child[slot], NULL,
 		    PCTRIE_LOCKED);
 	}
 	while (!pctrie_isleaf(pred)) {
 		KASSERT(pred->pn_popmap != 0,
 		    ("%s: no popmap children in node %p",  __func__, pred));
-		slot = ilog2(pred->pn_popmap);
+		slot = fls(pred->pn_popmap) - 1;
 		pred = pctrie_node_load(&pred->pn_child[slot], NULL,
 		    PCTRIE_LOCKED);
 	}
diff --git a/sys/vm/_vm_phys.h b/sys/vm/_vm_phys.h
index e3cf09081537..36e1074568e9 100644
--- a/sys/vm/_vm_phys.h
+++ b/sys/vm/_vm_phys.h
@@ -51,8 +51,6 @@ struct vm_freelist {
 	int lcnt;
 };
 
-typedef struct vm_freelist vm_freelist_tbl[VM_NFREEPOOL][VM_NFREEORDER_MAX];
-
 struct vm_phys_seg {
 	vm_paddr_t	start;
 	vm_paddr_t	end;
@@ -64,7 +62,7 @@ struct vm_phys_seg {
 	void		*md_first;
 #endif
 	int		domain;
-	vm_freelist_tbl *free_queues;
+	struct vm_freelist (*free_queues)[VM_NFREEPOOL][VM_NFREEORDER_MAX];
 };
 
 extern struct vm_phys_seg vm_phys_segs[];
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 7c2bed8339ed..9ba31cb9e1b3 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -509,7 +509,7 @@ vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind)
 	m->psind = 0;
 	m->segind = segind;
 	m->order = VM_NFREEORDER;
-	m->pool = VM_NFREEPOOL;
+	m->pool = VM_FREEPOOL_DEFAULT;
 	m->valid = m->dirty = 0;
 	pmap_page_init(m);
 }
@@ -785,8 +785,7 @@ vm_page_startup(vm_offset_t vaddr)
 			m = seg->first_page + atop(startp - seg->start);
 			vmd = VM_DOMAIN(seg->domain);
 			vm_domain_free_lock(vmd);
-			vm_phys_enqueue_contig(m, VM_FREEPOOL_DEFAULT,
-			    pagecount);
+			vm_phys_enqueue_contig(m, pagecount);
 			vm_domain_free_unlock(vmd);
 			vm_domain_freecnt_inc(vmd, pagecount);
 			vm_cnt.v_page_count += (u_int)pagecount;
diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 945e018710a1..66ad9c13dceb 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -669,7 +669,6 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order,
     int tail)
 {
 	vm_page_t m_buddy;
-	int pool = m->pool;
 
 	while (oind > order) {
 		oind--;
@@ -677,10 +676,6 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order,
 		KASSERT(m_buddy->order == VM_NFREEORDER,
 		    ("vm_phys_split_pages: page %p has unexpected order %d",
 		    m_buddy, m_buddy->order));
-		KASSERT(m_buddy->pool == VM_NFREEPOOL,
-		    ("vm_phys_split_pages: page %p has unexpected pool %d",
-		    m_buddy, m_buddy->pool));
-		m_buddy->pool = pool;
 		vm_freelist_add(fl, m_buddy, oind, tail);
         }
 }
@@ -698,8 +693,7 @@ vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl, int order,
  * The physical page m's buddy must not be free.
  */
 static void
-vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
-    int tail)
+vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
 {
         int order;
 
@@ -715,7 +709,6 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
                 order = fls(npages) - 1;
 		KASSERT(order < VM_NFREEORDER,
 		    ("%s: order %d is out of range", __func__, order));
-		m->pool = pool;
                 vm_freelist_add(fl, m, order, tail);
 		m += 1 << order;
                 npages -= 1 << order;
@@ -736,8 +729,7 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
  * parameter m.  Otherwise, the physical page m's buddy must not be free.
  */
 static vm_page_t
-vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
-    int tail)
+vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
 {
 	int order;
 
@@ -753,7 +745,6 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
 		order = ffs(npages) - 1;
 		KASSERT(order < VM_NFREEORDER,
 		    ("vm_phys_enq_range: order %d is out of range", order));
-		m->pool = pool;
 		vm_freelist_add(fl, m, order, tail);
 		m += 1 << order;
 		npages -= 1 << order;
@@ -761,6 +752,18 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
 	return (m);
 }
 
+/*
+ * Set the pool for a contiguous, power of two-sized set of physical pages. 
+ */
+static void
+vm_phys_set_pool(int pool, vm_page_t m, int order)
+{
+	vm_page_t m_tmp;
+
+	for (m_tmp = m; m_tmp < &m[1 << order]; m_tmp++)
+		m_tmp->pool = pool;
+}
+
 /*
  * Tries to allocate the specified number of pages from the specified pool
  * within the specified domain.  Returns the actual number of allocated pages
@@ -769,8 +772,7 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int pool,
  * The returned pages may not be physically contiguous.  However, in contrast
  * to performing multiple, back-to-back calls to vm_phys_alloc_pages(..., 0),
  * calling this function once to allocate the desired number of pages will
- * avoid wasted time in vm_phys_split_pages().  Sets the pool field for
- * every allocated page.
+ * avoid wasted time in vm_phys_split_pages().
  *
  * The free page queues for the specified domain must be locked.
  */
@@ -799,18 +801,14 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 				vm_freelist_rem(fl, m, oind);
 				avail = i + (1 << oind);
 				end = imin(npages, avail);
-				ma[i++] = m++;
-				while (i < end) {
-					m->pool = pool;
+				while (i < end)
 					ma[i++] = m++;
-				}
 				if (i == npages) {
 					/*
 					 * Return excess pages to fl.  Its order
 					 * [0, oind) queues are empty.
 					 */
-					vm_phys_enq_range(m, avail - i, fl,
-					    pool, 1);
+					vm_phys_enq_range(m, avail - i, fl, 1);
 					return (npages);
 				}
 			}
@@ -821,12 +819,11 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 				while ((m = TAILQ_FIRST(&alt[oind].pl)) !=
 				    NULL) {
 					vm_freelist_rem(alt, m, oind);
+					vm_phys_set_pool(pool, m, oind);
 					avail = i + (1 << oind);
 					end = imin(npages, avail);
-					do {
-						m->pool = pool;
+					while (i < end)
 						ma[i++] = m++;
-					} while (i < end);
 					if (i == npages) {
 						/*
 						 * Return excess pages to fl.
@@ -834,7 +831,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 						 * are empty.
 						 */
 						vm_phys_enq_range(m, avail - i,
-						    fl, pool, 1);
+						    fl, 1);
 						return (npages);
 					}
 				}
@@ -846,7 +843,7 @@ vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[])
 
 /*
  * Allocate a contiguous, power of two-sized set of physical pages
- * from the free lists.  Sets the pool field in the first page only.
+ * from the free lists.
  *
  * The free page queues must be locked.
  */
@@ -867,8 +864,7 @@ vm_phys_alloc_pages(int domain, int pool, int order)
 /*
  * Allocate a contiguous, power of two-sized set of physical pages from the
  * specified free list.  The free list must be specified using one of the
- * manifest constants VM_FREELIST_*.  Sets the pool field in the first page
- * only.
+ * manifest constants VM_FREELIST_*.
  *
  * The free page queues must be locked.
  */
@@ -919,7 +915,7 @@ vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, int order)
 			m = TAILQ_FIRST(&alt[oind].pl);
 			if (m != NULL) {
 				vm_freelist_rem(alt, m, oind);
-				m->pool = pool;
+				vm_phys_set_pool(pool, m, oind);
 				/* The order [order, oind) queues are empty. */
 				vm_phys_split_pages(m, oind, fl, order, 1);
 				return (m);
@@ -1126,8 +1122,7 @@ vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end)
 }
 
 /*
- * Free a contiguous, power of two-sized set of physical pages.  Assumes that
- * only the first page has a valid pool field.
+ * Free a contiguous, power of two-sized set of physical pages.
  *
  * The free page queues must be locked.
  */
@@ -1138,19 +1133,18 @@ vm_phys_free_pages(vm_page_t m, int order)
 	struct vm_phys_seg *seg;
 	vm_paddr_t pa;
 	vm_page_t m_buddy;
-	int pool = m->pool;
 
 	KASSERT(m->order == VM_NFREEORDER,
 	    ("vm_phys_free_pages: page %p has unexpected order %d",
 	    m, m->order));
-	KASSERT(pool < VM_NFREEPOOL,
-	    ("vm_phys_free_pages: page %p has unexpected pool %d", m, pool));
+	KASSERT(m->pool < VM_NFREEPOOL,
+	    ("vm_phys_free_pages: page %p has unexpected pool %d",
+	    m, m->pool));
 	KASSERT(order < VM_NFREEORDER,
 	    ("vm_phys_free_pages: order %d is out of range", order));
 	seg = &vm_phys_segs[m->segind];
 	vm_domain_free_assert_locked(VM_DOMAIN(seg->domain));
 	if (order < VM_NFREEORDER - 1) {
-		vm_page_t m_start = m;
 		pa = VM_PAGE_TO_PHYS(m);
 		do {
 			pa ^= ((vm_paddr_t)1 << (PAGE_SHIFT + order));
@@ -1161,28 +1155,25 @@ vm_phys_free_pages(vm_page_t m, int order)
 				break;
 			fl = (*seg->free_queues)[m_buddy->pool];
 			vm_freelist_rem(fl, m_buddy, order);
-			m_buddy->pool = VM_NFREEPOOL;
+			if (m_buddy->pool != m->pool)
+				vm_phys_set_pool(m->pool, m_buddy, order);
 			order++;
 			pa &= ~(((vm_paddr_t)1 << (PAGE_SHIFT + order)) - 1);
 			m = &seg->first_page[atop(pa - seg->start)];
 		} while (order < VM_NFREEORDER - 1);
-		if (m != m_start) {
-			m_start->pool = VM_NFREEPOOL;
-			m->pool = pool;
-		}
 	}
-	fl = (*seg->free_queues)[pool];
+	fl = (*seg->free_queues)[m->pool];
 	vm_freelist_add(fl, m, order, 1);
 }
 
 /*
- * Free a contiguous, arbitrarily sized set of physical pages, without merging
- * across set boundaries.  Assumes no pages have a valid pool field.
+ * Free a contiguous, arbitrarily sized set of physical pages, without
+ * merging across set boundaries.
  *
  * The free page queues must be locked.
  */
 void
-vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages)
+vm_phys_enqueue_contig(vm_page_t m, u_long npages)
 {
 	struct vm_freelist *fl;
 	struct vm_phys_seg *seg;
@@ -1196,15 +1187,14 @@ vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages)
 	 */
 	vm_domain_free_assert_locked(vm_pagequeue_domain(m));
 	seg = &vm_phys_segs[m->segind];
-	fl = (*seg->free_queues)[pool];
+	fl = (*seg->free_queues)[m->pool];
 	m_end = m + npages;
 	/* Free blocks of increasing size. */
 	lo = atop(VM_PAGE_TO_PHYS(m));
 	if (m < m_end &&
 	    (diff = lo ^ (lo + npages - 1)) != 0) {
 		order = min(flsll(diff) - 1, VM_NFREEORDER - 1);
-		m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl,
-		    pool, 1);
+		m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl, 1);
 	}
 
 	/* Free blocks of maximum size. */
@@ -1213,17 +1203,15 @@ vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages)
 		KASSERT(seg == &vm_phys_segs[m->segind],
 		    ("%s: page range [%p,%p) spans multiple segments",
 		    __func__, m_end - npages, m));
-		m->pool = pool;
 		vm_freelist_add(fl, m, order, 1);
 		m += 1 << order;
 	}
 	/* Free blocks of diminishing size. */
-	vm_phys_enq_beg(m, m_end - m, fl, pool, 1);
+	vm_phys_enq_beg(m, m_end - m, fl, 1);
 }
 
 /*
  * Free a contiguous, arbitrarily sized set of physical pages.
- * Assumes that every page has the same, valid, pool field value.
  *
  * The free page queues must be locked.
  */
@@ -1233,22 +1221,17 @@ vm_phys_free_contig(vm_page_t m, u_long npages)
 	vm_paddr_t lo;
 	vm_page_t m_start, m_end;
 	unsigned max_order, order_start, order_end;
-	int pool = m->pool;
-
-	KASSERT(pool < VM_NFREEPOOL,
-	    ("%s: pool %d is out of range", __func__, pool));
 
 	vm_domain_free_assert_locked(vm_pagequeue_domain(m));
 
 	lo = atop(VM_PAGE_TO_PHYS(m));
 	max_order = min(flsll(lo ^ (lo + npages)) - 1, VM_NFREEORDER - 1);
-	m_end = m + npages;
-	for (m_start = m; m < m_end; m++)
-		m->pool = VM_NFREEPOOL;
-	m = m_start;
+
+	m_start = m;
 	order_start = ffsll(lo) - 1;
 	if (order_start < max_order)
 		m_start += 1 << order_start;
+	m_end = m + npages;
 	order_end = ffsll(lo + npages) - 1;
 	if (order_end < max_order)
 		m_end -= 1 << order_end;
@@ -1257,15 +1240,11 @@ vm_phys_free_contig(vm_page_t m, u_long npages)
 	 * end of the range last.
 	 */
 	if (m_start < m_end)
-		vm_phys_enqueue_contig(m_start, pool, m_end - m_start);
-	if (order_start < max_order) {
-		m->pool = pool;
+		vm_phys_enqueue_contig(m_start, m_end - m_start);
+	if (order_start < max_order)
 		vm_phys_free_pages(m, order_start);
-	}
-	if (order_end < max_order) {
-		m_end->pool = pool;
+	if (order_end < max_order)
 		vm_phys_free_pages(m_end, order_end);
-	}
 }
 
 /*
@@ -1313,7 +1292,7 @@ vm_phys_unfree_page(vm_page_t m)
 	struct vm_phys_seg *seg;
 	vm_paddr_t pa, pa_half;
 	vm_page_t m_set, m_tmp;
-	int order, pool;
+	int order;
 
 	/*
 	 * First, find the contiguous, power of two-sized set of free
@@ -1345,8 +1324,7 @@ vm_phys_unfree_page(vm_page_t m)
 	 * is larger than a page, shrink "m_set" by returning the half
 	 * of "m_set" that does not contain "m" to the free lists.
 	 */
-	pool = m_set->pool;
-	fl = (*seg->free_queues)[pool];
+	fl = (*seg->free_queues)[m_set->pool];
 	order = m_set->order;
 	vm_freelist_rem(fl, m_set, order);
 	while (order > 0) {
@@ -1358,10 +1336,8 @@ vm_phys_unfree_page(vm_page_t m)
 			m_tmp = m_set;
 			m_set = &seg->first_page[atop(pa_half - seg->start)];
 		}
-		m_tmp->pool = pool;
 		vm_freelist_add(fl, m_tmp, order, 0);
 	}
-	m_set->pool = pool;
 	KASSERT(m_set == m, ("vm_phys_unfree_page: fatal inconsistency"));
 	return (true);
 }
@@ -1501,8 +1477,7 @@ vm_phys_find_queues_contig(
  * alignment of the first physical page in the set.  If the given value
  * "boundary" is non-zero, then the set of physical pages cannot cross
  * any physical address boundary that is a multiple of that value.  Both
- * "alignment" and "boundary" must be a power of two.  Sets the pool
- * field in every allocated page.
+ * "alignment" and "boundary" must be a power of two.
  */
 vm_page_t
 vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high,
@@ -1561,16 +1536,14 @@ vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high,
 		fl = (*queues)[m->pool];
 		oind = m->order;
 		vm_freelist_rem(fl, m, oind);
+		if (m->pool != VM_FREEPOOL_DEFAULT)
+			vm_phys_set_pool(VM_FREEPOOL_DEFAULT, m, oind);
 	}
 	/* Return excess pages to the free lists. */
 	fl = (*queues)[VM_FREEPOOL_DEFAULT];
-	vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl,
-	    VM_FREEPOOL_DEFAULT, 0);
+	vm_phys_enq_range(&m_run[npages], m - &m_run[npages], fl, 0);
 
 	/* Return page verified to satisfy conditions of request. */
-	for (m = m_run; m < &m_run[npages]; m++)
-		m->pool = VM_FREEPOOL_DEFAULT;
-	
 	pa_start = VM_PAGE_TO_PHYS(m_run);
 	KASSERT(low <= pa_start,
 	    ("memory allocated below minimum requested range"));
diff --git a/sys/vm/vm_phys.h b/sys/vm/vm_phys.h
index 8b2d2f7e2251..1f502ad745c4 100644
--- a/sys/vm/vm_phys.h
+++ b/sys/vm/vm_phys.h
@@ -66,7 +66,7 @@ vm_page_t vm_phys_alloc_freelist_pages(int domain, int freelist, int pool,
 int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]);
 vm_page_t vm_phys_alloc_pages(int domain, int pool, int order);
 int vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high);
-void vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages);
+void vm_phys_enqueue_contig(vm_page_t m, u_long npages);
 int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end,
     vm_memattr_t memattr);
 void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end);
diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c
index 80f62981dee0..a4bbccdfb428 100644
--- a/sys/vm/vm_reserv.c
+++ b/sys/vm/vm_reserv.c
@@ -889,35 +889,30 @@ out:
 static void
 vm_reserv_break(vm_reserv_t rv)
 {
-	int pool, pos, pos0, pos1;
+	int hi, lo, pos;
 
 	vm_reserv_assert_locked(rv);
 	CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d",
 	    __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq);
 	vm_reserv_remove(rv);
 	rv->pages->psind = 0;
-	pool = rv->pages->pool;
-	rv->pages->pool = VM_NFREEPOOL;
-	pos0 = bit_test(rv->popmap, 0) ? -1 : 0;
-	pos1 = -1 - pos0;
-	for (pos = 0; pos < VM_LEVEL_0_NPAGES; ) {
-		/* Find the first different bit after pos. */
-		bit_ff_at(rv->popmap, pos + 1, VM_LEVEL_0_NPAGES,
-		    pos1 < pos0, &pos);
-		if (pos == -1)
-			pos = VM_LEVEL_0_NPAGES;
-		if (pos0 <= pos1) {
-			/* Set pool for pages from pos1 to pos. */
-			pos0 = pos1;
-			while (pos0 < pos)
-				rv->pages[pos0++].pool = pool;
+	hi = lo = -1;
+	pos = 0;
+	for (;;) {
+		bit_ff_at(rv->popmap, pos, VM_LEVEL_0_NPAGES, lo != hi, &pos);
+		if (lo == hi) {
+			if (pos == -1)
+				break;
+			lo = pos;
 			continue;
 		}
-		/* Free unused pages from pos0 to pos. */
-		pos1 = pos;
+		if (pos == -1)
+			pos = VM_LEVEL_0_NPAGES;
+		hi = pos;
 		vm_domain_free_lock(VM_DOMAIN(rv->domain));
-		vm_phys_enqueue_contig(&rv->pages[pos0], pool, pos1 - pos0);
+		vm_phys_enqueue_contig(&rv->pages[lo], hi - lo);
 		vm_domain_free_unlock(VM_DOMAIN(rv->domain));
+		lo = hi;
 	}
 	bit_nclear(rv->popmap, 0, VM_LEVEL_0_NPAGES - 1);
 	rv->popcnt = 0;

From nobody Mon Jun  3 18:14:54 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtMML6Xx1z5JlBk;
	Mon, 03 Jun 2024 18:14:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtMML3kWJz4KQs;
	Mon,  3 Jun 2024 18:14:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717438494;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=yu7ch+RrGJg2UgzEcE5uTiC/S0ut5W5Pw0b8Jgt+VpM=;
	b=AQtu9rmjz5sVu1b7bzcGlZIo6z0a7cpA4E/JU6RZFMJ6saQWj+HWi0VpWhb6p4EdoS5Mlq
	rVuovPJIYv66sl+mTun9gTNOvURDmWxJeQN/KQuiYjIXoRZTxRwtYTprDbnM6HPf/GZAiP
	SHITw1eOLq1DB1HlzyXxxamgGDK4WitSOEwfT6d5dVSR+B0nvFgPbwA2nbSke11Cjm1y8x
	qREi/Ph6embcvb0NxBekRvkuBvLKCg/K0RdwUVATC3Ka2Zh1WhVU54fesv504jLHoIIqWW
	2jL2S6WXil8wIwQ+hKAZC+VgwmKPxoIeU2pKPJJlWSJHIgJteFUFoN2iI3SYWg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717438494; a=rsa-sha256; cv=none;
	b=qBXlG0e0jIRj49mFh2UtsJnd2h0a94AfBQqVttJGQc1oY7I96w5vcokBdk30UXQV/57dde
	1fM5NSR99HVu0s3JBxxAK5sDY2nttsjG0wGoiTzwc9ngSyGuPbJ7oOkj/11+UdQEM5QGlj
	X/+HfNNV6zzWUYib9YRdrYqSMbct35jsZGZQjqdkM+ZO2YRcPzzTZU77Wr/zzkKStknFZ9
	WUVU9IXmfxS88V3GIp8xpRNIZrHP4Je3/iXTcTo6rJmTR9h8GFtpTOfPafXWj1JYi/NZLW
	yrdivzy9sUhly2mg88M/j0eFLJ2n4fsMaz2/D4Bd36OBADgxllAdGpaciannVQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717438494;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=yu7ch+RrGJg2UgzEcE5uTiC/S0ut5W5Pw0b8Jgt+VpM=;
	b=VnQBj4w5HJUMwriE6ScxsdQiwSQbfQkJ+5mpeQ3U+Fqz+N0wD+1CrawkIAu60B8/xPKuiU
	K0NJ/n/orv4qhF4Z9dACIoIVkwFbrxfTwfYANiup/YXbRUYFgit0FvX/MnonJrPGrKEdAy
	QVXVGZoasla4+0+u6vKSW5Gt+zwl3nzhTClUWcakbIiPe8WuheQgldWHoXXgK/ZOVhONal
	CRySAu38XGd1L8KgphLYV9xebKwEIsWk8L7KmOJmL9528VX9iNVGvT5GQ/2QLbSfei7csW
	G9935zaI0zKYvFMEemhgS/6rmhk5QKK+LhpYft//D/BtUHM7HxQws4BSQ+7nJA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtMML3KtSzm87;
	Mon,  3 Jun 2024 18:14:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453IEsnx048616;
	Mon, 3 Jun 2024 18:14:54 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453IEsLL048613;
	Mon, 3 Jun 2024 18:14:54 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 18:14:54 GMT
Message-Id: <202406031814.453IEsLL048613@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Warner Losh <imp@FreeBSD.org>
Subject: git: 5dda778db634 - main - Use correct function declaration
  for yyerror
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: imp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 5dda778db63407214394c3cf63fb1312a4981024
Auto-Submitted: auto-generated

The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=5dda778db63407214394c3cf63fb1312a4981024

commit 5dda778db63407214394c3cf63fb1312a4981024
Author:     Dapeng Gao <dg612@cam.ac.uk>
AuthorDate: 2024-06-03 17:30:52 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-06-03 18:14:10 +0000

    Use correct function declaration for yyerror
    
    According to the POSIX standard at
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html
    `yyerror` should return `int`. Add unreachable since errx never returns.
    
    Reviewed by:    imp, kib
    Differential Revision:  https://reviews.freebsd.org/D45447
---
 usr.sbin/config/config.y | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
index a5a9e1546c36..148959fbff2e 100644
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -88,7 +88,7 @@ int	maxusers;
 
 #define ns(s)	strdup(s)
 int include(const char *, int);
-void yyerror(const char *s);
+int yyerror(const char *s);
 int yywrap(void);
 
 static void newdev(char *name);
@@ -299,11 +299,13 @@ NoDevice:
 
 %%
 
-void
+int
 yyerror(const char *s)
 {
 
 	errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
+	__unreachable();
+	return (0);
 }
 
 int

From nobody Mon Jun  3 18:19:44 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtMSz6txrz5JlDQ
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Mon, 03 Jun 2024 18:19:47 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtMSz55M5z4L2t
	for <dev-commits-src-main@freebsd.org>; Mon,  3 Jun 2024 18:19:47 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4212b4eea2eso30690755e9.2
        for <dev-commits-src-main@freebsd.org>; Mon, 03 Jun 2024 11:19:47 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717438786; x=1718043586;
        h=to:references:message-id:content-transfer-encoding:cc:date
         :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=Vme96Px5D2jJBg/4flwPjpLG/T+xP6FS+GrXVi4xaOM=;
        b=LGX8QeZ0WfwSu+C7WbC7v7FkWZcceQUQhGzQ6MQMnTb6JX+TT3JKEqeuI7XdyW4w5O
         G9X3YQ0RgQ8AsQUbqeMU1wPnaKQIWL/S0F59fhwAiHi3NLMIkys9l+w1ZJTFtoJbN0kY
         LTnLOH5BPs8Hy/0ADW0owqg3CjTYJc3Ofn1GdsueQVq5dR64Z9JIlzf8X5B0rVvLin2i
         dYaX0CCzP30qc1nwHLfBKR2GNsIrgULpQ0eSLuahc/MKSk0Z38p3KckFA/YfjiNN2A6u
         A31FdfHVcUZ8x1L+DNWWfAiNAtCCSTaBjtbffyXiKk0Flfcnui1FxRqMgW8CK1NitCKG
         ITXw==
X-Forwarded-Encrypted: i=1; AJvYcCUI/LuAXWddP2jbbbgXSK0MwjHiEz0kWfhB7NTNyvOfc9J1pmZQnG+Ow1NfKXVLTIPBRh7hGTl9Hud2gjJv+Je74pjnPh4yUkzW5/R/Z3b1xg==
X-Gm-Message-State: AOJu0YzfVotoSD1hu0X6w6iJeqstCSwY+j0Tn6GcgoWimu3RZ2oxrNZ6
	wwBI3FnSpgrqyGHSrzs2A8GjeGL9Jpd4AXXRK5Te0az4GJaMOz7lSzAuB3of8Pk=
X-Google-Smtp-Source: AGHT+IGqfSOzn9mD/HVfXpuiuqtL+rnTMVR0o2UINhk64fp9/ZjjG9fVDr0dAY/aRXR+SwwM5PoOYA==
X-Received: by 2002:a05:600c:b92:b0:41b:e416:43d3 with SMTP id 5b1f17b1804b1-4212e0bfeb5mr72632265e9.35.1717438786334;
        Mon, 03 Jun 2024 11:19:46 -0700 (PDT)
Received: from smtpclient.apple ([131.111.5.246])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-421381c650csm82441005e9.27.2024.06.03.11.19.45
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 03 Jun 2024 11:19:45 -0700 (PDT)
Content-Type: text/plain;
	charset=us-ascii
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
Subject: Re: git: 5dda778db634 - main - Use correct function declaration for
 yyerror
From: Jessica Clarke <jrtc27@freebsd.org>
In-Reply-To: <202406031814.453IEsLL048613@gitrepo.freebsd.org>
Date: Mon, 3 Jun 2024 19:19:44 +0100
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <7A3BE5B2-DE9C-4317-8AC6-9CDC398C7318@freebsd.org>
References: <202406031814.453IEsLL048613@gitrepo.freebsd.org>
To: Warner Losh <imp@FreeBSD.org>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]
X-Rspamd-Queue-Id: 4VtMSz55M5z4L2t

On 3 Jun 2024, at 19:14, Warner Losh <imp@FreeBSD.org> wrote:
>=20
> The branch main has been updated by imp:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D5dda778db63407214394c3cf63fb1312=
a4981024
>=20
> commit 5dda778db63407214394c3cf63fb1312a4981024
> Author:     Dapeng Gao <dg612@cam.ac.uk>
> AuthorDate: 2024-06-03 17:30:52 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-06-03 18:14:10 +0000
>=20
>    Use correct function declaration for yyerror
>=20
>    According to the POSIX standard at
>    =
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html
>    `yyerror` should return `int`. Add unreachable since errx never =
returns.
>=20
>    Reviewed by:    imp, kib
>    Differential Revision:  https://reviews.freebsd.org/D45447
> ---
> usr.sbin/config/config.y | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>=20
> diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
> index a5a9e1546c36..148959fbff2e 100644
> --- a/usr.sbin/config/config.y
> +++ b/usr.sbin/config/config.y
> @@ -88,7 +88,7 @@ int maxusers;
>=20
> #define ns(s) strdup(s)
> int include(const char *, int);
> -void yyerror(const char *s);
> +int yyerror(const char *s);
> int yywrap(void);
>=20
> static void newdev(char *name);
> @@ -299,11 +299,13 @@ NoDevice:
>=20
> %%
>=20
> -void
> +int
> yyerror(const char *s)
> {
>=20
> errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
> + __unreachable();
> + return (0);
> }

This should just be:

int
yyerror(const char *s)
{
	errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
}

errx is __dead2. See bin/expr/expr.y for an example of this in-tree.

Jess


From nobody Mon Jun  3 18:22:34 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtMXB4r1Hz5Jlnm;
	Mon, 03 Jun 2024 18:22:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtMXB3rKXz4Lff;
	Mon,  3 Jun 2024 18:22:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717438954;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=KEAqHLwqQl/9mnz7ouswTEEdCWPStXD6Ngabayf4PVY=;
	b=izAv351DABu6R+EV1o21JqC3nVxhWephT7rUm3MyDPXdIHB6a6qVDM1qnBOdB+8MSqO3n9
	0k5ZGXA8iIhutz9YjC2kSLZpgwP37h1UsLW+/0Mgy9cLzGrAtht+yL5NVZigpt+dF0FVQQ
	xBfp5GlPL/8E6Ge67hABRhR9dS6ld00t9mg86bDdZLxxG7GAYpxt92DiIl0FLefL8FeGgZ
	DJ6FmuOSkqCyP3w/fFi0+DTVS11agaJ911RO8RmYIKDWbYPPKIGtIczz52DZ9tWlUjqzpG
	lSCb76cfofSO52TNX/Jg5cfyUKQicTNJHmVtMNgCpmN4uHywFppxXDT67GbEfQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717438954; a=rsa-sha256; cv=none;
	b=Och/qxn8JtsHYMZEV8CtvjhfPkjDt/6ZXVw92wLulmLHsJcuStEzVbA0aIhrypSyVLVrXe
	fJZqS9+8KPEsru6ud9io3qJSiJYhZiEAeY6Ge0XfH7hST/pLuy0WYTja5hLtFpzm6ZJLhG
	+g7rt4xEP8pi/zFAX3DyStWfh/5V4fW1mysBoyWxwyK5o3zWkV6OKuMFn5NOJ1JElxAEfh
	je3oVR+b5NLfdUZ/+17nmi7oI7vUT1oObn9YX8tzA8A7Fj0QENSsRFEXDdbiKFYECDmyAT
	8KeHXRxmqy7RD5C9Pwoid9Zpu7ExSQ7KKV2SwnOr8qe4jdgOzCI5Ox63FGTx/A==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717438954;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=KEAqHLwqQl/9mnz7ouswTEEdCWPStXD6Ngabayf4PVY=;
	b=UN98MZCaDIsRcjy7jLpM0o7lKTKzCLThQDxSJ4lWrlS7PKImiOmr/CV9U4G7sJAmhXSsOq
	6Sl+XmeCC2OPbvq4RlSLHmlwGwL/fjcQ5Tc3zQw4nOZX381tK1Sjc0jOpd8ejjHtC6j6MT
	LX9lpnBSu3Wd3I+DJwKVpft0epiHgUE78KjF1lCflMwQiTmGLFr9XkWzMkbd2hgOtn/xdR
	W+q92dQB/ZtUU20+b4Sg61snkrspIwb15vJT1pd0QGz9ejsJofKCbS+rQlNloCk54XX0tS
	c0k/jMRvz910cugc5IxcezpJAQbo2Owe8Zaq2CXK/uEpnHWp7kQwkZFTM0a3LQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtMXB3Pd5zm6v;
	Mon,  3 Jun 2024 18:22:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453IMY7l065211;
	Mon, 3 Jun 2024 18:22:34 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453IMYdg065208;
	Mon, 3 Jun 2024 18:22:34 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 18:22:34 GMT
Message-Id: <202406031822.453IMYdg065208@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: 08f6f78f81e2 - main - libkern: don't use MPASS
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 08f6f78f81e21b21dd002a9389436b0333cb3488
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=08f6f78f81e21b21dd002a9389436b0333cb3488

commit 08f6f78f81e21b21dd002a9389436b0333cb3488
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-03 18:20:00 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-03 18:22:22 +0000

    libkern: don't use MPASS
    
    Using MPASS in libkern breaks buildworld.  Replace MPASS with KASSERT
    in three places.
---
 sys/sys/libkern.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h
index 84d982c43a76..afdfe7346b28 100644
--- a/sys/sys/libkern.h
+++ b/sys/sys/libkern.h
@@ -190,7 +190,7 @@ static __inline __pure2 int
 ilog2_int(int n)
 {
 
-	MPASS(n != 0);
+	KASSERT(n != 0, ("ilog argument must be nonzero"));
 	return (8 * sizeof(n) - 1 - __builtin_clz((u_int)n));
 }
 
@@ -198,7 +198,7 @@ static __inline __pure2 int
 ilog2_long(long n)
 {
 
-	MPASS(n != 0);
+	KASSERT(n != 0, ("ilog argument must be nonzero"));
 	return (8 * sizeof(n) - 1 - __builtin_clzl((u_long)n));
 }
 
@@ -206,7 +206,7 @@ static __inline __pure2 int
 ilog2_long_long(long long n)
 {
 
-	MPASS(n != 0);
+	KASSERT(n != 0, ("ilog argument must be nonzero"));
 	return (8 * sizeof(n) - 1 -
 	    __builtin_clzll((unsigned long long)n));
 }

From nobody Mon Jun  3 18:32:08 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtMlD6ZBMz5Jmq2;
	Mon, 03 Jun 2024 18:32:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtMlD68Dfz4N7d;
	Mon,  3 Jun 2024 18:32:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717439528;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=piqRJ0MNyYi6zLnCtGjqZv8OmceaeopFKl3w/Ir8d48=;
	b=ceKt/5UBGmoWBhImoZo9XKt9P7RRp75rQf9LPHIQ+gZsepBzZHdJF2r56rdJZnKj0si3u8
	sKD9pkW6BcPxok6awgTZ29gutYraVpW8icJ1lJRoS0VJKWTuQNENaZJtES+nFja/tOCTq6
	EDjqau/sXOM9EHaCoKTH6zAfyqkPMyC0wlOkknZJJRGGslxxPtnGd0ohct5b/Vf03mM/rz
	949vxmhSxGP0qNlvB1RqcmRN2zm54N156liRMwOWczjIBEHuGAeHQ3MgZj7cg3gB2LgcbQ
	Wh8fhP04MYt/ORiqDvHMCvZJfB2pSoewiUbymugVMIfOPBudQICNIIL5ZGtJuQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717439528; a=rsa-sha256; cv=none;
	b=YC0t1DrErP68GQs2nR7yvpUwAvgz/kyDLRDVkVtbvGx5hpOMwhv6jwZB+FJbARSszjpnXj
	kzgED3XtwTvsTjOFp9RaR6KukY2JOLxoDwEIgEJujBbvFAfXRqGteuKHMFbiFtVCyF8ySB
	8VU0Nu+og3STvOSoQppypNYB3YEegQHcAqlg8xe348npXlVGsfORDpNesBbq3QM9aIQPeO
	pyC6OitHZ2oaEvmw9O8Vuw5+QfEiAMdJjYhT7rWm0JpXIUP8qlPDOXjWg2iz9kkds04mPf
	pVCZ8BROHmKfthJGiR33fklhMZehjjHeHcuFeIBcVvI+gpa5T+cfUsN1e9Xj3A==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717439528;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=piqRJ0MNyYi6zLnCtGjqZv8OmceaeopFKl3w/Ir8d48=;
	b=Yp3b5JcCpgPnPA0i19FHxhcgGiJFvIohmiKu1dfKg85UjTjvOm6qUtUb3Z+4pOhvHuHHrK
	iMEzvc/SMD8zHC3hIMzbJt7eTjILNVaxSn4J8JsnnlOIcRdCXBcf5OR6clt6qp/8w24IGZ
	Kbs4evJauTGFCATwUKcVTrxaixPFdXDhb+aTQl73hREpIlXvTA93B2mp7SJ2YBTiniUSj8
	EB/Ws2hrISjkM6oLU2wwhyJQjbtf63r58c0wAyPBijINCfYrQDXqIFy0f5LgTfWGWUbZPy
	e1662BmRIA9KDX/IXyhn2+pxnKgxbiusJod1XPWMiaZUQGzPbR+OHOB74cm8dA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtMlD5lYbzlqs;
	Mon,  3 Jun 2024 18:32:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453IW8UD080804;
	Mon, 3 Jun 2024 18:32:08 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453IW87i080801;
	Mon, 3 Jun 2024 18:32:08 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 18:32:08 GMT
Message-Id: <202406031832.453IW87i080801@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: 749c249dc3b6 - main - subr_pctrie: use ilog2(x) instead
  of fls(x)-1
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 749c249dc3b656fea69149f8f7ad3e1a7f935986
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=749c249dc3b656fea69149f8f7ad3e1a7f935986

commit 749c249dc3b656fea69149f8f7ad3e1a7f935986
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-03 18:31:19 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-03 18:31:19 +0000

    subr_pctrie: use ilog2(x) instead of fls(x)-1
    
    In three instances where fls(x)-1 is used, the compiler does not know
    that x is nonzero and so adds needless zero checks.  Using ilog(x)
    instead saves, in each instance, about 4 instructions, including a
    conditional, and 16 or so bytes, on an amd64 build.
    
    Reviewed by:    alc
    Differential Revision:  https://reviews.freebsd.org/D45330
---
 sys/kern/subr_pctrie.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c
index 85df0a9bf9e4..76f4ee17a8ca 100644
--- a/sys/kern/subr_pctrie.c
+++ b/sys/kern/subr_pctrie.c
@@ -350,7 +350,7 @@ pctrie_insert_node(void *parentp, struct pctrie_node *parent, uint64_t *val)
 	    "uint64 too wide");
 	_Static_assert(sizeof(uint64_t) * NBBY <=
 	    (1 << (sizeof(parent->pn_clev) * NBBY)), "pn_clev too narrow");
-	parent->pn_clev = rounddown(flsll(index ^ newind) - 1, PCTRIE_WIDTH);
+	parent->pn_clev = rounddown(ilog2(index ^ newind), PCTRIE_WIDTH);
 	parent->pn_owner = PCTRIE_COUNT;
 	parent->pn_owner = index & -(parent->pn_owner << parent->pn_clev);
 
@@ -546,14 +546,14 @@ pctrie_lookup_le(struct pctrie *ptree, uint64_t index)
 		KASSERT((pred->pn_popmap & ((1 << slot) - 1)) != 0,
 		    ("%s: no popmap siblings before slot %d in node %p",
 		    __func__, slot, pred));
-		slot = fls(pred->pn_popmap & ((1 << slot) - 1)) - 1;
+		slot = ilog2(pred->pn_popmap & ((1 << slot) - 1));
 		pred = pctrie_node_load(&pred->pn_child[slot], NULL,
 		    PCTRIE_LOCKED);
 	}
 	while (!pctrie_isleaf(pred)) {
 		KASSERT(pred->pn_popmap != 0,
 		    ("%s: no popmap children in node %p",  __func__, pred));
-		slot = fls(pred->pn_popmap) - 1;
+		slot = ilog2(pred->pn_popmap);
 		pred = pctrie_node_load(&pred->pn_child[slot], NULL,
 		    PCTRIE_LOCKED);
 	}

From nobody Mon Jun  3 18:38:50 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtMvD1Hczz5Jn3K
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Mon, 03 Jun 2024 18:39:04 +0000 (UTC)
	(envelope-from wlosh@bsdimp.com)
Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtMvC6NfZz4NtG
	for <dev-commits-src-main@freebsd.org>; Mon,  3 Jun 2024 18:39:03 +0000 (UTC)
	(envelope-from wlosh@bsdimp.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-7024494f7daso2991710b3a.3
        for <dev-commits-src-main@freebsd.org>; Mon, 03 Jun 2024 11:39:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1717439942; x=1718044742; darn=freebsd.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=FMOngN7rN59iHpbSO6fqkGTVvdlsirZe3DyFj/TwqLk=;
        b=EMagEniVgROhxh+OpGdwdhoPP9tUzNrIXSIDkRxWwbHREbifsHnTDrXUi4XnuUJ9t7
         1tN8Q8sdEt5J6XCTwOUx+s7u8eh436L8/v1uUmQ/rgtAdQVxGptRgdvXX0me2pr9xfHT
         /aAHXREJq8uxbDoPHA13Cc5Io6wWk9Cca2FacZqu2j6aCmR+L8A9eBcs59xWwYW6v0Cc
         TFhWRKLGa5eFmDhF7VVb/mlDnXTiuSoxlT5wxpGg9uwAXf08d2WoP3/IFCT0GFmI4hY+
         2JrKp2zIynf5HWMP1meaUT1RJsD/S1psk+W+KQjQ8GYWMzeXdD3LzII6GPb8rwod14tU
         kSuQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717439942; x=1718044742;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=FMOngN7rN59iHpbSO6fqkGTVvdlsirZe3DyFj/TwqLk=;
        b=B7ZkctVNKKz6Uf/6jCGxCksmKXKltPgxRlqe0VAfKWPhcbCkWghqxgTxOVlt86k7ZA
         NnPWJtgJ4NJJ/UeACbdZrwQqPcLwjq/Jrh1Xq/GyEK4hc0/3UDOwqcEeOB0QvWcfrTuP
         fxv4nsFo2miG1kzoS0/QUilC6k26QNewD4YjmGMcTgIDv6pWw8o+KrbX9Bn5vNMKLqS1
         8vobrkMwl6fLnGL/niP8KhPmex+546tm4+mE6tXvs+0kln4T+vF+2j+6zGOjnzlCGvSo
         fMNBoInA28onWOTogywcE+AsIwD4vI6YqNecjLqHr0zMDHjUnnFu/T9REcbtYDEUqBZh
         Bf7A==
X-Forwarded-Encrypted: i=1; AJvYcCX02nX3RkyFoNBOCdJmb1/ixehecd1RA6o5BDFwApodRdHqE6EEP1IYcnCYUdW7lHneOq9Shh5iXUYxPqufHIzfzwsJVw95eRk5zsrx174yqw==
X-Gm-Message-State: AOJu0YwEAV+wkdUCjZA6C8kXDcRa7dYQDaBprFmVy8PSdackxFGhmUtO
	N6DAqEq+Ov48JvbpGJOW7pcfG83ku/sC+slop6rSd1r+b8QWoe+31d84zg39vCEHS/1mtpGvFHX
	Nvlaw7/PIRqFUzjWH7x9r0j4iFbmAcQfMJk3i1g==
X-Google-Smtp-Source: AGHT+IE7D3VbgNJNae0x4l3MjgJ9s7izDuKK2rqnXCNaXXX0wf1ie5vEjS5jn3KOGuFDOKF7ibEhHSQcMsEN1S32AxE=
X-Received: by 2002:a05:6a20:4391:b0:1b1:f0d4:71b6 with SMTP id
 adf61e73a8af0-1b26f29ddc7mr11228813637.54.1717439942470; Mon, 03 Jun 2024
 11:39:02 -0700 (PDT)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
References: <202406031814.453IEsLL048613@gitrepo.freebsd.org> <7A3BE5B2-DE9C-4317-8AC6-9CDC398C7318@freebsd.org>
In-Reply-To: <7A3BE5B2-DE9C-4317-8AC6-9CDC398C7318@freebsd.org>
From: Warner Losh <imp@bsdimp.com>
Date: Mon, 3 Jun 2024 12:38:50 -0600
Message-ID: <CANCZdfo3ThjvtLOUAXrHjscmT4uo7kf=1f+x+zdnxbv1kUkTew@mail.gmail.com>
Subject: Re: git: 5dda778db634 - main - Use correct function declaration for yyerror
To: Jessica Clarke <jrtc27@freebsd.org>
Cc: Warner Losh <imp@freebsd.org>, 
	"src-committers@freebsd.org" <src-committers@freebsd.org>, 
	"dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, 
	"dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
Content-Type: multipart/alternative; boundary="000000000000b1cf4d061a00a59f"
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]
X-Rspamd-Queue-Id: 4VtMvC6NfZz4NtG

--000000000000b1cf4d061a00a59f
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 3, 2024 at 12:19=E2=80=AFPM Jessica Clarke <jrtc27@freebsd.org>=
 wrote:

> On 3 Jun 2024, at 19:14, Warner Losh <imp@FreeBSD.org> wrote:
> >
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3D5dda778db63407214394c3cf63fb131=
2a4981024
> >
> > commit 5dda778db63407214394c3cf63fb1312a4981024
> > Author:     Dapeng Gao <dg612@cam.ac.uk>
> > AuthorDate: 2024-06-03 17:30:52 +0000
> > Commit:     Warner Losh <imp@FreeBSD.org>
> > CommitDate: 2024-06-03 18:14:10 +0000
> >
> >    Use correct function declaration for yyerror
> >
> >    According to the POSIX standard at
> >    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/yacc.html
> >    `yyerror` should return `int`. Add unreachable since errx never
> returns.
> >
> >    Reviewed by:    imp, kib
> >    Differential Revision:  https://reviews.freebsd.org/D45447
> > ---
> > usr.sbin/config/config.y | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
> > index a5a9e1546c36..148959fbff2e 100644
> > --- a/usr.sbin/config/config.y
> > +++ b/usr.sbin/config/config.y
> > @@ -88,7 +88,7 @@ int maxusers;
> >
> > #define ns(s) strdup(s)
> > int include(const char *, int);
> > -void yyerror(const char *s);
> > +int yyerror(const char *s);
> > int yywrap(void);
> >
> > static void newdev(char *name);
> > @@ -299,11 +299,13 @@ NoDevice:
> >
> > %%
> >
> > -void
> > +int
> > yyerror(const char *s)
> > {
> >
> > errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
> > + __unreachable();
> > + return (0);
> > }
>
> This should just be:
>
> int
> yyerror(const char *s)
> {
>         errx(1, "%s:%d: %s", yyfile, yyline + 1, s);
> }
>
> errx is __dead2. See bin/expr/expr.y for an example of this in-tree.
>

OK. Wasn't sure, but you're comments remove all doubt in my mind. will fix.

Warner

--000000000000b1cf4d061a00a59f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"></div><br><div class=3D"gmail_quote"><div=
 dir=3D"ltr" class=3D"gmail_attr">On Mon, Jun 3, 2024 at 12:19=E2=80=AFPM J=
essica Clarke &lt;<a href=3D"mailto:jrtc27@freebsd.org">jrtc27@freebsd.org<=
/a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">O=
n 3 Jun 2024, at 19:14, Warner Losh &lt;imp@FreeBSD.org&gt; wrote:<br>
&gt; <br>
&gt; The branch main has been updated by imp:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D5dda778db634=
07214394c3cf63fb1312a4981024" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3D5dda778db63407214394c3cf63fb1312a4981024<=
/a><br>
&gt; <br>
&gt; commit 5dda778db63407214394c3cf63fb1312a4981024<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Dapeng Gao &lt;<a href=3D"mailto:dg612@cam.=
ac.uk" target=3D"_blank">dg612@cam.ac.uk</a>&gt;<br>
&gt; AuthorDate: 2024-06-03 17:30:52 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; CommitDate: 2024-06-03 18:14:10 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 Use correct function declaration for yyerror<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 According to the POSIX standard at<br>
&gt;=C2=A0 =C2=A0 <a href=3D"https://pubs.opengroup.org/onlinepubs/96999197=
99/utilities/yacc.html" rel=3D"noreferrer" target=3D"_blank">https://pubs.o=
pengroup.org/onlinepubs/9699919799/utilities/yacc.html</a><br>
&gt;=C2=A0 =C2=A0 `yyerror` should return `int`. Add unreachable since errx=
 never returns.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 imp, kib<br>
&gt;=C2=A0 =C2=A0 Differential Revision:=C2=A0 <a href=3D"https://reviews.f=
reebsd.org/D45447" rel=3D"noreferrer" target=3D"_blank">https://reviews.fre=
ebsd.org/D45447</a><br>
&gt; ---<br>
&gt; usr.sbin/config/config.y | 6 ++++--<br>
&gt; 1 file changed, 4 insertions(+), 2 deletions(-)<br>
&gt; <br>
&gt; diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y<br>
&gt; index a5a9e1546c36..148959fbff2e 100644<br>
&gt; --- a/usr.sbin/config/config.y<br>
&gt; +++ b/usr.sbin/config/config.y<br>
&gt; @@ -88,7 +88,7 @@ int maxusers;<br>
&gt; <br>
&gt; #define ns(s) strdup(s)<br>
&gt; int include(const char *, int);<br>
&gt; -void yyerror(const char *s);<br>
&gt; +int yyerror(const char *s);<br>
&gt; int yywrap(void);<br>
&gt; <br>
&gt; static void newdev(char *name);<br>
&gt; @@ -299,11 +299,13 @@ NoDevice:<br>
&gt; <br>
&gt; %%<br>
&gt; <br>
&gt; -void<br>
&gt; +int<br>
&gt; yyerror(const char *s)<br>
&gt; {<br>
&gt; <br>
&gt; errx(1, &quot;%s:%d: %s&quot;, yyfile, yyline + 1, s);<br>
&gt; + __unreachable();<br>
&gt; + return (0);<br>
&gt; }<br>
<br>
This should just be:<br>
<br>
int<br>
yyerror(const char *s)<br>
{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 errx(1, &quot;%s:%d: %s&quot;, yyfile, yyline +=
 1, s);<br>
}<br>
<br>
errx is __dead2. See bin/expr/expr.y for an example of this in-tree.<br></b=
lockquote><div><br></div><div>OK. Wasn&#39;t sure, but you&#39;re comments =
remove all doubt in my mind. will fix.</div><div><br></div><div>Warner=C2=
=A0</div></div></div>

--000000000000b1cf4d061a00a59f--

From nobody Mon Jun  3 18:48:04 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtN5c6Knbz5Jp29;
	Mon, 03 Jun 2024 18:48:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtN5c5mb9z4Pb9;
	Mon,  3 Jun 2024 18:48:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717440484;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=VDO0Wo6V4mCWeH+DRt2kLj+nKBWdcZ3a4NkBuZfzozw=;
	b=oWy7JC/ly3rqDoqBQIywrcRAJ7i4oWnChZJDOizkvujZFUGmhujQk0SW8qBU38RABZXNPC
	nSvGXgTEVOxyfXVvW+Rq+OfcQ8BDuE2S0vZ60+O1DtKeKBTU6TtyQFFuAHGkdNaz+b4Vo9
	5A9p9HIB0Y5T/vtIWr5igJOH/ND1sA6L5OFuiHbJ7J7AqK4L1KKayhV+Uvw6UO2VfD8q78
	pM5aIOZNoXlHT6mNJ9HkVYFmhxlTaejCWxUl5D7tUn7YgEkUzVS87NVqrL0eYtDWBocwub
	ECnCRz7HbrEN06Q9y1KR5HdVymdxSJnHyyRIJjO2098IA2QucVAwIkAzf20AvQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717440484; a=rsa-sha256; cv=none;
	b=jY/qwYPPaUhkAj8c5fwsXC1V79XPqzzdk1+CVCFwnkLXtz0wqkR9ySGAn5pfzzoQ0AOv7l
	GoOLqUj0VYv4QIEoaEddexUQ6QuxcW5s1UdSuolct4fALDOVfxLFMzeCRyxTOEU6Eo+oGJ
	mPMQo3EE5mO+hwZhucbG6jduKwX9wD8LOMT04UP1UjAUflVas+Z3YxrHP4em8Dg4kXFQnR
	ybUo0mLCjCH8+BrLbT3KwYVClvn1gG2w/JaiuyG0bTeYT6C/BTp9W7Zk3rnZOei9ii6+gC
	mRnW282Vpt3y76WEyHXz8vOuHHs/VP7529yPQH4+iHGdtayFiUqZFNZ2pdxngA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717440484;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=VDO0Wo6V4mCWeH+DRt2kLj+nKBWdcZ3a4NkBuZfzozw=;
	b=VmtfmA0cSr0cHvHASL0BUpkoZXb2Lk59RdXw+diTP+dpbFycLa8/Y9+fxAGk4PeiiBMPO+
	Q1ZRIw5IeE87KHv3TZQjO1p8kxNIh3QRXMskSYF3IeoijNATfqQNkAKEaP1o8AXZRcUpLv
	oThy7iAp8r3YOw67a7cEqS9GjyQ/GdSaUlyaizF+ArHMP4JAx6v7jNSLxXIIgR1ArxwydL
	5V98XDL+LppV0IPCC8xfWyEkLwmg0kyud0Uf8oImk1pSLRhtmBStfHqrDc1UnKGJbhIPSY
	yzPdQpe3GlY/S6RgCiQvVWbW0yidU+8hGjUuLIx9fUjyfNakj41x3Yxkt/UFNg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtN5c5Mpwzm9n;
	Mon,  3 Jun 2024 18:48:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453Im4hj099206;
	Mon, 3 Jun 2024 18:48:04 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453Im4pn099203;
	Mon, 3 Jun 2024 18:48:04 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 18:48:04 GMT
Message-Id: <202406031848.453Im4pn099203@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ryan Libby <rlibby@FreeBSD.org>
Subject: git: 3ca6bf792924 - main - db_show_buffer: minor cleanup
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rlibby
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 3ca6bf7929245ae66c5c0f13776395fea0c2d2c7
Auto-Submitted: auto-generated

The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=3ca6bf7929245ae66c5c0f13776395fea0c2d2c7

commit 3ca6bf7929245ae66c5c0f13776395fea0c2d2c7
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-03 18:35:28 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-03 18:35:28 +0000

    db_show_buffer: minor cleanup
    
    Do some light cleanup to make the output format more consistent for
    readability.
    
    Reviewed by:    kib
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D45442
---
 sys/kern/vfs_bio.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 01057072d991..4d5e3a014050 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -5485,16 +5485,16 @@ DB_SHOW_COMMAND(buffer, db_show_buffer)
 	}
 
 	db_printf("buf at %p\n", bp);
-	db_printf("b_flags = 0x%b, b_xflags=0x%b\n",
+	db_printf("b_flags = 0x%b, b_xflags = 0x%b\n",
 	    (u_int)bp->b_flags, PRINT_BUF_FLAGS,
 	    (u_int)bp->b_xflags, PRINT_BUF_XFLAGS);
-	db_printf("b_vflags=0x%b b_ioflags0x%b\n",
+	db_printf("b_vflags = 0x%b, b_ioflags = 0x%b\n",
 	    (u_int)bp->b_vflags, PRINT_BUF_VFLAGS,
 	    (u_int)bp->b_ioflags, PRINT_BIO_FLAGS);
 	db_printf(
 	    "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n"
-	    "b_bufobj = (%p), b_data = %p\n, b_blkno = %jd, b_lblkno = %jd, "
-	    "b_vp = %p, b_dep = %p\n",
+	    "b_bufobj = %p, b_data = %p\n"
+	    "b_blkno = %jd, b_lblkno = %jd, b_vp = %p, b_dep = %p\n",
 	    bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid,
 	    bp->b_bufobj, bp->b_data, (intmax_t)bp->b_blkno,
 	    (intmax_t)bp->b_lblkno, bp->b_vp, bp->b_dep.lh_first);
@@ -5531,7 +5531,6 @@ DB_SHOW_COMMAND(buffer, db_show_buffer)
 #elif defined(BUF_TRACKING)
 	db_printf("b_io_tracking: %s\n", bp->b_io_tracking);
 #endif
-	db_printf(" ");
 }
 
 DB_SHOW_COMMAND_FLAGS(bufqueues, bufqueues, DB_CMD_MEMSAFE)

From nobody Mon Jun  3 18:48:05 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtN5d72Fcz5Jp6M;
	Mon, 03 Jun 2024 18:48:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtN5d6cXdz4Pk5;
	Mon,  3 Jun 2024 18:48:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717440485;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=LA3VpBmLa1taIF0eXTQvT7ILC9KXI3bMuqcKy1zyoMo=;
	b=bXGLTPLdBPucfrRAk62JMIQM3TAeJHtQ7GWYHGlZrfc1Trj3d7o7SPNsoTzAugP+zMeU8N
	gEAoj/+YgYU8xx4kMCpTrD2V/sTCsPNwwkuquzLqTVIrxjAlkMY/cpG0yZEC7MngvMz3ew
	Q/j7smNaqZabeLleaxGU9DFDM2hnxApezz/IMtiLjKtOQ8qHf3HffL8dUYr5KtkPjLYm3C
	t430EA2rhJ7d1GcxFz79tdnG0Re5r5o4/XOhTha+2nBZWkWq/YsR6lv2Ltmxg0TMWHpXvP
	GX0EWppgUcXTIDx2DIsOfnWKMWckXN8dK4xRCckdOjQLIohx976Dwz80boYW2w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717440485; a=rsa-sha256; cv=none;
	b=T8ZzEa4eMzaznBW1dFr2/UKOcagrbEczHpdooMX4hux1ZgQ2uwwnpe+QArnDFMFTqnvDug
	92HSW5HTyCUp2QTDIIWVnv8cGHzVDtqAF8JsXc9oLNMgenwfQ9/knEJhX/lPr5a1OsP1iv
	VBMRC4uiwhFqBvprvlIvtJEXDlsSo71AmBgQaet/86pY4iAuqhVwYSQpFTKIGBK4JWnrx2
	4fQDlYh1g4JUalkz131FRVz4hvUHTKHufHixWVEEIH1hlYcqED9gADhPu4DjmyN644nbQ8
	w6XXSt/iEwuq/N7qHNB7iVdCzOTI4L1UpRFp8WvZprvTLpn9xD2L87MRUOqhYQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717440485;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=LA3VpBmLa1taIF0eXTQvT7ILC9KXI3bMuqcKy1zyoMo=;
	b=lU1ge/4DX/OWspO/WhJJAawcjYvxPKyNqWMwiL8XB/UJfHAq57WGX3D7zhU1ne5xREgvv/
	QpIC2qi9ngmXRgPpHBOPuZzuSg6FI0A14BfqXHdzbuHty6+FbYNNL4rDxcWKPaUsj7Ktm0
	YuKPmfH32yWNkFSAjTEGaIJKjD2JV4QSYgdTGtYydwFu5hMywTNy/Q/bHWeP9n4Qhu3PdK
	gEZiAaWVbTJbsjG5Nc+tLonCfbUQktcV23tp6KXBIBqt24J9BGCJvW4lUxR+qYRCtU5R7i
	E9TaXcuTdW41njvA/n5EIbAWdsppsQkf4J/dVMyXbSeREdbbeRIiDKZCZoTHFw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtN5d6DXjzmsp;
	Mon,  3 Jun 2024 18:48:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453Im5wf099249;
	Mon, 3 Jun 2024 18:48:05 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453Im5kX099246;
	Mon, 3 Jun 2024 18:48:05 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 18:48:05 GMT
Message-Id: <202406031848.453Im5kX099246@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ryan Libby <rlibby@FreeBSD.org>
Subject: git: 7f1012ff7c8b - main - pctrie: predict successful
  allocation
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rlibby
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 7f1012ff7c8b8762c247698cb6f84963674d1f55
Auto-Submitted: auto-generated

The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=7f1012ff7c8b8762c247698cb6f84963674d1f55

commit 7f1012ff7c8b8762c247698cb6f84963674d1f55
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-03 18:35:28 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-03 18:35:28 +0000

    pctrie: predict successful allocation
    
    Reviewed by:    dougm
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D45407
---
 sys/sys/pctrie.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/sys/pctrie.h b/sys/sys/pctrie.h
index eec74610587a..38b297899592 100644
--- a/sys/sys/pctrie.h
+++ b/sys/sys/pctrie.h
@@ -84,7 +84,7 @@ name##_PCTRIE_INSERT(struct pctrie *ptree, struct type *ptr)		\
 	if (parentp == NULL)						\
 		return (0);						\
 	parent = allocfn(ptree);					\
-	if (parent == NULL)						\
+	if (__predict_false(parent == NULL))				\
 		return (ENOMEM);					\
 	pctrie_insert_node(parentp, parent, val);			\
 	return (0);							\

From nobody Mon Jun  3 19:31:02 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtP3B3tTWz5JslW;
	Mon, 03 Jun 2024 19:31:02 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtP3B3NV2z4cVR;
	Mon,  3 Jun 2024 19:31:02 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717443062;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=e7tX937ptuh3lcgaAHQVKJzJHn/d6DeKk53lQc6i7d4=;
	b=CTnoKydGs+jNG0899sRYGGTuKcCnq7mXc/K+j8B7OhZjck8mYMpAH9yOCmeRJMYB80DQ+U
	kVI3Q17XbLddpNAPu7MnJNTxIeujwbcZsDq7s1uVQ0GkLflT4JArz7zBowTP+zBJaCTM5N
	W44VTASJwkOxbQimWmXNLNyhHMTdg17cwiNw/UkFKwuwFaja6YLy3ffsRZbkNXdrkRi46g
	lDQEeP0QBOeoyP3aaNKwEIi1cC6NmhrAMW2bKausmUp41nmAxz6Sa08F27N0P5ydbz041I
	SiEbdckIZ+gvFxryOZl1O/fpnknzGqvo4zsEQ5sFAxY33JRa6oGkUZ/YGmqfKg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717443062; a=rsa-sha256; cv=none;
	b=XIHE8pxAqsPN7pfX1d/OZfIRKwrV/N32C3N85tapcBfLnrcqSARv/Us/XodleURZVGalDO
	8cj5T8dXznf8nC/IiMaJyM16u925nlvvx00LEyB2jMofmu8/C1NN5dAOtuGfFen1djU2ZL
	CYGz43+bjN5MN/Q+Z3W7h1aophVztU4TL63sQVUPmuY6m3Ci0x2vEYzoXcwqMfjtpDfZX/
	Z4Q1OZ6QvkJgBOle/S/pBOHwD0jY2I1RwcM/4Vt0GnhFTKJ3np5rWg8NyYR+hHYsaUwtb9
	YTv9+SY4r4qpFFECO67U1tmPTLeIDw/J+o5UEc/erNgjbvDCNhCzldwnyGpNlw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717443062;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=e7tX937ptuh3lcgaAHQVKJzJHn/d6DeKk53lQc6i7d4=;
	b=e//ZqJx+dQSG3cJ7kywnqnG5YwqK+G54Bp/BH2Oe8m7oxTubX4GwNcTOTSwVlTGkF5yOQg
	GQdEdIZfL98nmjUvpDBgv+WNE4oOae6bNJN9EeuYD1HCWR4l2gCqviXyMPcUygi0H6RbbN
	hnMN+UtWD7SLVgh9P5dgpumaubZnuxUWzObCwjOdJxtIMfnYgvx27xou+JxNPxyjfWf6wD
	kMoZOu5hoSCPwRcyJeKOWpsQdl3jEM8J7PWTqE2Oq4vHrWwScDb8Xu+pPXgke8C9K8sGtP
	QLr93Lmil/6FlWOoxxC7Dck1m5Pt8uP0polotvFBASlaI/bEVFHjBQBuXKcRdQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtP3B2nMXznnQ;
	Mon,  3 Jun 2024 19:31:02 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453JV2Eh081927;
	Mon, 3 Jun 2024 19:31:02 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453JV2IM081924;
	Mon, 3 Jun 2024 19:31:02 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 19:31:02 GMT
Message-Id: <202406031931.453JV2IM081924@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Jessica Clarke <jrtc27@FreeBSD.org>
Subject: git: fbfdf57d65be - main - Fix off-by-one bug in btpand
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jrtc27
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: fbfdf57d65bedfab28f9debc8a4a8d6802f9338a
Auto-Submitted: auto-generated

The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=fbfdf57d65bedfab28f9debc8a4a8d6802f9338a

commit fbfdf57d65bedfab28f9debc8a4a8d6802f9338a
Author:     Dapeng Gao <dg612@cam.ac.uk>
AuthorDate: 2024-06-03 19:30:36 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-06-03 19:30:36 +0000

    Fix off-by-one bug in btpand
    
    `ul` reaches `__arraycount(services)` before the bound-check happens, causing undefined behaviour.
    
    Reviewed by:    imp, jrtc27
    Fixes:          7718ced0ea98 ("Add btpand(8) daemon from NetBSD.")
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45463
---
 usr.sbin/bluetooth/btpand/btpand.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/bluetooth/btpand/btpand.c b/usr.sbin/bluetooth/btpand/btpand.c
index d4bc15823290..f0b29837188f 100644
--- a/usr.sbin/bluetooth/btpand/btpand.c
+++ b/usr.sbin/bluetooth/btpand/btpand.c
@@ -143,11 +143,14 @@ main(int argc, char *argv[])
 
 		case 's': /* service */
 		case 'S': /* service (no SDP) */
-			for (ul = 0; strcasecmp(optarg, services[ul].name); ul++) {
-				if (ul == __arraycount(services))
-					errx(EXIT_FAILURE, "%s: unknown service", optarg);
+			for (ul = 0; ul < __arraycount(services); ul++) {
+				if (strcasecmp(optarg, services[ul].name) == 0)
+					break;
 			}
 
+			if (ul == __arraycount(services))
+				errx(EXIT_FAILURE, "%s: unknown service", optarg);
+
 			if (ch == 's')
 				service_name = services[ul].name;
 

From nobody Mon Jun  3 20:33:04 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtQQn21K3z5LDDY;
	Mon, 03 Jun 2024 20:33:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtQQm6rZjz4jtm;
	Mon,  3 Jun 2024 20:33:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717446785;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=UPEtLXi4stQNcVrZb04Y63c6dc4vH8k6/vu69bkaYa0=;
	b=xlKXxYz3Re/34K/44yzrrmdhKQNZVApccDMLRAGo3mc/CndsVT859OArr+7DY9MFbVZn10
	UC0qtVMQ2XFYcBq13x9VSWwc823D//QX8fTSs3TItTUoe02bi+NGhHRlinHwaRXriTvJGn
	KVtidmUv+P8L/RXG6H2OX2i6v97vEMyCefmqHFkiiLSeuWQUAT9lLbX/NTTLNlEPgd92Ou
	gdLjyIVjdh7ytnAvPQ1sVb0sjXmxZmBf7rrUJcaqn8eGxvwJGA1mchNWJkyIWZ4m2aqLHi
	YODH/xllrDWTKgQLLItVD+YBq7JsGXhqMPfFPXjQsjwnSf3nGLokCSMYtRM39A==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717446785; a=rsa-sha256; cv=none;
	b=BAnoP7/tjdN0vToaAFLF8bWP+EsuPuvLuplxJeDdtxjYmaq91kmFJlTytndk377NaSYWVP
	O59AZ10ehy+QbPfDBI7SIAt9LtGfRVBKRIq/puilNUo3msNWOrJ0bbqJS3VEOUE97pmm+Q
	Jnap/LYPNdg3iqlsWYsbyGDh2DcuYYs4VG7H0sLBiYweIstiw2NFaApuw8av4Y0o8VKWoI
	7NokGnC/tz+9TODjQogKBpt3UOB/RmCDEaaw4ocNG4I9YFATWXEvYEd5siyousKdEO6FND
	S73cB6UuqT+CudUrhcffHA3gv34bxWvNgZ8eGsXDI5koPQ7Pkxw12ZahsdGDXw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717446785;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=UPEtLXi4stQNcVrZb04Y63c6dc4vH8k6/vu69bkaYa0=;
	b=Uj8T4b/zoRZ1GcdPZ+hoxpv6fpz//ORlX3COdT9VxjkMwR4Ch124jIlw0zpLU2vvaIQNd+
	TG6000s+v4E4gSfkX5OaOp20HTDZaiL7MxoX/htfshXIn6FX+UvVeRgdqhayj3c4LT4bZp
	rgpshMLakfYMt+d/q+D5Oo8xrETBIiCP1j+reZlu2novgYwNnuiaro/BYySjfqQw0mcHBB
	DRnKRFgAsy8NRpcjYJ7WrGPqlr20kp9Y8nIW2z0r4BiZq6I0/6Nb7MC1HA/stt3fMdVK6Q
	Tuuva/vBDfxXE8xzRZTORghVotmpsGyjBnZa7QhX7IXYpD1KG1GFSg+be9KxBA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtQQm6DGNzq9y;
	Mon,  3 Jun 2024 20:33:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453KX4oj086688;
	Mon, 3 Jun 2024 20:33:04 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453KX4ZP086685;
	Mon, 3 Jun 2024 20:33:04 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 20:33:04 GMT
Message-Id: <202406032033.453KX4ZP086685@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ed Maste <emaste@FreeBSD.org>
Subject: git: e0dcb9b611d3 - main - mfi: correct typo in sysctl/tunable
  description
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: emaste
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: e0dcb9b611d3b3e471d7bc30bcff7cd4e26c6f19
Auto-Submitted: auto-generated

The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=e0dcb9b611d3b3e471d7bc30bcff7cd4e26c6f19

commit e0dcb9b611d3b3e471d7bc30bcff7cd4e26c6f19
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-06-03 20:31:16 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-06-03 20:32:36 +0000

    mfi: correct typo in sysctl/tunable description
    
    Reported by:    jrtc27
    Reviewed by:    lwhsu
    Sponsored by:   The FreeBSD Foundation
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sys/dev/mfi/mfi_pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/mfi/mfi_pci.c b/sys/dev/mfi/mfi_pci.c
index de7d88556c8c..82082e6b72cf 100644
--- a/sys/dev/mfi/mfi_pci.c
+++ b/sys/dev/mfi/mfi_pci.c
@@ -112,7 +112,7 @@ SYSCTL_INT(_hw_mfi, OID_AUTO, msi, CTLFLAG_RDTUN, &mfi_msi, 0,
 
 static int	mfi_mrsas_enable;
 SYSCTL_INT(_hw_mfi, OID_AUTO, mrsas_enable, CTLFLAG_RDTUN, &mfi_mrsas_enable,
-     0, "Allow mrasas to take newer cards");
+     0, "Allow mrsas to take newer cards");
 
 struct mfi_ident {
 	uint16_t	vendor;

From nobody Mon Jun  3 20:49:21 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtQnY573vz5LFBF;
	Mon, 03 Jun 2024 20:49:21 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtQnY2y9mz4mjM;
	Mon,  3 Jun 2024 20:49:21 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717447761;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=maNMZ/UXxJBnasoK7YkOzeDKNq2Y93XIOyFenp67UL4=;
	b=aQbXUy1BJgEbmFEQM6VQtqIp8pnZnRN/GsHwAuZbohtFzxu3TRtwfobKb0wrmAkaFT6waU
	e4f1sY5z+43XN2s6qwayHP3hobmJVpVA6Il/WXqpr8Mc75jTlGXvCdWKrtYztLV+O5oczs
	eWjPzI+XVPzS5DbObDEYIwexI+QkhZTE3tZ8Pc2k9uKSpjBQ6HUgkD9elmHn616epz6qEj
	IrzX5J1xC/0SlZlsUSIbK7Xfht6BZ1mzWmzcFdIKguKnCCnwDb/YgCgdGqWWUGuPfkTN4Z
	I2adKxgxhnOfwFdPbX6G9s/gHW65dAcycLON9WlyZAijdO8glTHEOkJBQZxk5w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717447761; a=rsa-sha256; cv=none;
	b=ArZQ7mIptERtg0G0J9MXXjRpQdOl9T/IG4P9dI/Wopi/NF9lCJkQuJYse+WlVztPnBbLzO
	vvYdlZkIIyigVrUKwNUvROp/qnOgBflXbAagZxtkMsT85BDvaiHlMrJJKLY65R34Z2cpC5
	+WhkblxvHAhelBj/yljl/7qBkX6I74bdBUHFQED7eZExQTHFpY4ZqIONtnRy41MP+oIagk
	W/4l52a9e3iZc2+R/5m2uHv0cFvPkljtooLOekF70pF05DHLupp77KwWpkwmbj/9qwf6rW
	f3VgOoJgtApYcl54n0Fzr2VEAaf4R2oPzDGfxAY52QZRZINCzFjPmMZhbKVKag==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717447761;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=maNMZ/UXxJBnasoK7YkOzeDKNq2Y93XIOyFenp67UL4=;
	b=v7yFqBhHKWkZNQKGk86UNMCTjan8athQ+uIHf928TS/4ed2DJXJIMmBsCznhRzcEjD+96n
	Uvw/lgBCv/sOIsRWjPdKbr+DQfISYGudlWppExbsVIJgQIAmIzXxmFjJD4a+PVB1JavnDh
	PQiMVlhCTPU9DdonAiks9WkMmzkPLu0otRGjnYMlB46aNlN4nwcm0xkigCWamq8EkmJixN
	oJJLApG/VNAqWdV72qbFQQ5t3jsivy50IL1Dse5YkhFrMw3Q/g5Cdxxr8s2JE4OYDxusIh
	ibIysNHuca47LIeIJFrNCn+4DrrT3CS5lpsQP9BgMtd8/uwansLqX+sEfAfrJQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtQnY2YhJzqrK;
	Mon,  3 Jun 2024 20:49:21 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 453KnL2N005086;
	Mon, 3 Jun 2024 20:49:21 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 453KnL19005083;
	Mon, 3 Jun 2024 20:49:21 GMT
	(envelope-from git)
Date: Mon, 3 Jun 2024 20:49:21 GMT
Message-Id: <202406032049.453KnL19005083@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Olivier Certner <olce@FreeBSD.org>
Subject: git: f3ab0d86e807 - main - bitset: Fix __BIT_FFS_AT()'s
  herald comment
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: olce
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: f3ab0d86e8070c73bf2e2852341f8e5c709f5682
Auto-Submitted: auto-generated

The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=f3ab0d86e8070c73bf2e2852341f8e5c709f5682

commit f3ab0d86e8070c73bf2e2852341f8e5c709f5682
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2024-06-03 19:22:12 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-06-03 20:48:49 +0000

    bitset: Fix __BIT_FFS_AT()'s herald comment
    
    The manual page is correct though.
    
    No functional change.
    
    Reviewed by:    emaste
    Approved by:    emaste (mentor)
    MFC after:      3 days
    Event:          Kitchener-Waterloo Hackathon 202406
    Sponsored by:   The FreeBSD Foundation
---
 sys/sys/bitset.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/sys/bitset.h b/sys/sys/bitset.h
index 4afac9b172e8..2b26e8bcdbf9 100644
--- a/sys/sys/bitset.h
+++ b/sys/sys/bitset.h
@@ -232,8 +232,9 @@
 } while (0)
 
 /*
- * Note that `start` and the returned value from __BIT_FFS_AT are
- * 1-based bit indices.
+ * 'start' and 'end' are 0-based bit (runtime) indices. Note that, as for ffs(),
+ * the returned index is 1-based, 0 being reserved to indicate that no bits are
+ * set.
  */
 #define	__BIT_FFS_AT(_s, p, start) __extension__ ({			\
 	__size_t __i;							\

From nobody Tue Jun  4 00:01:18 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtW321rgPz5LY4C;
	Tue, 04 Jun 2024 00:01:18 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtW321NJLz5705;
	Tue,  4 Jun 2024 00:01:18 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717459278;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=HEgaodaXbFjcRH+q2tsLPjP4tw6Uenzk0x8LLzf5E58=;
	b=w04PwiH1S3xAAHO4MhvMFAO2jQKnE4nTPC9Kt0nuDbs8ojR0t3hv21999ZdmGUMQqTKUi+
	ZAoPANW0isskuJvyYJ5X94Dd7pyMqQ7gUD5AC4iSKvMWs4ki72pza9hQXnMaJbHi/eSibd
	KQrBux/iPHl2EapltiHrU+Aq/Fhp1OuAXXtpVigCicry+ZjTzvgt23JAF2e5gxP08+Jf52
	k9N/mtN0A5aeBeDRlosw5TsHRVVZcaFlbLbn2PGUh1dgOT9lLcSyct00IE8PbUeN0Vkgpk
	oAD9g3abijG/MLCUT39ZX6l0O8WKGgaH7tNIQLhcD0Fl7DM4LLF1k86tYNpj4Q==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717459278; a=rsa-sha256; cv=none;
	b=Q9Vp02G/bMa/8DOJMTTeROKLBRdAcBrXoJ+vzccZHNu4ClRgEkbD2QS5295CdhV0gt2KyV
	/AqHyULx2uERnMSmE9SuRyZVnuedevtLkEWpwm+wyTQwV2mh61r03FItdzC1DanYKDOyQq
	K1lujjHaGhWMYhrssgs9f5pKXnAhX+i0gEiMydYfwVuwaSSFpj3P54RfAec5Q96WKxLzWO
	B33R2SXEmyR4Qmm9Z1smjU8kdd4/axqGhDudQZQH0kvhxMyp8/XMhiNjzNpnmTfhNEt+tk
	QJrqPRc3lyot8ZlD9nAHeLUIZ0Dn3Bie5aGCZts1LhvcoFJ6NddEhvJ9IFJWrw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717459278;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=HEgaodaXbFjcRH+q2tsLPjP4tw6Uenzk0x8LLzf5E58=;
	b=SLbA2avMsYQFyGN/2xkudi5CymgTMYZaNxDNNOxJZSTiy9Xsdx0WNgLCkJhiY6qnrT90W7
	FHi8wKmTamsXeyCutgTdWRV6uaToAmpa3rj5bH3ti3xDWlWLSMitkPYvh+uhxli4S05c8i
	2TeKF0hhEuwRZpckZUq9XDJ46v+gX3SbNEeegUW9PzPi3JyTv8kGGncvaFOIPflKFPJKDX
	6O9jRQ92Cov7iJhQgLQqtPENsEs9QkSaxWkhEkZDV7/SJP+mJBdB8kMc1iUKKPe1gPybgM
	q0yUEDvaAPBqAhxrdf3t7qWWe2feAy0oNOhIY4qI5fcoxAj6uzK7HBVOCgFvsg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtW320zf6zwVx;
	Tue,  4 Jun 2024 00:01:18 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45401ITP036671;
	Tue, 4 Jun 2024 00:01:18 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45401IVu036668;
	Tue, 4 Jun 2024 00:01:18 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 00:01:18 GMT
Message-Id: <202406040001.45401IVu036668@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Christos Margiolis <christos@FreeBSD.org>
Subject: git: ef659a2d041c - main - snd_hda: Add Lenovo X1 Carbon
  Gen11 support
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: christos
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: ef659a2d041c01b747ae4605160c24156cae081b
Auto-Submitted: auto-generated

The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=ef659a2d041c01b747ae4605160c24156cae081b

commit ef659a2d041c01b747ae4605160c24156cae081b
Author:     Oleksandr Kryvulia <shuriku@shurik.kiev.ua>
AuthorDate: 2024-06-04 00:00:12 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-06-04 00:00:12 +0000

    snd_hda: Add Lenovo X1 Carbon Gen11 support
    
    MFC after:      2 days
    Reviewed by:    christos
    Differential Revision:  https://reviews.freebsd.org/D45361
---
 sys/dev/sound/pci/hda/hdac.h              |  2 ++
 sys/dev/sound/pci/hda/pin_patch_realtek.h | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h
index 6b6bc58a4818..191c835595ef 100644
--- a/sys/dev/sound/pci/hda/hdac.h
+++ b/sys/dev/sound/pci/hda/hdac.h
@@ -379,6 +379,7 @@
 #define	LENOVO_X230_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x21fa)
 #define	LENOVO_X230T_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x2203)
 #define	LENOVO_T431S_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x2208)
+#define	LENOVO_X1CRBNG11_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x2315)
 #define	LENOVO_G580_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x3977)
 #define	LENOVO_L5AMD_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x381b)
 #define	LENOVO_L5INTEL_SUBVENDOR	HDA_MODEL_CONSTRUCT(LENOVO, 0x380f)
@@ -573,6 +574,7 @@
 #define HDA_CODEC_ALC284	HDA_CODEC_CONSTRUCT(REALTEK, 0x0284)
 #define HDA_CODEC_ALC285	HDA_CODEC_CONSTRUCT(REALTEK, 0x0285)
 #define HDA_CODEC_ALC286	HDA_CODEC_CONSTRUCT(REALTEK, 0x0286)
+#define HDA_CODEC_ALC287	HDA_CODEC_CONSTRUCT(REALTEK, 0x0287)
 #define HDA_CODEC_ALC288	HDA_CODEC_CONSTRUCT(REALTEK, 0x0288)
 #define HDA_CODEC_ALC289	HDA_CODEC_CONSTRUCT(REALTEK, 0x0289)
 #define HDA_CODEC_ALC290	HDA_CODEC_CONSTRUCT(REALTEK, 0x0290)
diff --git a/sys/dev/sound/pci/hda/pin_patch_realtek.h b/sys/dev/sound/pci/hda/pin_patch_realtek.h
index 49afdedea8a1..abb03c92571b 100644
--- a/sys/dev/sound/pci/hda/pin_patch_realtek.h
+++ b/sys/dev/sound/pci/hda/pin_patch_realtek.h
@@ -582,6 +582,21 @@ static struct hdaa_model_pin_patch_t realtek_model_pin_patches[] = {
 				}
 			}, { }
 		}
+	}, { /**** CODEC: HDA_CODEC_ALC287 ****/
+		.id = HDA_CODEC_ALC287,
+		.patches = (struct model_pin_patch_t[]){
+			{
+				.models = (struct pin_machine_model_t[]){
+					PIN_SUBVENDOR(LENOVO_X1CRBNG11_SUBVENDOR),
+					{ }
+				},
+				.pin_patches = (struct pin_patch_t[]){
+					PIN_PATCH_NOT_APPLICABLE(20),
+					PIN_PATCH_STRING(33, "as=1 seq=15 device=Headphones loc=Right"),
+					{ }
+				}
+			}, { }
+		}
 	}, { /**** CODEC: HDA_CODEC_ALC288 ****/
 		.id = HDA_CODEC_ALC288,
 		.patches = (struct model_pin_patch_t[]){

From nobody Tue Jun  4 00:23:17 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtWXQ0D0Lz5Lb5c;
	Tue, 04 Jun 2024 00:23:18 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtWXP6X92z591Q;
	Tue,  4 Jun 2024 00:23:17 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717460597;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=oX6xAJHt4+OA6djs4+yeIzZVtaY3qAwKJN0P+rpPzgI=;
	b=tH/fczErJoYyNjGJ+f+kVGCG7xzyZbItxd2M0XEI9keuJhF2cjgPIaJba3u/orDTxY56d3
	k7XQUIjDd/Xlx7d3WKj2t8GsHdN9rg6eSMnlcARzF2YZ/NPoyEU9FhnSkUK8SjG4A5/IWk
	ffBvLB0VP+teK/MJckIiHd6cPidRWKS0HNty9HOMklTRPBH8jY205UKMBvphxOnvopDQTB
	q5e06vlMWl+4hiCWNUBRQ+TLWBQEfDGAdAbbrHGPiHZZ3GqgKTyvE/SI3KTy1I3ob4BjrJ
	QXKo77N8vIJY7cWqeomxUVq0Btwqf8b+nrLaUWaaduTDB5Bqlj26hprr1Sf62A==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717460597; a=rsa-sha256; cv=none;
	b=yPjU7+sWxa+m/UW4+lHWxadbde4objAJ1zRKrnW0FiK6u+JicioS00RswB+6TSWmYg+Am3
	B3CZZ6JsBM8cXUIU9lFHqKqfCJJBwpwPyBbpqz2kFCbrrEyHNnMzyY+7FENf3lFU6r6ofF
	Ygzmjz7IKK5XHaoXEKYQHxXFxk9qrLEH3kXIytTAi4MZrAgxbcSQKM4GkWevlfIqySL2xi
	XWQJIlegJAYFwhJAAw/wE/JYGkyOh2LrEmDO3bquvtUWJfYZq9CtocVEy+mY9jqmrvw8Ic
	p8LqNIY+i/8m/LU0s15ex/26DMQXbxYAd4r+pT2ytvLiMrBBF91xZv5HHDbenw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717460597;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=oX6xAJHt4+OA6djs4+yeIzZVtaY3qAwKJN0P+rpPzgI=;
	b=yumRaDIysUhiylCoj2iebHyGE7sSIiqWgZmgMRGOhyz13ElU4/y3gOzbMOrWRNIn8kUi2u
	rDIYM4MAMKXKwLFexh4Vi/oucRg/XkFWNAzm2t/thH/NNupPpe4VJcqaMAtlRIQCb4gGGL
	U/4KXyk3IufaNB103WPC1cNZ19aSpXab4muq0uy0yvHdsgsQcZ/RgIU9AGrA+V34AEEw83
	7QcRusFrPbKnweqy4FE1ut+AlLVx8tQgNaZwJzNuw5yL+4UxrNiX4kGNbrBzAsCaDVoe4Q
	a7OnPfU+cbu6n4te5zgZH/4iej+ONLkLjAv3BHbe2r+rhFmqmf3N3EjW1Xh8uw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtWXP5mk3zwnC;
	Tue,  4 Jun 2024 00:23:17 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4540NH2q077344;
	Tue, 4 Jun 2024 00:23:17 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4540NH99077341;
	Tue, 4 Jun 2024 00:23:17 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 00:23:17 GMT
Message-Id: <202406040023.4540NH99077341@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Gleb Smirnoff <glebius@FreeBSD.org>
Subject: git: badf44cc2124 - main - mbuf: provide m_freemp()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: glebius
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: badf44cc21249a56e7d822a77acfdd21f8352d50
Auto-Submitted: auto-generated

The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=badf44cc21249a56e7d822a77acfdd21f8352d50

commit badf44cc21249a56e7d822a77acfdd21f8352d50
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-06-04 00:22:07 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-06-04 00:23:06 +0000

    mbuf: provide m_freemp()
    
    This function follows both m_nextpkt and m_next linkage freeing all mbufs.
    Note that existing m_freem() follows only m_next.
    
    Reviewed by:            khng
    Differential Revision:  https://reviews.freebsd.org/D45477
---
 sys/kern/kern_mbuf.c | 19 +++++++++++++++++++
 sys/kern/uipc_mbuf.c |  3 +++
 sys/sys/mbuf.h       |  2 ++
 3 files changed, 24 insertions(+)

diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c
index 44b6584f7331..5c1c5b095449 100644
--- a/sys/kern/kern_mbuf.c
+++ b/sys/kern/kern_mbuf.c
@@ -1591,6 +1591,25 @@ m_freem(struct mbuf *mb)
 		mb = m_free(mb);
 }
 
+/*
+ * Free an entire chain of mbufs and associated external buffers, following
+ * both m_next and m_nextpkt linkage.
+ * Note: doesn't support NULL argument.
+ */
+void
+m_freemp(struct mbuf *m)
+{
+	struct mbuf *n;
+
+	MBUF_PROBE1(m__freemp, m);
+	do {
+		n = m->m_nextpkt;
+		while (m != NULL)
+			m = m_free(m);
+		m = n;
+	} while (m != NULL);
+}
+
 /*
  * Temporary primitive to allow freeing without going through m_free.
  */
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index d3389aeeccaf..d6b38cf8fbc8 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -111,6 +111,9 @@ SDT_PROBE_DEFINE1_XLATE(sdt, , , m__free,
 SDT_PROBE_DEFINE1_XLATE(sdt, , , m__freem,
     "struct mbuf *", "mbufinfo_t *");
 
+SDT_PROBE_DEFINE1_XLATE(sdt, , , m__freemp,
+    "struct mbuf *", "mbufinfo_t *");
+
 #include <security/mac/mac_framework.h>
 
 /*
diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h
index 741ae1b7c387..6e8454ea62d6 100644
--- a/sys/sys/mbuf.h
+++ b/sys/sys/mbuf.h
@@ -65,6 +65,7 @@ SDT_PROBE_DECLARE(sdt, , , m__cljget);
 SDT_PROBE_DECLARE(sdt, , , m__cljset);
 SDT_PROBE_DECLARE(sdt, , , m__free);
 SDT_PROBE_DECLARE(sdt, , , m__freem);
+SDT_PROBE_DECLARE(sdt, , , m__freemp);
 
 #endif /* _KERNEL */
 
@@ -843,6 +844,7 @@ void		 m_extadd(struct mbuf *, char *, u_int, m_ext_free_t,
 u_int		 m_fixhdr(struct mbuf *);
 struct mbuf	*m_fragment(struct mbuf *, int, int);
 void		 m_freem(struct mbuf *);
+void		 m_freemp(struct mbuf *);
 void		 m_free_raw(struct mbuf *);
 struct mbuf	*m_get2(int, int, short, int);
 struct mbuf	*m_get3(int, int, short, int);

From nobody Tue Jun  4 00:23:18 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtWXR0NYbz5Lb5f;
	Tue, 04 Jun 2024 00:23:19 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtWXQ6gvKz58w9;
	Tue,  4 Jun 2024 00:23:18 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717460598;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=r021potMeUwanzAC6+MwWK4TtSDoV6ENrDTXgKExdtg=;
	b=yBm/o1CbC7jK4m9QjMttJr0WLfdtsoQP4h8uu+Rhi8TNwpvcYMogSAnmq4wXtRnqdwsgNL
	Jbdg2bmYJt9/XXDnTwIpN+NPxmAi8xCrsCkNyHRLdxpLviDCf8yqQ7UiR/6fIaAjV2NB2I
	2dPdyDHMRlc4XuMUQbONwHdOr87FmWDDeM5m4jeG0aI0y2g056Wk7YNzFiNduwtoz/AwBc
	Il3fTNxCqd/QghofQwJaLBrsYOFLcmuZEdUTRyq6n05R59c9rwuaMl5F9gpW62wQOUAXye
	fiq65t0Q+sGgWZKXEkTMZc0h1dibZMyLvs+GGy29pOZs1R3YGOR145cKi/8uHg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717460598; a=rsa-sha256; cv=none;
	b=hbYFfra5WHRII35d+H70pRv8zmvap0+5TAHDM9zBizjvvKQg3fWYBgjus9efN7f+00OEVJ
	xxe4JAVkPGGdcGAtTPMzdyrPM2s8S1hEHAiA8lxV9YvrON7FD2FS8etKJUgRSzy3NYXxCo
	T7/y7j9+MN9n1rZghN1k1S1OvbaX2XoHLx75mJNKPLxSyNLALzsJzAyI6fdq9+A6qy1+85
	hqDkV1xdygEckCNbYB+/kTYNYCxIvpvh4ybi+CENOnZGCDAZ2Hx2K8GlcZc6mQBEmqwaH8
	h+3TlK9COoqnQiUtxS1jWy7R+geyUjZJp03J07QnXONHkdHJQ3+0NTabbBvKLg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717460598;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=r021potMeUwanzAC6+MwWK4TtSDoV6ENrDTXgKExdtg=;
	b=P7YHn2/Mnz0wqDHbYkfg7q3A/BdXL2yeS0uuFDhdpylkd7GJpQbrg8PStiHaZWSnvkFlZo
	oFN1ozUpRlb0GxRsFFx5SI2k7svmkcP5d/alQQvDzxpmmRWMI5RKSrCKRd8xmr+Z+HZuY+
	uEBg9uiYU6N2c/LBjnl0kNyigEwpgpD5Ljcykh/ypF7AY1bEwBmGkKD5lDtxnJjyA742gU
	UqC03/lCY6efFLB8TWyotDwA90Qqk1TlcWu+ZDZnAmqEWUtrSo0SmCXLt/Z8anMR666kC0
	/FIvbLSA7tikNYabwSgSMloqnlfVT9kINYqo2IAp0BTekQHxjs9U5mKgybOT1g==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtWXQ6HKTzx1L;
	Tue,  4 Jun 2024 00:23:18 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4540NIPL077403;
	Tue, 4 Jun 2024 00:23:18 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4540NI1m077400;
	Tue, 4 Jun 2024 00:23:18 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 00:23:18 GMT
Message-Id: <202406040023.4540NI1m077400@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Gleb Smirnoff <glebius@FreeBSD.org>
Subject: git: a9b55a66440c - main - unix: use m_freemp() when
  disposing unix socket buffers
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: glebius
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: a9b55a66440ce67e545b60f2861badbfc5ec6327
Auto-Submitted: auto-generated

The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=a9b55a66440ce67e545b60f2861badbfc5ec6327

commit a9b55a66440ce67e545b60f2861badbfc5ec6327
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-06-04 00:22:33 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-06-04 00:23:06 +0000

    unix: use m_freemp() when disposing unix socket buffers
    
    The new unix/dgram uses m_nextpkt linkage, while the old unix/stream
    uses m_next linkage.  This fixes memory leak.
    
    Diagnosed by:           khng
    Reviewed by:            khng, markj
    PR:                     279467
    Fixes:                  458f475df8e5912609c14208c189414a8255c738
    Differential Revision:  https://reviews.freebsd.org/D45478
    MFC After:              1 week
---
 sys/kern/uipc_usrreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 6e83e2be6f05..0f01afa97878 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -2190,7 +2190,7 @@ unp_disconnect(struct unpcb *unp, struct unpcb *unp2)
 
 	if (m != NULL) {
 		unp_scan(m, unp_freerights);
-		m_freem(m);
+		m_freemp(m);
 	}
 }
 
@@ -3280,7 +3280,7 @@ unp_dispose(struct socket *so)
 
 	if (m != NULL) {
 		unp_scan(m, unp_freerights);
-		m_freem(m);
+		m_freemp(m);
 	}
 }
 

From nobody Tue Jun  4 01:17:37 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtXl84PM0z5M09b;
	Tue, 04 Jun 2024 01:17:40 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtXl849Cgz4Dk8;
	Tue,  4 Jun 2024 01:17:40 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717463860;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=GBE0a1nMp5q07icGJ36SSTtGRCCuTL7BlqBY2pVHbg8=;
	b=noL2okV6A258Uu+LH9orspWz2bqiijuX6YkJub9CU0lMfOnCfdUcsOS/4DlKcGVxYjNhTY
	T7NcqHZXrE/O17ds/j18OR2rdVqNeCi+aa7wq/KYWR3aQwQZ2z+TqJbgPiI0lOFIKxecou
	56u4lE0CCqOimzLsgMDHyQfeKGVdpQ8/dTa/zDMtr6LDijFiOhEvzSFqDksyZIraQTtp3o
	Xdf3vCsIbb3ag6rxaBIQIMBxYTs52NWpDAA+VMYJkqK/mUPuLnEteXQOua+x+CN6mZ9z+M
	vgTTIJr0iMvX/OjeIDE1WQd12YoqoayXtZYbCrNt6TB5n5wyeBJF3NLJsJvigA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717463860; a=rsa-sha256; cv=none;
	b=ieREiYufIeJsRCoW2tDsIHjYn7lgCi90QBWuGi7d1WJtcXgH7U9e45SSzw9Ia+iCwZszBe
	C1awWG63WwV/DR/m8IdRq8Bh2fgGLxyMLqbuZiE2m3fJ8ABy3ES1rHJnoMJ8ENrOxrBTDk
	hI47uwSm4Rt9Yz7dxTskFxTwwSEigTnOMA41GaDvpkKEe0g6z14k1BIhf7e4I+2lZdnbY0
	MXhDerzARDwbCHQr0dHLPSfgN41+1SjmMH3Sbm1b78QafTbXjzwVuUktNo1nElCL4Epncv
	KsWzwWo0j0sjoQM4vdPj/msoPDwJIvu7exH8+ZMK3q4ZHnlwLik/ymtpl4galA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717463860;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=GBE0a1nMp5q07icGJ36SSTtGRCCuTL7BlqBY2pVHbg8=;
	b=vkCPpQ0q2bxF+PqkxWRhsKIFvXk2nOo/O+oN1gYnIrNGPbqTKIq3tdiXORHeqqvmhpAXQH
	z+bzn+Fi0sEeh7mQRuUt4eGeNsQbTiARRYEPQhqPvjCvErD3tFCmPWs7/Ku0Fah3H0ruNc
	NankGKY5ACPkojF+0EFOV9N0w7/zndQgq/5hXnFvnq0e8rrR9vFkZOdFuVXz9VX1C0xwyo
	c078UPQ5EYStVHp4v4ilHrG5VCV93YL5DZWAuMAfykBB3dJPOLlTt9wLvq7IZLPegVE4Q8
	KapPBZKXW6cqDgy6t+enW4zrXIGCF22WcMEDSE1/rnWfjBuoQ/AQNCiXV04REQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtXl83gZRzy5Y;
	Tue,  4 Jun 2024 01:17:40 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4541HeaE064401;
	Tue, 4 Jun 2024 01:17:40 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4541HbEi064389;
	Tue, 4 Jun 2024 01:17:37 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 01:17:37 GMT
Message-Id: <202406040117.4541HbEi064389@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Xin LI <delphij@FreeBSD.org>
Subject: git: 3b35e7ee8de9 - main - MFV: xz 5.6.2.
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: delphij
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 3b35e7ee8de9b0260149a2b77e87a2b9c7a36244
Auto-Submitted: auto-generated

The branch main has been updated by delphij:

URL: https://cgit.FreeBSD.org/src/commit/?id=3b35e7ee8de9b0260149a2b77e87a2b9c7a36244

commit 3b35e7ee8de9b0260149a2b77e87a2b9c7a36244
Merge: a9b55a66440c b599c3410cda
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2024-06-04 01:14:43 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2024-06-04 01:14:43 +0000

    MFV: xz 5.6.2.
    
    MFC after:      4 weeks

 contrib/xz/AUTHORS                                 |    49 +-
 contrib/xz/COPYING                                 |   103 +-
 contrib/xz/COPYING.0BSD                            |    11 +
 contrib/xz/ChangeLog                               | 17790 ++++++++++---------
 contrib/xz/README                                  |    57 +-
 contrib/xz/THANKS                                  |    13 +-
 contrib/xz/TODO                                    |     4 -
 contrib/xz/doxygen/Doxyfile                        |  2698 +--
 contrib/xz/doxygen/update-doxygen                  |   137 +-
 contrib/xz/src/common/mythread.h                   |    30 +-
 contrib/xz/src/common/sysdefs.h                    |    18 +-
 contrib/xz/src/common/tuklib_common.h              |    27 +-
 contrib/xz/src/common/tuklib_config.h              |     2 +
 contrib/xz/src/common/tuklib_cpucores.c            |     5 +-
 contrib/xz/src/common/tuklib_cpucores.h            |     5 +-
 contrib/xz/src/common/tuklib_exit.c                |     5 +-
 contrib/xz/src/common/tuklib_exit.h                |     9 +-
 contrib/xz/src/common/tuklib_gettext.h             |     5 +-
 contrib/xz/src/common/tuklib_integer.h             |    56 +-
 contrib/xz/src/common/tuklib_mbstr.h               |     5 +-
 contrib/xz/src/common/tuklib_mbstr_fw.c            |     5 +-
 contrib/xz/src/common/tuklib_mbstr_width.c         |     5 +-
 contrib/xz/src/common/tuklib_open_stdxxx.c         |     5 +-
 contrib/xz/src/common/tuklib_open_stdxxx.h         |     5 +-
 contrib/xz/src/common/tuklib_physmem.c             |    25 +-
 contrib/xz/src/common/tuklib_physmem.h             |     5 +-
 contrib/xz/src/common/tuklib_progname.c            |     5 +-
 contrib/xz/src/common/tuklib_progname.h            |     5 +-
 contrib/xz/src/liblzma/api/lzma.h                  |    31 +-
 contrib/xz/src/liblzma/api/lzma/base.h             |    25 +-
 contrib/xz/src/liblzma/api/lzma/bcj.h              |    10 +-
 contrib/xz/src/liblzma/api/lzma/block.h            |     5 +-
 contrib/xz/src/liblzma/api/lzma/check.h            |     5 +-
 contrib/xz/src/liblzma/api/lzma/container.h        |    17 +-
 contrib/xz/src/liblzma/api/lzma/delta.h            |     5 +-
 contrib/xz/src/liblzma/api/lzma/filter.h           |    11 +-
 contrib/xz/src/liblzma/api/lzma/hardware.h         |     5 +-
 contrib/xz/src/liblzma/api/lzma/index.h            |    42 +-
 contrib/xz/src/liblzma/api/lzma/index_hash.h       |     5 +-
 contrib/xz/src/liblzma/api/lzma/lzma12.h           |     7 +-
 contrib/xz/src/liblzma/api/lzma/stream_flags.h     |     5 +-
 contrib/xz/src/liblzma/api/lzma/version.h          |     9 +-
 contrib/xz/src/liblzma/api/lzma/vli.h              |    10 +-
 contrib/xz/src/liblzma/check/check.c               |     5 +-
 contrib/xz/src/liblzma/check/check.h               |     5 +-
 contrib/xz/src/liblzma/check/crc32_arm64.h         |   122 +
 contrib/xz/src/liblzma/check/crc32_fast.c          |   158 +-
 contrib/xz/src/liblzma/check/crc32_small.c         |     5 +-
 contrib/xz/src/liblzma/check/crc32_table.c         |    34 +-
 contrib/xz/src/liblzma/check/crc32_table_be.h      |     4 +-
 contrib/xz/src/liblzma/check/crc32_table_le.h      |     4 +-
 contrib/xz/src/liblzma/check/crc32_tablegen.c      |    23 +-
 contrib/xz/src/liblzma/check/crc32_x86.S           |     5 +-
 contrib/xz/src/liblzma/check/crc64_fast.c          |   446 +-
 contrib/xz/src/liblzma/check/crc64_small.c         |     5 +-
 contrib/xz/src/liblzma/check/crc64_table.c         |    16 +-
 contrib/xz/src/liblzma/check/crc64_table_be.h      |     4 +-
 contrib/xz/src/liblzma/check/crc64_table_le.h      |     4 +-
 contrib/xz/src/liblzma/check/crc64_tablegen.c      |    15 +-
 contrib/xz/src/liblzma/check/crc64_x86.S           |     5 +-
 contrib/xz/src/liblzma/check/crc_common.h          |   137 +
 contrib/xz/src/liblzma/check/crc_macros.h          |    30 -
 contrib/xz/src/liblzma/check/crc_x86_clmul.h       |   428 +
 contrib/xz/src/liblzma/common/alone_decoder.c      |     5 +-
 contrib/xz/src/liblzma/common/alone_decoder.h      |     5 +-
 contrib/xz/src/liblzma/common/alone_encoder.c      |     5 +-
 contrib/xz/src/liblzma/common/auto_decoder.c       |     5 +-
 .../xz/src/liblzma/common/block_buffer_decoder.c   |     5 +-
 .../xz/src/liblzma/common/block_buffer_encoder.c   |     5 +-
 .../xz/src/liblzma/common/block_buffer_encoder.h   |     5 +-
 contrib/xz/src/liblzma/common/block_decoder.c      |     5 +-
 contrib/xz/src/liblzma/common/block_decoder.h      |     5 +-
 contrib/xz/src/liblzma/common/block_encoder.c      |     5 +-
 contrib/xz/src/liblzma/common/block_encoder.h      |     5 +-
 .../xz/src/liblzma/common/block_header_decoder.c   |     5 +-
 .../xz/src/liblzma/common/block_header_encoder.c   |     5 +-
 contrib/xz/src/liblzma/common/block_util.c         |     5 +-
 contrib/xz/src/liblzma/common/common.c             |     5 +-
 contrib/xz/src/liblzma/common/common.h             |     5 +-
 .../xz/src/liblzma/common/easy_buffer_encoder.c    |     5 +-
 .../xz/src/liblzma/common/easy_decoder_memusage.c  |     5 +-
 contrib/xz/src/liblzma/common/easy_encoder.c       |     5 +-
 .../xz/src/liblzma/common/easy_encoder_memusage.c  |     5 +-
 contrib/xz/src/liblzma/common/easy_preset.c        |     5 +-
 contrib/xz/src/liblzma/common/easy_preset.h        |    10 +-
 contrib/xz/src/liblzma/common/file_info.c          |     5 +-
 .../xz/src/liblzma/common/filter_buffer_decoder.c  |     7 +-
 .../xz/src/liblzma/common/filter_buffer_encoder.c  |     5 +-
 contrib/xz/src/liblzma/common/filter_common.c      |    16 +-
 contrib/xz/src/liblzma/common/filter_common.h      |     5 +-
 contrib/xz/src/liblzma/common/filter_decoder.c     |    28 +-
 contrib/xz/src/liblzma/common/filter_decoder.h     |     5 +-
 contrib/xz/src/liblzma/common/filter_encoder.c     |    38 +-
 contrib/xz/src/liblzma/common/filter_encoder.h     |     5 +-
 .../xz/src/liblzma/common/filter_flags_decoder.c   |     5 +-
 .../xz/src/liblzma/common/filter_flags_encoder.c   |     5 +-
 .../xz/src/liblzma/common/hardware_cputhreads.c    |     5 +-
 contrib/xz/src/liblzma/common/hardware_physmem.c   |     5 +-
 contrib/xz/src/liblzma/common/index.c              |     5 +-
 contrib/xz/src/liblzma/common/index.h              |     5 +-
 contrib/xz/src/liblzma/common/index_decoder.c      |    16 +-
 contrib/xz/src/liblzma/common/index_decoder.h      |     5 +-
 contrib/xz/src/liblzma/common/index_encoder.c      |     5 +-
 contrib/xz/src/liblzma/common/index_encoder.h      |     5 +-
 contrib/xz/src/liblzma/common/index_hash.c         |     5 +-
 contrib/xz/src/liblzma/common/lzip_decoder.c       |     5 +-
 contrib/xz/src/liblzma/common/lzip_decoder.h       |     5 +-
 contrib/xz/src/liblzma/common/memcmplen.h          |    37 +-
 contrib/xz/src/liblzma/common/microlzma_decoder.c  |     5 +-
 contrib/xz/src/liblzma/common/microlzma_encoder.c  |     5 +-
 contrib/xz/src/liblzma/common/outqueue.c           |     5 +-
 contrib/xz/src/liblzma/common/outqueue.h           |    10 +-
 .../xz/src/liblzma/common/stream_buffer_decoder.c  |     5 +-
 .../xz/src/liblzma/common/stream_buffer_encoder.c  |     5 +-
 contrib/xz/src/liblzma/common/stream_decoder.c     |     5 +-
 contrib/xz/src/liblzma/common/stream_decoder.h     |     5 +-
 contrib/xz/src/liblzma/common/stream_decoder_mt.c  |     5 +-
 contrib/xz/src/liblzma/common/stream_encoder.c     |     5 +-
 contrib/xz/src/liblzma/common/stream_encoder_mt.c  |     5 +-
 .../xz/src/liblzma/common/stream_flags_common.c    |     5 +-
 .../xz/src/liblzma/common/stream_flags_common.h    |     5 +-
 .../xz/src/liblzma/common/stream_flags_decoder.c   |     5 +-
 .../xz/src/liblzma/common/stream_flags_encoder.c   |     5 +-
 contrib/xz/src/liblzma/common/string_conversion.c  |    26 +-
 contrib/xz/src/liblzma/common/vli_decoder.c        |     5 +-
 contrib/xz/src/liblzma/common/vli_encoder.c        |     5 +-
 contrib/xz/src/liblzma/common/vli_size.c           |     5 +-
 contrib/xz/src/liblzma/delta/delta_common.c        |     5 +-
 contrib/xz/src/liblzma/delta/delta_common.h        |     5 +-
 contrib/xz/src/liblzma/delta/delta_decoder.c       |    10 +-
 contrib/xz/src/liblzma/delta/delta_decoder.h       |     5 +-
 contrib/xz/src/liblzma/delta/delta_encoder.c       |     5 +-
 contrib/xz/src/liblzma/delta/delta_encoder.h       |     5 +-
 contrib/xz/src/liblzma/delta/delta_private.h       |     5 +-
 contrib/xz/src/liblzma/liblzma.pc.in               |     6 +-
 contrib/xz/src/liblzma/liblzma_generic.map         |     4 +-
 contrib/xz/src/liblzma/liblzma_linux.map           |     4 +-
 contrib/xz/src/liblzma/lz/lz_decoder.c             |    48 +-
 contrib/xz/src/liblzma/lz/lz_decoder.h             |   116 +-
 contrib/xz/src/liblzma/lz/lz_encoder.c             |     9 +-
 contrib/xz/src/liblzma/lz/lz_encoder.h             |    15 +-
 contrib/xz/src/liblzma/lz/lz_encoder_hash.h        |     5 +-
 contrib/xz/src/liblzma/lz/lz_encoder_hash_table.h  |     4 +-
 contrib/xz/src/liblzma/lz/lz_encoder_mf.c          |     5 +-
 contrib/xz/src/liblzma/lzma/fastpos.h              |     5 +-
 contrib/xz/src/liblzma/lzma/fastpos_table.c        |     4 +-
 contrib/xz/src/liblzma/lzma/fastpos_tablegen.c     |    17 +-
 contrib/xz/src/liblzma/lzma/lzma2_decoder.c        |     5 +-
 contrib/xz/src/liblzma/lzma/lzma2_decoder.h        |     5 +-
 contrib/xz/src/liblzma/lzma/lzma2_encoder.c        |     5 +-
 contrib/xz/src/liblzma/lzma/lzma2_encoder.h        |     5 +-
 contrib/xz/src/liblzma/lzma/lzma_common.h          |    41 +-
 contrib/xz/src/liblzma/lzma/lzma_decoder.c         |   760 +-
 contrib/xz/src/liblzma/lzma/lzma_decoder.h         |     5 +-
 contrib/xz/src/liblzma/lzma/lzma_encoder.c         |    18 +-
 contrib/xz/src/liblzma/lzma/lzma_encoder.h         |     5 +-
 .../src/liblzma/lzma/lzma_encoder_optimum_fast.c   |     5 +-
 .../src/liblzma/lzma/lzma_encoder_optimum_normal.c |     7 +-
 contrib/xz/src/liblzma/lzma/lzma_encoder_presets.c |     5 +-
 contrib/xz/src/liblzma/lzma/lzma_encoder_private.h |     9 +-
 contrib/xz/src/liblzma/rangecoder/price.h          |     5 +-
 contrib/xz/src/liblzma/rangecoder/price_table.c    |     4 +-
 contrib/xz/src/liblzma/rangecoder/price_tablegen.c |    22 +-
 contrib/xz/src/liblzma/rangecoder/range_common.h   |    14 +-
 contrib/xz/src/liblzma/rangecoder/range_decoder.h  |   839 +-
 contrib/xz/src/liblzma/rangecoder/range_encoder.h  |     5 +-
 contrib/xz/src/liblzma/simple/arm.c                |     5 +-
 contrib/xz/src/liblzma/simple/arm64.c              |     5 +-
 contrib/xz/src/liblzma/simple/armthumb.c           |     5 +-
 contrib/xz/src/liblzma/simple/ia64.c               |     5 +-
 contrib/xz/src/liblzma/simple/powerpc.c            |     5 +-
 contrib/xz/src/liblzma/simple/riscv.c              |   755 +
 contrib/xz/src/liblzma/simple/simple_coder.c       |     5 +-
 contrib/xz/src/liblzma/simple/simple_coder.h       |    22 +-
 contrib/xz/src/liblzma/simple/simple_decoder.c     |     5 +-
 contrib/xz/src/liblzma/simple/simple_decoder.h     |     5 +-
 contrib/xz/src/liblzma/simple/simple_encoder.c     |     5 +-
 contrib/xz/src/liblzma/simple/simple_encoder.h     |     5 +-
 contrib/xz/src/liblzma/simple/simple_private.h     |     5 +-
 contrib/xz/src/liblzma/simple/sparc.c              |     5 +-
 contrib/xz/src/liblzma/simple/x86.c                |    16 +-
 contrib/xz/src/liblzma/validate_map.sh             |     6 +-
 contrib/xz/src/lzmainfo/lzmainfo.1                 |     4 +-
 contrib/xz/src/lzmainfo/lzmainfo.c                 |     5 +-
 contrib/xz/src/xz/args.c                           |   186 +-
 contrib/xz/src/xz/args.h                           |     8 +-
 contrib/xz/src/xz/coder.c                          |   607 +-
 contrib/xz/src/xz/coder.h                          |    42 +-
 contrib/xz/src/xz/file_io.c                        |   144 +-
 contrib/xz/src/xz/file_io.h                        |    21 +-
 contrib/xz/src/xz/hardware.c                       |    11 +-
 contrib/xz/src/xz/hardware.h                       |     5 +-
 contrib/xz/src/xz/list.c                           |    31 +-
 contrib/xz/src/xz/list.h                           |     5 +-
 contrib/xz/src/xz/main.c                           |    91 +-
 contrib/xz/src/xz/main.h                           |     5 +-
 contrib/xz/src/xz/message.c                        |    94 +-
 contrib/xz/src/xz/message.h                        |    16 +-
 contrib/xz/src/xz/mytime.c                         |   105 +-
 contrib/xz/src/xz/mytime.h                         |    11 +-
 contrib/xz/src/xz/options.c                        |     7 +-
 contrib/xz/src/xz/options.h                        |     5 +-
 contrib/xz/src/xz/private.h                        |    26 +-
 contrib/xz/src/xz/sandbox.c                        |   355 +
 contrib/xz/src/xz/sandbox.h                        |    43 +
 contrib/xz/src/xz/signals.c                        |    29 +-
 contrib/xz/src/xz/signals.h                        |     5 +-
 contrib/xz/src/xz/suffix.c                         |    17 +-
 contrib/xz/src/xz/suffix.h                         |     5 +-
 contrib/xz/src/xz/util.c                           |    36 +-
 contrib/xz/src/xz/util.h                           |    19 +-
 contrib/xz/src/xz/xz.1                             |   469 +-
 contrib/xz/src/xzdec/xzdec.1                       |     6 +-
 contrib/xz/src/xzdec/xzdec.c                       |   180 +-
 lib/liblzma/Makefile                               |     1 +
 lib/liblzma/config.h                               |   123 +-
 usr.bin/xz/Makefile                                |     1 +
 217 files changed, 15386 insertions(+), 13436 deletions(-)

diff --cc contrib/xz/COPYING.0BSD
index 000000000000,4322122aecf1..4322122aecf1
mode 000000,100644..100644
--- a/contrib/xz/COPYING.0BSD
+++ b/contrib/xz/COPYING.0BSD
diff --cc contrib/xz/src/liblzma/check/crc32_arm64.h
index 000000000000,39c1c63ec0ec..39c1c63ec0ec
mode 000000,100644..100644
--- a/contrib/xz/src/liblzma/check/crc32_arm64.h
+++ b/contrib/xz/src/liblzma/check/crc32_arm64.h
diff --cc contrib/xz/src/liblzma/check/crc_common.h
index 000000000000,63a7b5cefebf..63a7b5cefebf
mode 000000,100644..100644
--- a/contrib/xz/src/liblzma/check/crc_common.h
+++ b/contrib/xz/src/liblzma/check/crc_common.h
diff --cc contrib/xz/src/liblzma/check/crc_x86_clmul.h
index 000000000000,f1254ece18ed..f1254ece18ed
mode 000000,100644..100644
--- a/contrib/xz/src/liblzma/check/crc_x86_clmul.h
+++ b/contrib/xz/src/liblzma/check/crc_x86_clmul.h
diff --cc contrib/xz/src/liblzma/simple/riscv.c
index 000000000000,b18df8b637d0..b18df8b637d0
mode 000000,100644..100644
--- a/contrib/xz/src/liblzma/simple/riscv.c
+++ b/contrib/xz/src/liblzma/simple/riscv.c
diff --cc contrib/xz/src/xz/sandbox.c
index 000000000000,5bd227370751..5bd227370751
mode 000000,100644..100644
--- a/contrib/xz/src/xz/sandbox.c
+++ b/contrib/xz/src/xz/sandbox.c
diff --cc contrib/xz/src/xz/sandbox.h
index 000000000000,98b9862a1c0a..98b9862a1c0a
mode 000000,100644..100644
--- a/contrib/xz/src/xz/sandbox.h
+++ b/contrib/xz/src/xz/sandbox.h
diff --cc lib/liblzma/Makefile
index 85e7b87bbbf0,000000000000..e656ddd9bb45
mode 100644,000000..100644
--- a/lib/liblzma/Makefile
+++ b/lib/liblzma/Makefile
@@@ -1,176 -1,0 +1,177 @@@
 +
 +PACKAGE=lib${LIB}
 +LIB=		lzma
 +LZMADIR=	${SRCTOP}/contrib/xz/src/liblzma
 +
 +.PATH: ${LZMADIR:H}/common
 +SRCS+=	tuklib_physmem.c tuklib_cpucores.c
 +
 +.PATH: ${LZMADIR}/api/lzma
 +
 +MAININCS=	../lzma.h
 +MAININCSDIR=	${INCLUDEDIR}
 +
 +LZMAINCS+=	base.h \
 +		bcj.h \
 +		block.h \
 +		check.h \
 +		container.h \
 +		delta.h \
 +		filter.h \
 +		hardware.h \
 +		index.h \
 +		index_hash.h \
 +		lzma12.h \
 +		stream_flags.h \
 +		version.h \
 +		vli.h
 +
 +LZMAINCSDIR=	${INCLUDEDIR}/lzma
 +
 +INCSGROUPS=	MAININCS LZMAINCS
 +
 +.PATH: ${LZMADIR}/common
 +SRCS+=	common.c \
 +	block_util.c \
 +	easy_preset.c \
 +	filter_common.c \
 +	hardware_physmem.c \
 +	hardware_cputhreads.c \
 +	index.c \
 +	stream_flags_common.c \
 +	string_conversion.c \
 +	vli_size.c \
 +	alone_encoder.c \
 +	block_buffer_encoder.c \
 +	block_encoder.c \
 +	block_header_encoder.c \
 +	easy_buffer_encoder.c \
 +	easy_encoder.c \
 +	easy_encoder_memusage.c \
 +	filter_buffer_encoder.c \
 +	filter_encoder.c \
 +	filter_flags_encoder.c \
 +	index_encoder.c \
 +	lzip_decoder.c \
 +	microlzma_encoder.c \
 +	microlzma_decoder.c \
 +	stream_buffer_encoder.c \
 +	stream_encoder.c \
 +	stream_flags_encoder.c \
 +	vli_encoder.c \
 +	alone_decoder.c \
 +	auto_decoder.c \
 +	block_buffer_decoder.c \
 +	block_decoder.c \
 +	block_header_decoder.c \
 +	easy_decoder_memusage.c \
 +	file_info.c \
 +	filter_buffer_decoder.c \
 +	filter_decoder.c \
 +	filter_flags_decoder.c \
 +	index_decoder.c \
 +	index_hash.c \
 +	stream_buffer_decoder.c \
 +	stream_decoder.c \
 +	stream_decoder_mt.c \
 +	stream_flags_decoder.c \
 +	stream_encoder_mt.c \
 +	vli_decoder.c \
 +	outqueue.c
 +
 +
 +.PATH: ${LZMADIR}/check
 +SRCS+=	check.c \
 +	crc32_table.c \
 +	crc64_table.c
 +.if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "i386"
 +SRCS+=	crc32_x86.S \
 +	crc64_x86.S
 +ACFLAGS+=	-Wa,--noexecstack
 +.else
 +SRCS+=	crc32_fast.c \
 +	crc64_fast.c
 +.endif
 +
 +.PATH: ${LZMADIR}/lz
 +SRCS+=	lz_encoder.c \
 +	lz_encoder_mf.c \
 +	lz_decoder.c
 +
 +.PATH: ${LZMADIR}/lzma
 +SRCS+=	lzma_encoder.c \
 +	lzma_encoder_presets.c \
 +	lzma_encoder_optimum_fast.c \
 +	lzma_encoder_optimum_normal.c \
 +	fastpos_table.c \
 +	lzma_decoder.c \
 +	lzma2_encoder.c \
 +	lzma2_decoder.c
 +
 +.PATH: ${LZMADIR}/rangecoder
 +SRCS+=	price_table.c
 +
 +.PATH: ${LZMADIR}/delta
 +SRCS+=	delta_common.c \
 +	delta_encoder.c \
 +	delta_decoder.c
 +
 +.PATH: ${LZMADIR}/simple
 +SRCS+=	simple_coder.c \
 +	simple_encoder.c \
 +	simple_decoder.c \
 +	x86.c \
 +	powerpc.c \
 +	ia64.c \
 +	arm.c \
 +	arm64.c \
 +	armthumb.c \
++	riscv.c \
 +	sparc.c
 +
 +.PATH: ${LZMADIR}
 +
 +VERSION_MAJOR!=	sed -n '/define.*LZMA_VERSION_MAJOR/{s,[^0-9.],,gp;q;}' \
 +			${LZMADIR}/api/lzma/version.h
 +VERSION_MINOR!=	sed -n '/define.*LZMA_VERSION_MINOR/{s,[^0-9.],,gp;q;}' \
 +			${LZMADIR}/api/lzma/version.h
 +VERSION_PATCH!=	sed -n '/define.*LZMA_VERSION_PATCH/{s,[^0-9.],,gp;q;}' \
 +			${LZMADIR}/api/lzma/version.h
 +
 +WARNS?=	3
 +
 +CFLAGS+=	-DHAVE_CONFIG_H \
 +		-DTUKLIB_SYMBOL_PREFIX=lzma_ \
 +		-I${.CURDIR} \
 +		-I${LZMADIR}/api \
 +		-I${LZMADIR}/common \
 +		-I${LZMADIR}/check \
 +		-I${LZMADIR}/lz \
 +		-I${LZMADIR}/rangecoder \
 +		-I${LZMADIR}/lzma \
 +		-I${LZMADIR}/delta \
 +		-I${LZMADIR}/simple \
 +		-I${LZMADIR:H}/common
 +
 +LIBADD+=	md pthread
 +
 +VERSION_DEF=	${.CURDIR}/Versions.def
 +SYMBOL_MAPS=	${.CURDIR}/Symbol.map
 +
 +CLEANFILES+=	liblzma.pc
 +
 +PCFILES=	liblzma.pc
 +
 +liblzma.pc: liblzma.pc.in
 +	sed -e 's,@prefix@,/usr,g ; \
 +		s,@exec_prefix@,/usr,g ; \
 +		s,@libdir@,${LIBDIR},g ; \
 +		s,@sharedlibdir@,${SHLIBDIR},g ; \
 +		s,@includedir@,${INCLUDEDIR},g ; \
 +		s,@LIBS@,-pthread -lmd,g ; \
 +		s,@PACKAGE_URL@,https://tukaani.org/xz/,g ; \
 +		s,@PACKAGE_VERSION@,${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH},g ; \
 +		s,@PTHREAD_CFLAGS@,,g ; \
 +		s,@PTHREAD_LIBS@,,g' ${.ALLSRC} > ${.TARGET}
 +
 +.include <bsd.lib.mk>
diff --cc lib/liblzma/config.h
index cfa53becb2ad,000000000000..ca7375dd8725
mode 100644,000000..100644
--- a/lib/liblzma/config.h
+++ b/lib/liblzma/config.h
@@@ -1,618 -1,0 +1,643 @@@
 +/* config.h.  Generated from config.h.in by configure.  */
 +/* config.h.in.  Generated from configure.ac by autoheader.  */
 +
 +/* Define if building universal (internal helper macro) */
 +/* #undef AC_APPLE_UNIVERSAL_BUILD */
 +
 +/* How many MiB of RAM to assume if the real amount cannot be determined. */
 +#define ASSUME_RAM 128
 +
 +/* Define to 1 if translation of program messages to the user's native
 +   language is requested. */
 +/* FreeBSD - disabled intentionally */
 +/* #undef ENABLE_NLS */
 +
++/* Define to 1 if ARM64 CRC32 instruction is supported. See configure.ac for
++   details. */
++/* #undef HAVE_ARM64_CRC32 */
++
 +/* Define to 1 if bswap_16 is available. */
 +/* #undef HAVE_BSWAP_16 */
 +
 +/* Define to 1 if bswap_32 is available. */
 +/* #undef HAVE_BSWAP_32 */
 +
 +/* Define to 1 if bswap_64 is available. */
 +/* #undef HAVE_BSWAP_64 */
 +
 +/* Define to 1 if you have the <byteswap.h> header file. */
 +/* #undef HAVE_BYTESWAP_H */
 +
 +#ifndef WITHOUT_CAPSICUM
- /* Define to 1 if Capsicum is available. */
- #define HAVE_CAPSICUM 1
++/* Define to 1 if you have the 'cap_rights_limit' function. */
++#define HAVE_CAP_RIGHTS_LIMIT 1
 +#endif
 +
- /* Define to 1 if the system has the type `CC_SHA256_CTX'. */
++/* Define to 1 if the system has the type 'CC_SHA256_CTX'. */
 +/* #undef HAVE_CC_SHA256_CTX */
 +
- /* Define to 1 if you have the `CC_SHA256_Init' function. */
++/* Define to 1 if you have the 'CC_SHA256_Init' function. */
 +/* #undef HAVE_CC_SHA256_INIT */
 +
 +/* Define to 1 if you have the Mac OS X function
 +   CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
 +/* #undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES */
 +
 +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
 +   the CoreFoundation framework. */
 +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
 +
 +/* Define to 1 if crc32 integrity check is enabled. */
 +#define HAVE_CHECK_CRC32 1
 +
 +/* Define to 1 if crc64 integrity check is enabled. */
 +#define HAVE_CHECK_CRC64 1
 +
 +/* Define to 1 if sha256 integrity check is enabled. */
 +#define HAVE_CHECK_SHA256 1
 +
- /* Define to 1 if you have the `clock_gettime' function. */
++/* Define to 1 if you have the 'clock_gettime' function. */
 +#define HAVE_CLOCK_GETTIME 1
 +
- /* Define to 1 if `CLOCK_MONOTONIC' is declared in <time.h>. */
++/* Define to 1 if 'CLOCK_MONOTONIC' is declared in <time.h>. */
 +#define HAVE_CLOCK_MONOTONIC 1
 +
 +/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
 +/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */
 +
 +/* Define to 1 if you have the <cpuid.h> header file. */
 +#define HAVE_CPUID_H 1
 +
 +/* Define if the GNU dcgettext() function is already present or preinstalled.
 +   */
 +/* FreeBSD - disabled intentionally */
 +/* #undef HAVE_DCGETTEXT */
 +
 +/* Define to 1 if any of HAVE_DECODER_foo have been defined. */
 +#define HAVE_DECODERS 1
 +
 +/* Define to 1 if arm decoder is enabled. */
 +#define HAVE_DECODER_ARM 1
 +
 +/* Define to 1 if arm64 decoder is enabled. */
 +#define HAVE_DECODER_ARM64 1
 +
 +/* Define to 1 if armthumb decoder is enabled. */
 +#define HAVE_DECODER_ARMTHUMB 1
 +
 +/* Define to 1 if delta decoder is enabled. */
 +#define HAVE_DECODER_DELTA 1
 +
 +/* Define to 1 if ia64 decoder is enabled. */
 +#define HAVE_DECODER_IA64 1
 +
 +/* Define to 1 if lzma1 decoder is enabled. */
 +#define HAVE_DECODER_LZMA1 1
 +
 +/* Define to 1 if lzma2 decoder is enabled. */
 +#define HAVE_DECODER_LZMA2 1
 +
 +/* Define to 1 if powerpc decoder is enabled. */
 +#define HAVE_DECODER_POWERPC 1
 +
++/* Define to 1 if riscv decoder is enabled. */
++#define HAVE_DECODER_RISCV 1
++
 +/* Define to 1 if sparc decoder is enabled. */
 +#define HAVE_DECODER_SPARC 1
 +
 +/* Define to 1 if x86 decoder is enabled. */
 +#define HAVE_DECODER_X86 1
 +
 +/* Define to 1 if you have the <dlfcn.h> header file. */
 +#define HAVE_DLFCN_H 1
 +
++/* Define to 1 if you have the 'elf_aux_info' function. */
++/* #undef HAVE_ELF_AUX_INFO */
++
 +/* Define to 1 if any of HAVE_ENCODER_foo have been defined. */
 +#define HAVE_ENCODERS 1
 +
 +/* Define to 1 if arm encoder is enabled. */
 +#define HAVE_ENCODER_ARM 1
 +
 +/* Define to 1 if arm64 encoder is enabled. */
 +#define HAVE_ENCODER_ARM64 1
 +
 +/* Define to 1 if armthumb encoder is enabled. */
 +#define HAVE_ENCODER_ARMTHUMB 1
 +
 +/* Define to 1 if delta encoder is enabled. */
 +#define HAVE_ENCODER_DELTA 1
 +
 +/* Define to 1 if ia64 encoder is enabled. */
 +#define HAVE_ENCODER_IA64 1
 +
 +/* Define to 1 if lzma1 encoder is enabled. */
 +#define HAVE_ENCODER_LZMA1 1
 +
 +/* Define to 1 if lzma2 encoder is enabled. */
 +#define HAVE_ENCODER_LZMA2 1
 +
 +/* Define to 1 if powerpc encoder is enabled. */
 +#define HAVE_ENCODER_POWERPC 1
 +
++/* Define to 1 if riscv encoder is enabled. */
++#define HAVE_ENCODER_RISCV 1
++
 +/* Define to 1 if sparc encoder is enabled. */
 +#define HAVE_ENCODER_SPARC 1
 +
 +/* Define to 1 if x86 encoder is enabled. */
 +#define HAVE_ENCODER_X86 1
 +
- /* Define to 1 if you have the <fcntl.h> header file. */
- #define HAVE_FCNTL_H 1
- 
 +/* Define to 1 if __attribute__((__constructor__)) is supported for functions.
 +   */
 +#define HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR 1
 +
- /* Define to 1 if you have the `futimens' function. */
++/* Define to 1 if you have the 'futimens' function. */
 +#define HAVE_FUTIMENS 1
 +
- /* Define to 1 if you have the `futimes' function. */
++/* Define to 1 if you have the 'futimes' function. */
 +/* #undef HAVE_FUTIMES */
 +
- /* Define to 1 if you have the `futimesat' function. */
++/* Define to 1 if you have the 'futimesat' function. */
 +/* #undef HAVE_FUTIMESAT */
 +
++/* Define to 1 if you have the 'getauxval' function. */
++/* #undef HAVE_GETAUXVAL */
++
 +/* Define to 1 if you have the <getopt.h> header file. */
 +#define HAVE_GETOPT_H 1
 +
- /* Define to 1 if you have the `getopt_long' function. */
++/* Define to 1 if you have the 'getopt_long' function. */
 +#define HAVE_GETOPT_LONG 1
 +
 +/* Define if the GNU gettext() function is already present or preinstalled. */
 +/* FreeBSD - disabled intentionally */
 +/* #undef HAVE_GETTEXT */
 +
 +/* Define if you have the iconv() function and it works. */
 +#define HAVE_ICONV 1
 +
 +/* Define to 1 if you have the <immintrin.h> header file. */
 +/* FreeBSD - only with clang because the base gcc does not support it */
 +#if defined(__clang__) && defined(__FreeBSD__) && defined(__amd64__)
 +#define HAVE_IMMINTRIN_H 1
 +#endif
 +
 +/* Define to 1 if you have the <inttypes.h> header file. */
 +#define HAVE_INTTYPES_H 1
 +
- /* Define to 1 if you have the <limits.h> header file. */
- #define HAVE_LIMITS_H 1
++/* Define to 1 if Linux Landlock is supported. See configure.ac for details.
++   */
++/* #undef HAVE_LINUX_LANDLOCK */
 +
 +/* Define to 1 if .lz (lzip) decompression support is enabled. */
 +#define HAVE_LZIP_DECODER 1
 +
 +/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
 +#define HAVE_MBRTOWC 1
 +
 +/* Define to 1 to enable bt2 match finder. */
 +#define HAVE_MF_BT2 1
 +
 +/* Define to 1 to enable bt3 match finder. */
 +#define HAVE_MF_BT3 1
 +
 +/* Define to 1 to enable bt4 match finder. */
 +#define HAVE_MF_BT4 1
 +
 +/* Define to 1 to enable hc3 match finder. */
 +#define HAVE_MF_HC3 1
 +
 +/* Define to 1 to enable hc4 match finder. */
 +#define HAVE_MF_HC4 1
 +
++/* Define to 1 if MicroLZMA support is enabled. */
++#define HAVE_MICROLZMA 1
++
 +/* Define to 1 if you have the <minix/config.h> header file. */
 +/* #undef HAVE_MINIX_CONFIG_H */
 +
 +/* Define to 1 if getopt.h declares extern int optreset. */
 +#define HAVE_OPTRESET 1
 +
- /* Define to 1 if you have the `pledge' function. */
++/* Define to 1 if you have the 'pledge' function. */
 +/* #undef HAVE_PLEDGE */
 +
- /* Define to 1 if you have the `posix_fadvise' function. */
++/* Define to 1 if you have the 'posix_fadvise' function. */
 +#define HAVE_POSIX_FADVISE 1
 +
- /* Define to 1 if `program_invocation_name' is declared in <errno.h>. */
++/* Define to 1 if 'program_invocation_name' is declared in <errno.h>. */
 +/* #undef HAVE_PROGRAM_INVOCATION_NAME */
 +
- /* Define to 1 if you have the `pthread_condattr_setclock' function. */
++/* Define to 1 if you have the 'pthread_condattr_setclock' function. */
 +#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
 +
 +/* Have PTHREAD_PRIO_INHERIT. */
 +#define HAVE_PTHREAD_PRIO_INHERIT 1
 +
- /* Define to 1 if you have the `SHA256Init' function. */
++/* Define to 1 if you have the 'SHA256Init' function. */
 +/* #undef HAVE_SHA256INIT */
 +
- /* Define to 1 if the system has the type `SHA256_CTX'. */
++/* Define to 1 if the system has the type 'SHA256_CTX'. */
 +#define HAVE_SHA256_CTX 1
 +
 +/* Define to 1 if you have the <sha256.h> header file. */
 +#define HAVE_SHA256_H 1
 +
- /* Define to 1 if you have the `SHA256_Init' function. */
++/* Define to 1 if you have the 'SHA256_Init' function. */
 +#define HAVE_SHA256_INIT 1
 +
- /* Define to 1 if the system has the type `SHA2_CTX'. */
++/* Define to 1 if the system has the type 'SHA2_CTX'. */
 +/* #undef HAVE_SHA2_CTX */
 +
 +/* Define to 1 if you have the <sha2.h> header file. */
 +/* #undef HAVE_SHA2_H */
 +
 +/* Define to 1 if optimizing for size. */
 +/* #undef HAVE_SMALL */
 +
 +/* Define to 1 if stdbool.h conforms to C99. */
 +#define HAVE_STDBOOL_H 1
 +
 +/* Define to 1 if you have the <stdint.h> header file. */
 +#define HAVE_STDINT_H 1
 +
 +/* Define to 1 if you have the <stdio.h> header file. */
 +#define HAVE_STDIO_H 1
 +
 +/* Define to 1 if you have the <stdlib.h> header file. */
 +#define HAVE_STDLIB_H 1
 +
 +/* Define to 1 if you have the <strings.h> header file. */
 +#define HAVE_STRINGS_H 1
 +
 +/* Define to 1 if you have the <string.h> header file. */
 +#define HAVE_STRING_H 1
 +
- /* Define to 1 if `st_atimensec' is a member of `struct stat'. */
++/* Define to 1 if 'st_atimensec' is a member of 'struct stat'. */
 +#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
 +
- /* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */
++/* Define to 1 if 'st_atimespec.tv_nsec' is a member of 'struct stat'. */
 +#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1
 +
- /* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */
++/* Define to 1 if 'st_atim.st__tim.tv_nsec' is a member of 'struct stat'. */
 +/* #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC */
 +
- /* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
++/* Define to 1 if 'st_atim.tv_nsec' is a member of 'struct stat'. */
 +#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
 +
- /* Define to 1 if `st_uatime' is a member of `struct stat'. */
++/* Define to 1 if 'st_uatime' is a member of 'struct stat'. */
 +/* #undef HAVE_STRUCT_STAT_ST_UATIME */
 +
 +/* Define to 1 to if GNU/Linux-specific details are unconditionally wanted for
 +   symbol versioning. Define to 2 to if these are wanted only if also PIC is
 +   defined (allows building both shared and static liblzma at the same time
 +   with Libtool if neither --with-pic nor --without-pic is used). This define
 +   must be used together with liblzma_linux.map. */
 +/* #undef HAVE_SYMBOL_VERSIONS_LINUX */
 +
++/* Define to 1 if you have the 'sysctlbyname' function. */
++/* #undef HAVE_SYSCTLBYNAME */
++
 +/* Define to 1 if you have the <sys/byteorder.h> header file. */
 +/* #undef HAVE_SYS_BYTEORDER_H */
 +
- #ifndef WITHOUT_CAPSICUM
- /* Define to 1 if you have the <sys/capsicum.h> header file. */
- #define HAVE_SYS_CAPSICUM_H 1
- #endif
++/* Define to 1 if you have the <sys/cdefs.h> header file. */
++#define HAVE_SYS_CDEFS_H 1
 +
 +/* Define to 1 if you have the <sys/endian.h> header file. */
 +/* #undef HAVE_SYS_ENDIAN_H */
 +
 +/* Define to 1 if you have the <sys/param.h> header file. */
 +#define HAVE_SYS_PARAM_H 1
 +
 +/* Define to 1 if you have the <sys/stat.h> header file. */
 +#define HAVE_SYS_STAT_H 1
 +
- /* Define to 1 if you have the <sys/time.h> header file. */
- #define HAVE_SYS_TIME_H 1
- 
 +/* Define to 1 if you have the <sys/types.h> header file. */
 +#define HAVE_SYS_TYPES_H 1
 +
- /* Define to 1 if the system has the type `uintptr_t'. */
++/* Define to 1 if the system has the type 'uintptr_t'. */
 +#define HAVE_UINTPTR_T 1
 +
 +/* Define to 1 if you have the <unistd.h> header file. */
 +#define HAVE_UNISTD_H 1
 +
 +/* Define to 1 if _mm_set_epi64x and _mm_clmulepi64_si128 are usable. See
 +   configure.ac for details. */
 +#if defined(__FreeBSD__) && defined(__amd64__)
 +#define HAVE_USABLE_CLMUL 1
 +#endif
 +
- /* Define to 1 if you have the `utime' function. */
++/* Define to 1 if you have the 'utime' function. */
 +/* #undef HAVE_UTIME */
 +
- /* Define to 1 if you have the `utimes' function. */
++/* Define to 1 if you have the 'utimes' function. */
 +/* #undef HAVE_UTIMES */
 +
 +/* Define to 1 or 0, depending whether the compiler supports simple visibility
 +   declarations. */
 +#define HAVE_VISIBILITY 1
 +
 +/* Define to 1 if you have the <wchar.h> header file. */
 +#define HAVE_WCHAR_H 1
 +
- /* Define to 1 if you have the `wcwidth' function. */
++/* Define to 1 if you have the 'wcwidth' function. */
 +#define HAVE_WCWIDTH 1
 +
- /* Define to 1 if the system has the type `_Bool'. */
++/* Define to 1 if the system has the type '_Bool'. */
 +#define HAVE__BOOL 1
 +
- /* Define to 1 if you have the `_futime' function. */
++/* Define to 1 if you have the '_futime' function. */
 +/* #undef HAVE__FUTIME */
 +
 +/* Define to 1 if _mm_movemask_epi8 is available. */
 +#if defined(__FreeBSD__) && defined(__amd64__)
 +#define HAVE__MM_MOVEMASK_EPI8 1
 +#endif
 +
 +/* Define to 1 if the GNU C extension __builtin_assume_aligned is supported.
 +   */
 +#define HAVE___BUILTIN_ASSUME_ALIGNED 1
 +
 +/* Define to 1 if the GNU C extensions __builtin_bswap16/32/64 are supported.
 +   */
 +#define HAVE___BUILTIN_BSWAPXX 1
 +
 +/* Define to the sub-directory where libtool stores uninstalled libraries. */
 +#define LT_OBJDIR ".libs/"
 +
 +/* Define to 1 when using POSIX threads (pthreads). */
 +#define MYTHREAD_POSIX 1
 +
 +/* Define to 1 when using Windows Vista compatible threads. This uses features
 +   that are not available on Windows XP. */
 +/* #undef MYTHREAD_VISTA */
 +
 +/* Define to 1 when using Windows 95 (and thus XP) compatible threads. This
 +   avoids use of features that were added in Windows Vista. */
 +/* #undef MYTHREAD_WIN95 */
 +
 +/* Define to 1 to disable debugging code. */
 +#define NDEBUG 1
 +
 +/* Name of package */
 +#define PACKAGE "xz"
 +
 +/* Define to the address where bug reports for this package should be sent. */
 +#define PACKAGE_BUGREPORT "xz@tukaani.org"
 +
 +/* Define to the full name of this package. */
 +#define PACKAGE_NAME "XZ Utils"
 +
 +/* Define to the full name and version of this package. */
- #define PACKAGE_STRING "XZ Utils 5.4.5"
++#define PACKAGE_STRING "XZ Utils 5.6.2"
 +
 +/* Define to the one symbol short name of this package. */
 +#define PACKAGE_TARNAME "xz"
 +
 +/* Define to the home page for this package. */
 +#define PACKAGE_URL "https://tukaani.org/xz/"
 +
 +/* Define to the version of this package. */
- #define PACKAGE_VERSION "5.4.5"
++#define PACKAGE_VERSION "5.6.2"
 +
 +/* Define to necessary symbol if this constant uses a non-standard name on
 +   your system. */
 +/* #undef PTHREAD_CREATE_JOINABLE */
 +
- /* The size of `size_t', as computed by sizeof. */
++/* The size of 'size_t', as computed by sizeof. */
 +#define SIZEOF_SIZE_T 8
 +
- /* Define to 1 if all of the C90 standard headers exist (not just the ones
++/* Define to 1 if all of the C89 standard headers exist (not just the ones
 +   required in a freestanding environment). This macro is provided for
 +   backward compatibility; new code need not use it. */
 +#define STDC_HEADERS 1
 +
 +/* Define to 1 if the number of available CPU cores can be detected with
 +   cpuset(2). */
 +#define TUKLIB_CPUCORES_CPUSET 1
 +
 +/* Define to 1 if the number of available CPU cores can be detected with
 +   pstat_getdynamic(). */
 +/* #undef TUKLIB_CPUCORES_PSTAT_GETDYNAMIC */
 +
 +/* Define to 1 if the number of available CPU cores can be detected with
 +   sched_getaffinity() */
 +/* #undef TUKLIB_CPUCORES_SCHED_GETAFFINITY */
 +
 +/* Define to 1 if the number of available CPU cores can be detected with
 +   sysconf(_SC_NPROCESSORS_ONLN) or sysconf(_SC_NPROC_ONLN). */
 +/* #undef TUKLIB_CPUCORES_SYSCONF */
 +
 +/* Define to 1 if the number of available CPU cores can be detected with
 +   sysctl(). */
 +/* #undef TUKLIB_CPUCORES_SYSCTL */
 +
 +/* Define to 1 if the system supports fast unaligned access to 16-bit, 32-bit,
 +   and 64-bit integers. */
 +/* FreeBSD - derive from __NO_STRICT_ALIGNMENT */
 +/* #undef TUKLIB_FAST_UNALIGNED_ACCESS */
 +
 +/* Define to 1 if the amount of physical memory can be detected with
 +   _system_configuration.physmem. */
 +/* #undef TUKLIB_PHYSMEM_AIX */
 +
 +/* Define to 1 if the amount of physical memory can be detected with
 +   getinvent_r(). */
 +/* #undef TUKLIB_PHYSMEM_GETINVENT_R */
 +
 +/* Define to 1 if the amount of physical memory can be detected with
 +   getsysinfo(). */
 +/* #undef TUKLIB_PHYSMEM_GETSYSINFO */
 +
 +/* Define to 1 if the amount of physical memory can be detected with
 +   pstat_getstatic(). */
 +/* #undef TUKLIB_PHYSMEM_PSTAT_GETSTATIC */
 +
 +/* Define to 1 if the amount of physical memory can be detected with
 +   sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES). */
 +#define TUKLIB_PHYSMEM_SYSCONF 1
 +
 +/* Define to 1 if the amount of physical memory can be detected with sysctl().
 +   */
 +/* #undef TUKLIB_PHYSMEM_SYSCTL */
 +
 +/* Define to 1 if the amount of physical memory can be detected with Linux
 +   sysinfo(). */
 +/* #undef TUKLIB_PHYSMEM_SYSINFO */
 +
 +/* Define to 1 to use unsafe type punning, e.g. char *x = ...; *(int *)x =
 +   123; which violates strict aliasing rules and thus is undefined behavior
 +   and might result in broken code. */
 +/* #undef TUKLIB_USE_UNSAFE_TYPE_PUNNING */
 +
- /* Enable extensions on AIX 3, Interix.  */
++/* Enable extensions on AIX, Interix, z/OS.  */
 +#ifndef _ALL_SOURCE
 +# define _ALL_SOURCE 1
 +#endif
 +/* Enable general extensions on macOS.  */
 +#ifndef _DARWIN_C_SOURCE
*** 218 LINES SKIPPED ***

From nobody Tue Jun  4 05:39:15 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtfY02B8vz5MQx4;
	Tue, 04 Jun 2024 05:39:16 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtfY01QDTz4fjJ;
	Tue,  4 Jun 2024 05:39:16 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717479556;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=0hCK772cNyzFS5PQ3SpelnwAjhc8bbbrsDMUJU2heU0=;
	b=BHWLMf8FBaz406KndRVDjO9YOdtAMeLPZL+rCSsmtCYrlWpZVsC784oQPvkbVmI69XHKfZ
	VvLZ0xsRrMhjVd5B+nysRHpphnao7GUfjCToytzQZJbQyG4lyZpKMDMsDld5pQqKVCx1l7
	LcXPF5fv/+DE9B0ukeaszF5C5xQSBJQRuspjlM6l8r3/1OUGPTc40HIorT3PHYd9kRrnRH
	M3IojzaWhoCfn/wwzBnPYDaic6d8ToErtzVgiuRYDAZIJbaPQdsjoHYoIx80Q3sT0UR35C
	WBb4CCPbSfT2TWOOWNFkiydwXhyO3cR/2MWqrQbZag+9ynpNINcJ9vtRKy+TjQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717479556; a=rsa-sha256; cv=none;
	b=ZiZzWu5tyBybawHS6oN/nLLZg28T3BY8/ATdckMmyybsivvbE6oiwkxAq4EvslmKmVvzRE
	Vy3jGG81KsJiNu50hhJB7lc1/YJv0ChqIBhbHFyuQwZtHSkhd/TwL5jhNw382fK9L6kNaE
	RcJI3rKaSlL+2k1L6Uv9ifacTJVmeEP+ZbRAYLgQuwACd757UOdOZC3yHZ+Vie14T/B0QK
	MsZJthWfl4CrryfmRH0Z/htyKyHfF9I+IHJ+MN1YfN2QA6w5WpdPGX4LGGunAkPhHXLocA
	wSLVCZPACQYw08iM7fU/fm6+txE8Dlp9p6RrWp4wMYwbybZzlA0nw3c5wWeagA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717479556;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=0hCK772cNyzFS5PQ3SpelnwAjhc8bbbrsDMUJU2heU0=;
	b=arGI59PkwFB/ixuhjme0AwKEnHrr6VvWwwsiK3CCdfgH+IHcqgYJskEH7VuPmErwwnLFvy
	66LrbD+SPgFrXfZhogN3K/PGPLPdnNK499SZcdTAVDV9BQWsnopVz6dYL91Cjoj+UCsUYr
	no0hETkRbuLhe+Dia6GjZfxZ1+h9ewKfpE6LYAtURWDA6RTjHfyG0xJ3hs2aNs54TRwCOH
	Ek2EtqHP9AheR2xHJ7zc9IF8mPHHPRbxOYhnFxxWPy6UqFILXRPHlCJWH7xP5dx2eN3omQ
	Tkf3ryDvF2rWV7GRMmhGNkFlsK28P3/260NPw6t1q5+nE26VxaTNCYYwDy5aPA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtfY00thJz15wH;
	Tue,  4 Jun 2024 05:39:16 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4545dF6c004078;
	Tue, 4 Jun 2024 05:39:15 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4545dFF7004075;
	Tue, 4 Jun 2024 05:39:15 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 05:39:15 GMT
Message-Id: <202406040539.4545dFF7004075@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Alan Cox <alc@FreeBSD.org>
Subject: git: f1d73aacdc47 - main - pmap: Skip some superpage
  promotion attempts that will fail
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: alc
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: f1d73aacdc47529310e2302094685295c032e28f
Auto-Submitted: auto-generated

The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=f1d73aacdc47529310e2302094685295c032e28f

commit f1d73aacdc47529310e2302094685295c032e28f
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2024-06-02 08:56:47 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2024-06-04 05:38:05 +0000

    pmap: Skip some superpage promotion attempts that will fail
    
    Implement a simple heuristic to skip pointless promotion attempts by
    pmap_enter_quick_locked() and moea64_enter().  Specifically, when
    vm_fault() calls pmap_enter_quick() to map neighboring pages at the end
    of a copy-on-write fault, there is no point in attempting promotion in
    pmap_enter_quick_locked() and moea64_enter().  Promotion will fail
    because the base pages have differing protection.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D45431
    MFC after:      1 week
---
 sys/amd64/amd64/pmap.c      |  3 ++-
 sys/arm64/arm64/pmap.c      |  3 ++-
 sys/i386/i386/pmap.c        |  3 ++-
 sys/powerpc/aim/mmu_oea64.c |  9 +++++++--
 sys/riscv/riscv/pmap.c      |  3 ++-
 sys/vm/vm.h                 |  1 +
 sys/vm/vm_fault.c           | 11 ++++++++++-
 7 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 8105c9d92478..2f3119aede67 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -7818,7 +7818,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
 	 * If both the PTP and the reservation are fully populated, then
 	 * attempt promotion.
 	 */
-	if ((mpte == NULL || mpte->ref_count == NPTEPG) &&
+	if ((prot & VM_PROT_NO_PROMOTE) == 0 &&
+	    (mpte == NULL || mpte->ref_count == NPTEPG) &&
 	    (m->flags & PG_FICTITIOUS) == 0 &&
 	    vm_reserv_level_iffullpop(m) == 0) {
 		if (pde == NULL)
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index aaba6ca189a1..b6bc113ba8a4 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -6052,7 +6052,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
 	 * If both the PTP and the reservation are fully populated, then
 	 * attempt promotion.
 	 */
-	if ((mpte == NULL || mpte->ref_count == NL3PG) &&
+	if ((prot & VM_PROT_NO_PROMOTE) == 0 &&
+	    (mpte == NULL || mpte->ref_count == NL3PG) &&
 	    (m->flags & PG_FICTITIOUS) == 0 &&
 	    vm_reserv_level_iffullpop(m) == 0) {
 		if (l2 == NULL)
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index 40d8ceaf42b9..5808c31a99af 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -4250,7 +4250,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
 	 * If both the PTP and the reservation are fully populated, then
 	 * attempt promotion.
 	 */
-	if ((mpte == NULL || mpte->ref_count == NPTEPG) &&
+	if ((prot & VM_PROT_NO_PROMOTE) == 0 &&
+	    (mpte == NULL || mpte->ref_count == NPTEPG) &&
 	    (m->flags & PG_FICTITIOUS) == 0 &&
 	    vm_reserv_level_iffullpop(m) == 0) {
 		if (pde == NULL)
diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c
index 391f90bb04eb..273dc38214e2 100644
--- a/sys/powerpc/aim/mmu_oea64.c
+++ b/sys/powerpc/aim/mmu_oea64.c
@@ -1755,10 +1755,14 @@ out:
 	 * If the VA of the entered page is not aligned with its PA,
 	 * don't try page promotion as it is not possible.
 	 * This reduces the number of promotion failures dramatically.
+	 *
+	 * Ignore VM_PROT_NO_PROMOTE unless PMAP_ENTER_QUICK_LOCKED.
 	 */
 	if (moea64_ps_enabled(pmap) && pmap != kernel_pmap && pvo != NULL &&
 	    (pvo->pvo_vaddr & PVO_MANAGED) != 0 &&
 	    (va & HPT_SP_MASK) == (pa & HPT_SP_MASK) &&
+	    ((prot & VM_PROT_NO_PROMOTE) == 0 ||
+	    (flags & PMAP_ENTER_QUICK_LOCKED) == 0) &&
 	    (m->flags & PG_FICTITIOUS) == 0 &&
 	    vm_reserv_level_iffullpop(m) == 0)
 		moea64_sp_promote(pmap, va, m);
@@ -1850,8 +1854,9 @@ moea64_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m,
     vm_prot_t prot)
 {
 
-	moea64_enter(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE),
-	    PMAP_ENTER_NOSLEEP | PMAP_ENTER_QUICK_LOCKED, 0);
+	moea64_enter(pm, va, m, prot & (VM_PROT_READ | VM_PROT_EXECUTE |
+	    VM_PROT_NO_PROMOTE), PMAP_ENTER_NOSLEEP | PMAP_ENTER_QUICK_LOCKED,
+	    0);
 }
 
 vm_paddr_t
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index 1e507f62696e..e8504bcb0f59 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -3519,7 +3519,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
 	 * If both the PTP and the reservation are fully populated, then attempt
 	 * promotion.
 	 */
-	if ((mpte == NULL || mpte->ref_count == Ln_ENTRIES) &&
+	if ((prot & VM_PROT_NO_PROMOTE) == 0 &&
+	    (mpte == NULL || mpte->ref_count == Ln_ENTRIES) &&
 	    (m->flags & PG_FICTITIOUS) == 0 &&
 	    vm_reserv_level_iffullpop(m) == 0) {
 		if (l2 == NULL)
diff --git a/sys/vm/vm.h b/sys/vm/vm.h
index 5fac6b3f2e78..b7d149a2fca2 100644
--- a/sys/vm/vm.h
+++ b/sys/vm/vm.h
@@ -76,6 +76,7 @@ typedef u_char vm_prot_t;	/* protection codes */
 #define	VM_PROT_COPY		((vm_prot_t) 0x08)	/* copy-on-read */
 #define	VM_PROT_PRIV_FLAG	((vm_prot_t) 0x10)
 #define	VM_PROT_FAULT_LOOKUP	VM_PROT_PRIV_FLAG
+#define	VM_PROT_NO_PROMOTE	VM_PROT_PRIV_FLAG
 #define	VM_PROT_QUICK_NOFAULT	VM_PROT_PRIV_FLAG	/* same to save bits */
 
 #define	VM_PROT_ALL		(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
index fbe0a117a388..3da411643f26 100644
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -1891,6 +1891,7 @@ vm_fault_prefault(const struct faultstate *fs, vm_offset_t addra,
 	vm_offset_t addr, starta;
 	vm_pindex_t pindex;
 	vm_page_t m;
+	vm_prot_t prot;
 	int i;
 
 	pmap = fs->map->pmap;
@@ -1906,6 +1907,14 @@ vm_fault_prefault(const struct faultstate *fs, vm_offset_t addra,
 		if (starta < entry->start)
 			starta = entry->start;
 	}
+	prot = entry->protection;
+
+	/*
+	 * If pmap_enter() has enabled write access on a nearby mapping, then
+	 * don't attempt promotion, because it will fail.
+	 */
+	if ((fs->prot & VM_PROT_WRITE) != 0)
+		prot |= VM_PROT_NO_PROMOTE;
 
 	/*
 	 * Generate the sequence of virtual addresses that are candidates for
@@ -1949,7 +1958,7 @@ vm_fault_prefault(const struct faultstate *fs, vm_offset_t addra,
 		}
 		if (vm_page_all_valid(m) &&
 		    (m->flags & PG_FICTITIOUS) == 0)
-			pmap_enter_quick(pmap, addr, m, entry->protection);
+			pmap_enter_quick(pmap, addr, m, prot);
 		if (!obj_locked || lobject != entry->object.vm_object)
 			VM_OBJECT_RUNLOCK(lobject);
 	}

From nobody Tue Jun  4 06:28:19 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtgdc1K7xz5MYWV;
	Tue, 04 Jun 2024 06:28:20 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtgdc0Xcrz4kvV;
	Tue,  4 Jun 2024 06:28:20 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717482500;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=qg5SEhzDq5UjZ5aN/ODYZrtuC6LTrmqt0N/TZtrPXTQ=;
	b=NlkT0YPc3S7zeuzCVX8B8UB+a7A3o1ZO6qlkx6fhMlrBFP/DpF3OqSEnzNe8UVOcCpzOuA
	cARCgrhNUGhzcYdTPvcdjykNkrFWhSv6oaQPMIkUDdXxZ7C/+UKNZ5SDjn3ScTUbosF084
	Zcys/YF8nru/d7uUK8wAEifL6siirCZWfJzoMu2iiB4jsopo9cUQ7MF5N0nGmcCSfuXao9
	vqs2ImqZGYsdY6PQab90ZojVF6kr8V8kS4X55m0or/89BUWLdDkRty/mlEz1+npSgB2ItA
	8tfTneRHNqbHwnRjg2LrzK7iz5Duf1rAASUg5lvhuMjBAxqPPvOoDqatLnWMCQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717482500; a=rsa-sha256; cv=none;
	b=ggmrtXExSwH11TA3HKwGnDuDBTTsRDZpCJKH9ZD+x5BIFxTdHJYF5d1ZOCl84nNGWBrkRr
	lEGO/0jLxVKC/Frf1oKmgYn0cKHD/so++o/jkarVrj6A7ZTe5McYw9m7rr3JojHxOiSzYk
	sRrlMaZl8P3Z/a0BfMQsbf/T6vOToWquWk5JC8Tj22plEiy0qZb4Q3a+uAXHetQGQO760i
	lnYmz8WaoStZxVYHcbSG72sWYRSihwkCTGq03DuYZeCMg3ooACpbW2TeMRhQKyl4+bJ/iX
	G3/F5JG25vc/YtljsHk80gzXP+CJzRhN1lQeyYKL2qed8WWUU3SLq+wagjbmyw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717482500;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=qg5SEhzDq5UjZ5aN/ODYZrtuC6LTrmqt0N/TZtrPXTQ=;
	b=pYVn2yoBB2G3Y6IiGNgdfCKQYdk+FJ8261HnEYl07QnqCWwsw76ytiFA1NXORkT0bmPVHA
	DFzUvDwvHZ946y17mZcwHq/T21J7CiQpENsClQpeDzXGMPTI2q3Bg4KpDd9HxV3/PPsVzD
	aHTVsYEfHirIMgG+L/mldfOx1vpIZmiTSVbdevCFFGBfKh6q3oPwhMsgUk6vUbFRhyo/3y
	eEMtlOlBSbNyQwckH0n5Wc5iWzpNiBIosmTK5S/cpkAmCn8mE8ddh9uSFQ8mJi4pKbwoL3
	UYiJHCMvsPLY5cC2SXyTcSp5a/ebu7Aly5w++WXabZUYFbfSZy6PE7W3oZCfgg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtgdc085rz16w5;
	Tue,  4 Jun 2024 06:28:20 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4546SJLW088671;
	Tue, 4 Jun 2024 06:28:19 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4546SJ98088668;
	Tue, 4 Jun 2024 06:28:19 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 06:28:19 GMT
Message-Id: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Stefan =?utf-8?Q?E=C3=9Fer?= <se@FreeBSD.org>
Subject: git: 41ee91c64f47 - main - newfs_msdos: fix build on
  non-FreeBSD systems
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: se
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
Auto-Submitted: auto-generated

The branch main has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=41ee91c64f47faaa8131df3cd8a63bdb60fa486a

commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2024-06-04 06:26:09 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2024-06-04 06:26:09 +0000

    newfs_msdos: fix build on non-FreeBSD systems
    
    Disable data area alignment if the build environment does not define
    PAGE_SIZE (e.g., when building on Linux or macOS).
    
    Reported by:    jrtc27
    MFC after:      1 week
---
 sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c
index 423fbbcadcc5..1bca560a59e1 100644
--- a/sbin/newfs_msdos/mkfs_msdos.c
+++ b/sbin/newfs_msdos/mkfs_msdos.c
@@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
 	    if (o.align)
 		alignto = bpb.bpbSecPerClust;
 	    else
+#ifdef	PAGE_SIZE
 		alignto = PAGE_SIZE / bpb.bpbBytesPerSec;
+#else
+	        alignto = 1;
+#endif
 	    if (alignto > 1) {
 		/* align data clusters */
 		alignment = (bpb.bpbResSectors + bpb.bpbBigFATsecs * bpb.bpbFATs + rds) %

From nobody Tue Jun  4 06:39:16 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtgtH1G6vz5MZhn;
	Tue, 04 Jun 2024 06:39:19 +0000 (UTC)
	(envelope-from se@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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtgtH0kWrz4mDj;
	Tue,  4 Jun 2024 06:39:19 +0000 (UTC)
	(envelope-from se@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717483159;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=sJ5VHpqhi+8E1vHcgmePZc7hbraaiUcNiiFAIg5hHUE=;
	b=ttcEo4cGXgazDKhRiW7OjvQQxvvFv1sQJmw+0NcaY1nG4j83q9f/xqFWXRb+3v9CdCZlrY
	f1LVjg/O8vuJPtCq27yXXAcXDCk7k40xIqa8rZKZsjaLyNtDkDx7zuHEiJI3mXVq72BE0B
	BOKlPdbJ4/QiTzk16LC4TqyUKAWqiOZFFgEmLvJyrX4JAAQ+M503sWocNl8Av4isKHXnab
	lm1KVNm3OZxdZaL0tkcsJJddrbKPxfpIa6EotUU/3iQLX3bKX77vdQGsJh6KPusBw9Kcme
	oozMunMs3RRI5vxoZgLdwMLJJoGvDjMpydR9W9WTsKX3szAAeF2QRjT7yLLzcg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717483159; a=rsa-sha256; cv=none;
	b=u8zpA83Syf1knxCyQn1olpx7BIRN82qJt+8LfL1vxvuJ/jt1Ct0wUaUGGfTljzDOOwn62O
	aGnbz1Vbq2KqDKq7jnSZEe6ZUZrlSlbUvjFf67dT3fS28f97dI/srLni9ClpV1P+gzgVJU
	MNzYKsCPnOSQVpj/FUx0HDTvyjRWOP52qbPVFn0XxSKDR7PKu03qEvZQS/p9O+ExhXTcXo
	TD5DPM2TFWxlUnW7Eth8DfLACvEiP/4LdwHG9OExN37BmqkARIlR6G+A7MJ/oQOuTWbdK3
	h6amDV415wRSGprxIBa1gJuvTviqL1n11sMfRrGKME81jQS5bKKFZbSI9YGyqg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717483159;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=sJ5VHpqhi+8E1vHcgmePZc7hbraaiUcNiiFAIg5hHUE=;
	b=d5+1Z1e+hK97RaLfOBi43LtCunwT7iwYpx4s7lJREoGM9cEfmR10xurn5CwtxTh/My/+UR
	64F+3cs7Am+1ikfvByVa4kVTXmH5EI9AKrYhaOTyQ3/ECvnP3FV113UH9dD8/NrVj7D0Qo
	NsV3PV5IMG9W2fHmycBYEwrtN1GmloHKsMPH85Ti0aTaz5iVu2nsVzHkXGFhSHE6UvI6HP
	w+YHGnCozB48urFwsFQdtdXOOwmteNJxyU6pxyJj57LBbzuJZTE2iNL6Zax2RkXwQw4/uJ
	EEfvMEvyEsO/9ygvz9z4XR5jdnRKsGCBuDhf+kq2/NdkOKBfCa2eLPpJ4HJRCQ==
Received: from [192.168.119.168] (p5dc83c4c.dip0.t-ipconnect.de [93.200.60.76])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: se/mail)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4VtgtG2PtQz1HFZ;
	Tue,  4 Jun 2024 06:39:18 +0000 (UTC)
	(envelope-from se@FreeBSD.org)
Message-ID: <adf5a6cd-e57b-44eb-ae7b-a0233ae6fd4b@FreeBSD.org>
Date: Tue, 4 Jun 2024 08:39:16 +0200
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: =?UTF-8?Q?Stefan_E=C3=9Fer?= <se@FreeBSD.org>
Subject: Re: git: 077f757d72e5 - main - newfs_msdos: align data area to VM
 page boundary by default
To: Jessica Clarke <jrtc27@freebsd.org>
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
References: <202406021227.452CRx8I007470@gitrepo.freebsd.org>
 <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>
Content-Language: de-DE, en-US
In-Reply-To: <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Am 03.06.24 um 19:25 schrieb Jessica Clarke:
> On 2 Jun 2024, at 13:27, Stefan Eßer <se@FreeBSD.org> wrote:
>>
>> The branch main has been updated by se:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=077f757d72e561eb84193d8e58f63e96e69b8096
>>
>> commit 077f757d72e561eb84193d8e58f63e96e69b8096
>> Author:     Stefan Eßer <se@FreeBSD.org>
>> AuthorDate: 2024-06-02 12:07:52 +0000
>> Commit:     Stefan Eßer <se@FreeBSD.org>
>> CommitDate: 2024-06-02 12:07:52 +0000
>>
>>     newfs_msdos: align data area to VM page boundary by default
[...]
> 
> Hi,
> This has completely broken[1] all of the Linux and macOS cross-build CI
> jobs (which pass -DWITH_DISK_IMAGE_TOOLS_BOOTSTRAP). Please either fix
> this promptly or back it out until you can do so.
> 
> Jess
> 
> [1] See https://github.com/freebsd/freebsd-src/actions/runs/9338256762

Thank you for the report and sorry for the breakage.

This should be fixed in commit 41ee91c64f47faaa by skipping the
alignment of the data area, if PAGE_SIZE is not defined.

An alternative approach would have been to define PAGE_SIZE to a
sane default value of 4096 (as used on most current architectures
by default), if not set in the build environment.

If there is consensus that this would be more appropriate (since
it matches what the man page says), I'd revert the latest commit
and instead of it commit the following change:

index 1bca560a59e1..c4f18a28ec39 100644
--- a/sbin/newfs_msdos/mkfs_msdos.c
+++ b/sbin/newfs_msdos/mkfs_msdos.c
@@ -55,6 +55,10 @@

  #include "mkfs_msdos.h"

+#ifndef        PAGE_SIZE
+#define        PAGE_SIZE 4096
+#endif
+
  #define        MAXU16    0xffff        /* maximum unsigned 16-bit quantity */
  #define        BPN       4             /* bits per nibble */
  #define        NPB       2             /* nibbles per byte */

Regards, STefan

From nobody Tue Jun  4 07:11:13 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vthb56czJz5MfXy;
	Tue, 04 Jun 2024 07:11:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vthb569yHz4q9d;
	Tue,  4 Jun 2024 07:11:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717485073;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=u7FpMMW32FVhcb1rsNatgf7KLJY8hbLhjC9ywwUyDOk=;
	b=U4PFfuDFEdT7oFz81zVcbsviwY06jebfSStM1qbzHk/5VFox2E7G+QWp0UuGoNmzBmMqqc
	tawkhybfc1wEaNT7tVOIDODahPrHzSL/aVd3gQpFEeXEDyI42R4Yx7mnGyeY8/0UKXYIyw
	/6kAgnc6i07CPuUp8mr1hVRLBos1Bd+2bUCRCKY6ARzJLvwdCcX1JgotFsC7WfmEHjaJs9
	d/uUijksegucmiI3SH8hXeDJJNZfu57c/3/Ui1mm3MyOelw18zU30U0VTFXmPrfdd4ESs2
	3Pgi7b+KvLkQNjMheC+U7yi5baQyGFlAlPpxaIcnk+fHtOfWsJYQ37O/fC7+ig==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717485073; a=rsa-sha256; cv=none;
	b=ZRNK7i6UQnddeXLUvCxsSroIDMNJgx2bBcZL8mnNl8/oJOKCXHtf4MX+VoBCN58uuXKECm
	dXxsz3jTW6hla6xhjooep1vRNumIcBH8X7Zl8TkmKwQu+XuPh8Ey6PIq8Sje3uKX+8QiPI
	gBMyUq0XdRKU9NX2RVX3EerBKQWCY0ZidLGqJEMZBWnEbWw3ZpMka9y91O5ayFEm9mCyTY
	9eFC1cVax4SMom+Fo1/plbduyJypNAOT67XdXQiNFrFiwZuOM0Q0efKK53eZGKopwNOs+N
	S7uhyO1dCJ72ysH5abDayCppPlXJYmHWFnKS0VI+bjO4g/8Fu3GXjFCIS5k0Vg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717485073;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=u7FpMMW32FVhcb1rsNatgf7KLJY8hbLhjC9ywwUyDOk=;
	b=d+NI9YRZbLT52VBrNrgYIVKVSZnud5LzTPG+1grp+JWgk4ciOvjNNonTv03UZhhDqzwZVx
	S6Bkjyl700c2ygv4fUrabFYdd7dWwcM/u84rOAhmYC0YI+ipV/5djtO12kNtH8jfveNTsl
	UjzSjP5bqFjce6YlKl5hpREgLCi2ekNe0XFCqh8pbyblkv5lZad6weC5QY4ozQ+hfSDTw9
	H5eImTMnAMOy0UziVKUSxmus6wAilAPHaN1BJABPTPbRV2KWdLn8fRqXjtewSoaV2lwDp+
	urS+dUUgd1klFKSLulzbwDe3a+dIOtQKRnVKdxBmTlTEVkVZMAoyfgHrZxfksw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vthb55nHNz17jw;
	Tue,  4 Jun 2024 07:11:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4547BDQR071059;
	Tue, 4 Jun 2024 07:11:13 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4547BDS2071056;
	Tue, 4 Jun 2024 07:11:13 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 07:11:13 GMT
Message-Id: <202406040711.4547BDS2071056@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Corvin =?utf-8?Q?K=C3=B6hne?= <corvink@FreeBSD.org>
Subject: git: 5e09c5a1ed66 - main - bhyve: use correct size to map
  the OpRegion
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: corvink
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 5e09c5a1ed66f58c499884ebf44e1633be195578
Auto-Submitted: auto-generated

The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=5e09c5a1ed66f58c499884ebf44e1633be195578

commit 5e09c5a1ed66f58c499884ebf44e1633be195578
Author:     Corvin Köhne <corvink@FreeBSD.org>
AuthorDate: 2023-12-18 12:44:04 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2024-06-04 07:08:34 +0000

    bhyve: use correct size to map the OpRegion
    
    We're already converting the size reported by the OpRegion header from
    kilobytes to bytes. We don't have to do that twice when mapping the OpRegion.
    
    Reviewed by:            markj
    MFC after:              1 week
    Sponsored by:           Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D45334
---
 usr.sbin/bhyve/amd64/pci_gvt-d.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/bhyve/amd64/pci_gvt-d.c b/usr.sbin/bhyve/amd64/pci_gvt-d.c
index dfcd6a8f68c8..95f9066498d6 100644
--- a/usr.sbin/bhyve/amd64/pci_gvt-d.c
+++ b/usr.sbin/bhyve/amd64/pci_gvt-d.c
@@ -222,8 +222,8 @@ gvt_d_setup_opregion(struct pci_devinst *const pi)
 	opregion->len = header->size * KB;
 	munmap(header, sizeof(*header));
 
-	opregion->hva = mmap(NULL, opregion->len * KB, PROT_READ, MAP_SHARED,
-	    memfd, opregion->hpa);
+	opregion->hva = mmap(NULL, opregion->len, PROT_READ, MAP_SHARED, memfd,
+	    opregion->hpa);
 	if (opregion->hva == MAP_FAILED) {
 		warn("%s: Unable to map host OpRegion", __func__);
 		close(memfd);

From nobody Tue Jun  4 07:11:14 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vthb73CYqz5MfQJ;
	Tue, 04 Jun 2024 07:11:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vthb71tq4z4qGG;
	Tue,  4 Jun 2024 07:11:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717485075;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=iUSDn3ruVB6P+rtVcH0BYIu8MUgHabU+bOs4p9Z9xZM=;
	b=lArkWPrNmcCQdTZLAgiS4Xe+sE6hophzyNzoT2R+OqCvMuN07yl/p1verEh11UnURK6X0X
	URpY3lzynnjAsybhSE0Obv0qxYEcxs1pRKlw+kvVc+NoBmbRcduSLGgf2OGAKPZjkAGXGe
	z8KmjEnFaXxLEcWUuzEdvRiWK4XWnoRFy0UoXc1nf+w2YwCIvlgRCN5z4LC8QnMnfBOyvU
	zFm7XeYRZ3l3OiF5B9tOoje3FuRZISsG1jF3NWL4i8xKa25PbA7UtfA2Q6MbhI/IUZP4Y9
	spVhr0/ne0XriORz83eJG9Xu2pJp706nMVErclteeLNbS169brv1H7LX6OPohg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717485075; a=rsa-sha256; cv=none;
	b=RAplpUyWIqts7dfoWkB8PQwfzorinyNfIDALQA8TJDaWfon04+lTuIMQ/ZbTS3SLFwRORa
	iVwrL0mgfxmkwhOft3Aebvbv3soeHyVgvPghA1rFfb/NGPQM6WwG+TwyvJxEHj2izfD5GM
	RAa+2itYpG9VSWsKt46i6Ph145Sm9oEDdhFSZhZZO77H6DZZZ0af46KRxKVIGKHgXL32mR
	XiuQM7lUTaisl49iMudI6X4NGpBP74AGZHUpzhvFhhJq5WngTjFQP03W9bgf9LqSlLlPar
	T+N3raUkJrBppr3x+MPiZzAbUm+PA5S85B2jVuQWnYJ3kh/FqVzSnmeyvgU8mw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717485075;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=iUSDn3ruVB6P+rtVcH0BYIu8MUgHabU+bOs4p9Z9xZM=;
	b=xOY1Cr3iAMdZEPK6YXKr/uplhfjt+ohOsQpX/NY49dVMhlZBma222QbHhJo6dj+SJji/pg
	3qlxwrUatCyOMdgknMV9QyIxsb/fSYRjXCqJ5uMFsagM/olnPZEC25WVAoUtLTL+pDuSJt
	Fyauk9i/UQW2F+cvrxX5pm2XvA5JUkMBuDKboFSjRxMM2AsOCzP9uCnzVxQURULbujuB/p
	LuPAal9aNJ+b837NVbwe/Jzn8x6h65T8NPoocg9DHfxP9YohzIB+fHsJNyqHeUWJVWvu5G
	4uJiFdTr+tXUFG5nNtpEoXE7yWVSN6pWiaeYJ4EYv1yLlV2aPCPJTklaQ6w01g==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vthb66p8Gz185v;
	Tue,  4 Jun 2024 07:11:14 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4547BEVF071101;
	Tue, 4 Jun 2024 07:11:14 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4547BEfm071098;
	Tue, 4 Jun 2024 07:11:14 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 07:11:14 GMT
Message-Id: <202406040711.4547BEfm071098@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Corvin =?utf-8?Q?K=C3=B6hne?= <corvink@FreeBSD.org>
Subject: git: e425e601b978 - main - bhyve: verify OpRegion size
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: corvink
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: e425e601b9781c3585fcee4adf29a295a6b2aa45
Auto-Submitted: auto-generated

The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=e425e601b9781c3585fcee4adf29a295a6b2aa45

commit e425e601b9781c3585fcee4adf29a295a6b2aa45
Author:     Corvin Köhne <corvink@FreeBSD.org>
AuthorDate: 2023-12-15 11:46:09 +0000
Commit:     Corvin Köhne <corvink@FreeBSD.org>
CommitDate: 2024-06-04 07:08:49 +0000

    bhyve: verify OpRegion size
    
    If the OpRegion size doesn't match the size of our igd_opregion struct, it's
    using a different layout than we're expecting. To avoid strange issues, we
    should exit hard. If we see any devices in the field with a different OpRegion
    size, we can analyse it and fix it accordingly.
    
    Reviewed by:            markj
    MFC after:              1 week
    Sponsored by:           Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D45335
---
 usr.sbin/bhyve/amd64/pci_gvt-d.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/usr.sbin/bhyve/amd64/pci_gvt-d.c b/usr.sbin/bhyve/amd64/pci_gvt-d.c
index 95f9066498d6..8cd5d21c8e6d 100644
--- a/usr.sbin/bhyve/amd64/pci_gvt-d.c
+++ b/usr.sbin/bhyve/amd64/pci_gvt-d.c
@@ -222,6 +222,13 @@ gvt_d_setup_opregion(struct pci_devinst *const pi)
 	opregion->len = header->size * KB;
 	munmap(header, sizeof(*header));
 
+	if (opregion->len != sizeof(struct igd_opregion)) {
+		warnx("%s: Invalid OpRegion size of 0x%lx", __func__,
+		    opregion->len);
+		close(memfd);
+		return (-1);
+	}
+
 	opregion->hva = mmap(NULL, opregion->len, PROT_READ, MAP_SHARED, memfd,
 	    opregion->hpa);
 	if (opregion->hva == MAP_FAILED) {

From nobody Tue Jun  4 07:40:09 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtjDT2RX7z5Mklr;
	Tue, 04 Jun 2024 07:40:09 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtjDT1f62z4vh9;
	Tue,  4 Jun 2024 07:40:09 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717486809;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ejINXpiHP0q2AF/E/7BfniJFbWBIrfNxYm3cOsmKNVU=;
	b=s00WDxA38zbtAtcnYLuL5i/8Qui2JGCLcH7XgmNJwPssdI5oikLlC/PBQkEMpBqEp6+B7G
	9cZYNVrY0fGfoWmRy/sj/0LcobKCbeDlAj4b0K+EdEzFSZ4eP1JjS8AYgqWDzXTWUyWn+s
	cp99HTVJ7Al34PdiUJaOGFjnB6VrZC7fClLVswjGRTD52UMrOI5XfFS9j8Nex1tFC2wZZU
	9IOkqo2MIhho0HljC0oiwy29CVoipV5TKIs9+/m0EJaf2JwHqumVBwQKU8o2RYUqd3q4fl
	PWtEyNW3ST4W9RLSnzWRCdLLHI7wPaUhRQjtVSiOSkfTNMU65cFn5zw0pkSPYg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717486809; a=rsa-sha256; cv=none;
	b=ZutoqubhZsWJNAN4l/GN2ESAK0v94AIG+kZU6iPbNZjXtQBUdoki62vRfMtx/PllKagP5B
	Ub7YbdmnuMEml3XToQwpjNQVjbDX4L5FlbLZbqo9oNOjkJ/HfderqoQaTOxm+4VpuohpK2
	9OEY3PzLaElMplO2kFw00RMP7OUR81LvmH11I5TimLb4cnqDr+zI8zXsNQ8cBSqGP4TMcg
	An+t/z8B9RtoM3PsLzi30+7bYgcpb3YRqcrEWfoslbkIrMn7eU+WhpFXiBA8RbTp62AMyk
	lnSnYqqx99nY7pUMjnKisbm4Sjfa6rdzDTeAThlUPq8a8RPb/+VOZ7GZ9F6AdQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717486809;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ejINXpiHP0q2AF/E/7BfniJFbWBIrfNxYm3cOsmKNVU=;
	b=pawYV35x+U5kHhIK8OqpRP2WUY/hcm7tGXDNO/jiDWuY3hR4shcpBVb2SaVJcAfDcWKjHU
	X1tLV6v2wjGlrSkklj92heNdzxz5fq404a4Rb19XdV4lvIU893h1etU+Kv4oskFyPzht70
	jgTqeUNuY03zTDXi7ntHoS8L196xLX2u5Rcxfpuh5PV+X9fCAZDgLjYwU1UroKPd4KhxDt
	DGywHEN1dsDRaKVSx46x836rfM4CFQS0I+ZVj4z7vEyzX6UQ9rCnf+m1w+MDc6Q6t7A8Gx
	dpGH+DFJPMCU5P9P5EARVQ5sl2yj0F4bTxiiDGB8l4/MWFb0QKosOAf9tf1jdw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtjDT0ycvz18xC;
	Tue,  4 Jun 2024 07:40:09 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4547e9OY011463;
	Tue, 4 Jun 2024 07:40:09 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4547e91D011458;
	Tue, 4 Jun 2024 07:40:09 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 07:40:09 GMT
Message-Id: <202406040740.4547e91D011458@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Peter Holm <pho@FreeBSD.org>
Subject: git: 005dd61dd6d6 - main - stress2: Change fixed number
  of test loops to timed loops. This to improve testing with qemu.
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: pho
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 005dd61dd6d64a60bb01c27319cd457302e20aee
Auto-Submitted: auto-generated

The branch main has been updated by pho:

URL: https://cgit.FreeBSD.org/src/commit/?id=005dd61dd6d64a60bb01c27319cd457302e20aee

commit 005dd61dd6d64a60bb01c27319cd457302e20aee
Author:     Peter Holm <pho@FreeBSD.org>
AuthorDate: 2024-06-04 07:39:40 +0000
Commit:     Peter Holm <pho@FreeBSD.org>
CommitDate: 2024-06-04 07:39:40 +0000

    stress2: Change fixed number of test loops to timed loops. This to
    improve testing with qemu.
---
 tools/test/stress2/misc/crossmp.sh          |  3 ++-
 tools/test/stress2/misc/crossmp2.sh         |  3 ++-
 tools/test/stress2/misc/crossmp5.sh         |  5 ++++-
 tools/test/stress2/misc/crossmp6.sh         |  3 ++-
 tools/test/stress2/misc/crossmp7.sh         |  3 ++-
 tools/test/stress2/misc/flock_open_close.sh |  7 +++++--
 tools/test/stress2/misc/gnop2.sh            |  2 ++
 tools/test/stress2/misc/mmap5.sh            | 14 ++++++++------
 tools/test/stress2/misc/procfs.sh           |  3 ++-
 tools/test/stress2/misc/rename3.sh          |  3 ++-
 tools/test/stress2/misc/rename7.sh          |  6 ++++--
 tools/test/stress2/misc/tmpfs2.sh           |  6 ++++--
 tools/test/stress2/misc/umountf4.sh         |  6 ++++--
 tools/test/stress2/misc/umountf6.sh         |  6 ++++--
 tools/test/stress2/misc/vunref.sh           |  3 ++-
 15 files changed, 49 insertions(+), 24 deletions(-)

diff --git a/tools/test/stress2/misc/crossmp.sh b/tools/test/stress2/misc/crossmp.sh
index 0bd07cea2aaf..b61506dcc477 100755
--- a/tools/test/stress2/misc/crossmp.sh
+++ b/tools/test/stress2/misc/crossmp.sh
@@ -74,7 +74,8 @@ else
 	else
 
 		# The test: Parallel mount and unmounts
-		for i in `jot 1024`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			m=$1
 			mount /dev/md${m} ${mntpoint}$m
 			while mount | grep -q "on ${mntpoint}$m "; do
diff --git a/tools/test/stress2/misc/crossmp2.sh b/tools/test/stress2/misc/crossmp2.sh
index 03cd04e077c1..1f2f1a921e10 100755
--- a/tools/test/stress2/misc/crossmp2.sh
+++ b/tools/test/stress2/misc/crossmp2.sh
@@ -67,7 +67,8 @@ else
 	else
 
 		# The test: Parallel mount and unmounts
-		for i in `jot 128`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			m=$1
 			mount -t nfs -o tcp -o nfsv3 -o retrycnt=3 \
 			    -o intr,soft -o rw $nfs_export ${mntpoint}$m
diff --git a/tools/test/stress2/misc/crossmp5.sh b/tools/test/stress2/misc/crossmp5.sh
index b5a8304f2dcb..038dea7ebe4f 100755
--- a/tools/test/stress2/misc/crossmp5.sh
+++ b/tools/test/stress2/misc/crossmp5.sh
@@ -74,8 +74,10 @@ else
 		done
 	else
 		# The test: Parallel mount and unmount
+		i=0
 		m=$1
-		for i in `jot 200`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			mount /dev/md${m} ${mntpoint}$m
 			chmod 777 ${mntpoint}$m
 			l=`jot -r 1 65535`
@@ -88,6 +90,7 @@ else
 				    echo "-f")
 				umount $opt ${mntpoint}$m > /dev/null 2>&1
 			done
+			i=$((i + 1))
 		done
 		rm -f /tmp/crossmp.continue
 	fi
diff --git a/tools/test/stress2/misc/crossmp6.sh b/tools/test/stress2/misc/crossmp6.sh
index 92ca0abcba27..d5abd27f99f1 100755
--- a/tools/test/stress2/misc/crossmp6.sh
+++ b/tools/test/stress2/misc/crossmp6.sh
@@ -72,7 +72,8 @@ if [ $# -eq 0 ]; then
 	exit 0
 else
 	if [ $1 = find ]; then
-		for i in `jot 128`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			find ${mntpoint}* -maxdepth 1 -type f > \
 			    /dev/null 2>&1
 			(lockf  -t 10 ${mntpoint}$2/$0.$$.$i sleep 1 &) > \
diff --git a/tools/test/stress2/misc/crossmp7.sh b/tools/test/stress2/misc/crossmp7.sh
index c2c2752f38e7..f4f12e64c35f 100755
--- a/tools/test/stress2/misc/crossmp7.sh
+++ b/tools/test/stress2/misc/crossmp7.sh
@@ -91,7 +91,8 @@ else
 	else
 		# The test: Parallel mount and unmounts
 		m=$1
-		for i in `jot 1024`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			zfs mount     stress2_tank/test$m
 			zfs umount -f stress2_tank/test$m
 		done 2>/dev/null
diff --git a/tools/test/stress2/misc/flock_open_close.sh b/tools/test/stress2/misc/flock_open_close.sh
index 01e376319abe..39b894da8a63 100755
--- a/tools/test/stress2/misc/flock_open_close.sh
+++ b/tools/test/stress2/misc/flock_open_close.sh
@@ -87,6 +87,7 @@ EOF
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 
 static void
@@ -135,7 +136,8 @@ main(int ac, char **av)
 {
 	struct stat sb;
 	pid_t pid;
-	int e, i, status;
+	time_t start;
+	int e, status;
 
 	if (ac < 2)
 		usage();
@@ -150,7 +152,8 @@ main(int ac, char **av)
 	if (pid == 0)
 		child(av[1]);
 	e = 0;
-	for (i = 0; i < 200000; i++) {
+	start = time(NULL);
+	while (time(NULL) - start < 150) {
 		pid = fork();
 		if (pid < 0)
 			err(1, "vfork");
diff --git a/tools/test/stress2/misc/gnop2.sh b/tools/test/stress2/misc/gnop2.sh
index d38754d58456..0a6b830ce749 100755
--- a/tools/test/stress2/misc/gnop2.sh
+++ b/tools/test/stress2/misc/gnop2.sh
@@ -71,8 +71,10 @@ test() {
 
 gnop status || exit 1
 
+start=`date +%s`
 for i in 1k 2k 4k 8k; do
 	test $i
+	[ $((`date +%s` - start)) -gt 1200 ] && break
 done
 
 [ $notloaded ] && gnop unload
diff --git a/tools/test/stress2/misc/mmap5.sh b/tools/test/stress2/misc/mmap5.sh
index e6dee6d551de..c7369118e0e2 100755
--- a/tools/test/stress2/misc/mmap5.sh
+++ b/tools/test/stress2/misc/mmap5.sh
@@ -52,15 +52,16 @@ rm -f /tmp/mmap5  /tmp/mmap5.inputfile
 exit
 
 EOF
-#include <err.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <sys/param.h>
 #include <sys/fcntl.h>
 #include <sys/mman.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <err.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <time.h>
 #include <unistd.h>
 
 const char *file;
@@ -113,13 +114,14 @@ test(void)
 int
 main(int argc, char *argv[])
 {
-	int i;
+	time_t start;
 
 	if (argc != 2)
 		errx(1, "Usage: %s <file>", argv[0]);
 	file = argv[1];
 
-	for (i = 0; i < 30000; i++) {
+	start = time(NULL);
+	while (time(NULL) - start < 120) {
 		if (fork() == 0)
 			test();
 		wait(NULL);
diff --git a/tools/test/stress2/misc/procfs.sh b/tools/test/stress2/misc/procfs.sh
index 6b445b0d7e48..a59235c6d521 100755
--- a/tools/test/stress2/misc/procfs.sh
+++ b/tools/test/stress2/misc/procfs.sh
@@ -56,7 +56,8 @@ else
 	else
 
 		# The test: Parallel mount and unmounts
-		for i in `jot 128`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			m=$1
 			mount -t procfs proc ${mntpoint}$m
 			while mount | grep -qw $mntpoint$m; do
diff --git a/tools/test/stress2/misc/rename3.sh b/tools/test/stress2/misc/rename3.sh
index c7ce91f0d359..aa4a3754bfab 100755
--- a/tools/test/stress2/misc/rename3.sh
+++ b/tools/test/stress2/misc/rename3.sh
@@ -36,7 +36,8 @@
 # Test scenario by Tor Egge
 
 root=/tmp
-for i in `jot 10000`; do
+start=`date +%s`
+while [ $((`date +%s` - start)) -lt 60 ]; do
 	rm -rf $root/a
 	mkdir -p $root/a/b/c/d/e/f/g
 	mkdir -p $root/a/b/c/d/e/f/z
diff --git a/tools/test/stress2/misc/rename7.sh b/tools/test/stress2/misc/rename7.sh
index 9f6954916411..fdaa8f575117 100755
--- a/tools/test/stress2/misc/rename7.sh
+++ b/tools/test/stress2/misc/rename7.sh
@@ -122,7 +122,8 @@ int
 main(void)
 {
 	pid_t wpid, spid;
-	int e, fd, i, status;
+	time_t start;
+	int e, fd, status;
 
 	if ((wpid = fork()) == 0)
 		r1();
@@ -132,7 +133,8 @@ main(void)
 	setproctitle("main");
 	e = 0;
 
-	for (i = 0; i < 800000; i++) {
+	start = time(NULL);
+	while (time(NULL) - start < 60) {
 		if ((fd = open(logfile, O_RDWR | O_CREAT | O_TRUNC, 0644)) == -1)
 			warn("creat(%s)", logfile);
 		close(fd);
diff --git a/tools/test/stress2/misc/tmpfs2.sh b/tools/test/stress2/misc/tmpfs2.sh
index 80885c331e14..09a2cfd68266 100755
--- a/tools/test/stress2/misc/tmpfs2.sh
+++ b/tools/test/stress2/misc/tmpfs2.sh
@@ -45,13 +45,15 @@ if [ $# -eq 0 ]; then
 
 else
 	if [ $1 = find ]; then
-		for i in `jot 1024`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			find ${mntpoint}* -type f > /dev/null 2>&1
 		done
 	else
 
 		# The test: Parallel mount and unmounts
-		for i in `jot 1024`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			m=$1
 			opt=`[ $(( m % 2 )) -eq 0 ] && echo -f`
 			mount -t tmpfs tmpfs ${mntpoint}$m
diff --git a/tools/test/stress2/misc/umountf4.sh b/tools/test/stress2/misc/umountf4.sh
index 4f5ea0fff660..e26555e7c6f3 100755
--- a/tools/test/stress2/misc/umountf4.sh
+++ b/tools/test/stress2/misc/umountf4.sh
@@ -65,13 +65,15 @@ if [ $# -eq 0 ]; then
 
 else
 	if [ $1 = find ]; then
-		for i in `jot 100`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			find ${mntpoint}* -type f > /dev/null 2>&1
 		done
 	else
 
 		# The test: Parallel mount and unmounts
-		for i in `jot 100`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			m=$1
 			opt=`[ $(( m % 2 )) -eq 0 ] && echo -f`
 			mount $opt /dev/md${m} ${mntpoint}$m
diff --git a/tools/test/stress2/misc/umountf6.sh b/tools/test/stress2/misc/umountf6.sh
index aeb4454ea69c..628342689b38 100755
--- a/tools/test/stress2/misc/umountf6.sh
+++ b/tools/test/stress2/misc/umountf6.sh
@@ -65,13 +65,15 @@ if [ $# -eq 0 ]; then
 
 else
 	if [ $1 = find ]; then
-		for i in `jot 100`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			find ${mntpoint}* -type f > /dev/null 2>&1
 		done
 	else
 
 		# The test: Parallel mount and unmounts
-		for i in `jot 100`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			m=$1
 			opt=`[ $(( m % 2 )) -eq 0 ] && echo -f`
 			mount $opt /dev/md${m} ${mntpoint}$m
diff --git a/tools/test/stress2/misc/vunref.sh b/tools/test/stress2/misc/vunref.sh
index f844a0dd3625..f08035a95694 100755
--- a/tools/test/stress2/misc/vunref.sh
+++ b/tools/test/stress2/misc/vunref.sh
@@ -82,7 +82,8 @@ if [ $# -eq 0 ]; then
 else
 	if [ $1 = mmap ]; then
 		touch $RUNDIR/active.$2
-		for i in `jot 500`; do
+		start=`date +%s`
+		while [ $((`date +%s`- start)) -lt 300 ]; do
 			cd ${mntpoint}$2
 			/tmp/vunref > /dev/null 2>&1
 			cd /

From nobody Tue Jun  4 14:59:32 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VttzT09w0z5Lc8N;
	Tue, 04 Jun 2024 14:59:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VttzS6ndXz4rYS;
	Tue,  4 Jun 2024 14:59:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717513173;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=LbjySI508I3hJBK050O3HTWxnNXFGAbhHKxTcHHtxwM=;
	b=LebOAXhj64q8TlMjPQEsXyOfMXUfM5do7P+4nmI4xOEe+ZnVE01EbEmcxr3zXrDJ07Xu1f
	1UVQFllPulswVrXHLLr5AfhPh1WBKdZPGXrkiALDm+868f8KtCT07Q09vmXfuOqh+AqKSG
	zxFRo01iwVS1RFODCP+nf8tRZEYqUHYjke5ojwdDYYr6MB+w1ktbJjrhD908nrDzgagZTc
	Zyimdca2NG+MK6gc8Dvr1cdf89laOUt6z9IlEDT9POX7EIG5kB8m9jCmq2t0CvwspP/n62
	6iHLhgCPswQ6J2H1li1oQq9ZpIelmdLV5nZBikLraIj5tVxK9gJzzFqwlMGH4g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717513173; a=rsa-sha256; cv=none;
	b=r+JlDWS3JIZsc4KzSL1Y/FfljkKPA2I0s27GTlEFnOzOBAb4gMFHSuj2tZXswaLj4p7kFW
	rxhmzXfzHjJK0P4XclZUI1GVA9ftOhkRhGI+2+sFaxTvbuAbaDD+pq2jsLAdvrf14WRiXN
	oNucjYexVbMGpS6ToywQxhmW0dnlULymI8xx63JCVsRSc4s2pZQKMcjnWCG8KVAY9lyzkB
	U81u4uSLCKKSEjcVRxB+lpyh/sgfLTMNcz9pScUrh+jmhxL23E6PO+RrEZjVEB8V/+iZ2r
	uoe2nCQ1TNfloa4/YEfCwPUKVsZlPPNpP/sC2RqCqaTAnJtHUWvYBqZ8l1siWA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717513172;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=LbjySI508I3hJBK050O3HTWxnNXFGAbhHKxTcHHtxwM=;
	b=R1WwW2QgPswtW9d2TJPHTUNizefDYirWx1oOhbuic1WMh0oKSK4nl1HjR5+c+10BAV876H
	R3clMaphy+HhykZ0nccLnilj4YmYdCZmcsZwrT8DcdilVKK8aQwMCylm+HpfP7XKb8aFuI
	DPy3XNayXsQJb7VWfT5M6SPbQOOr9jdVdNUwagA80SsILgTCRXdr2Ve7luh1eSBM6gDyWZ
	RScp+Ll6lDDyvXsepUhnpW8pc9nqHFzjcT80NPByBMbgXSA7G2vkV2d2jT2krUksUcVQrY
	ls8GtwtWAhZP8udMyNz005Jtr0RQ7oI7UmB+L8EGDPuNFlU1nd67E+tVC6I7rw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VttzS6GfWzMrG;
	Tue,  4 Jun 2024 14:59:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454ExWCI050050;
	Tue, 4 Jun 2024 14:59:32 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454ExWwo050047;
	Tue, 4 Jun 2024 14:59:32 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 14:59:32 GMT
Message-Id: <202406041459.454ExWwo050047@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 9dbbe68bc5f2 - main - pf: convert DIOCCLRSTATUS to
  netlink
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 9dbbe68bc5f25e238125f4c6b329b922eaf8d5eb
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=9dbbe68bc5f25e238125f4c6b329b922eaf8d5eb

commit 9dbbe68bc5f25e238125f4c6b329b922eaf8d5eb
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-05-30 17:31:26 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 12:59:58 +0000

    pf: convert DIOCCLRSTATUS to netlink
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 lib/libpfctl/libpfctl.c   | 60 +++++++++++++++++++++++++++--------------------
 lib/libpfctl/libpfctl.h   |  1 +
 sbin/pfctl/pfctl.c        | 10 ++++----
 sys/net/pfvar.h           |  1 +
 sys/netpfil/pf/pf_ioctl.c | 32 +++++++++++++++----------
 sys/netpfil/pf/pf_nl.c    | 15 ++++++++++++
 sys/netpfil/pf/pf_nl.h    |  1 +
 7 files changed, 77 insertions(+), 43 deletions(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index e833a23b269a..771097a33dab 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -108,6 +108,35 @@ pfctl_fd(struct pfctl_handle *h)
 	return (h->fd);
 }
 
+static int
+pfctl_do_netlink_cmd(struct pfctl_handle *h, uint cmd)
+{
+	struct snl_errmsg_data e = {};
+	struct snl_writer nw;
+	struct nlmsghdr *hdr;
+	uint32_t seq_id;
+	int family_id;
+
+	family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME);
+	if (family_id == 0)
+		return (ENOTSUP);
+
+	snl_init_writer(&h->ss, &nw);
+	hdr = snl_create_genl_msg_request(&nw, family_id, cmd);
+
+	hdr = snl_finalize_msg(&nw);
+	if (hdr == NULL)
+		return (ENOMEM);
+	seq_id = hdr->nlmsg_seq;
+
+	snl_send_message(&h->ss, hdr);
+
+	while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) {
+	}
+
+	return (e.error);
+}
+
 static int
 pfctl_do_ioctl(int dev, uint cmd, size_t size, nvlist_t **nvl)
 {
@@ -229,31 +258,7 @@ pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems,
 int
 pfctl_startstop(struct pfctl_handle *h, int start)
 {
-	struct snl_errmsg_data e = {};
-	struct snl_writer nw;
-	struct nlmsghdr *hdr;
-	uint32_t seq_id;
-	int family_id;
-
-	family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME);
-	if (family_id == 0)
-		return (ENOTSUP);
-
-	snl_init_writer(&h->ss, &nw);
-	hdr = snl_create_genl_msg_request(&nw, family_id,
-	    start ? PFNL_CMD_START : PFNL_CMD_STOP);
-
-	hdr = snl_finalize_msg(&nw);
-	if (hdr == NULL)
-		return (ENOMEM);
-	seq_id = hdr->nlmsg_seq;
-
-	snl_send_message(&h->ss, hdr);
-
-	while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) {
-	}
-
-	return (e.error);
+	return (pfctl_do_netlink_cmd(h, start ? PFNL_CMD_START : PFNL_CMD_STOP));
 }
 
 static void
@@ -487,6 +492,11 @@ pfctl_get_status(int dev)
 
 	return (status);
 }
+int
+pfctl_clear_status(struct pfctl_handle *h)
+{
+	return (pfctl_do_netlink_cmd(h, PFNL_CMD_CLEAR_STATUS));
+}
 
 static uint64_t
 _pfctl_status_counter(struct pfctl_status_counters *counters, uint64_t id)
diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h
index 391e73b61e02..e130fe0fe842 100644
--- a/lib/libpfctl/libpfctl.h
+++ b/lib/libpfctl/libpfctl.h
@@ -395,6 +395,7 @@ int	pfctl_fd(struct pfctl_handle *);
 int	pfctl_startstop(struct pfctl_handle *h, int start);
 struct pfctl_status* pfctl_get_status_h(struct pfctl_handle *h);
 struct pfctl_status* pfctl_get_status(int dev);
+int	pfctl_clear_status(struct pfctl_handle *h);
 uint64_t pfctl_status_counter(struct pfctl_status *status, int id);
 uint64_t pfctl_status_lcounter(struct pfctl_status *status, int id);
 uint64_t pfctl_status_fcounter(struct pfctl_status *status, int id);
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index c43d9e88dcbe..08c3d5c98321 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -66,7 +66,7 @@
 void	 usage(void);
 int	 pfctl_enable(int, int);
 int	 pfctl_disable(int, int);
-int	 pfctl_clear_stats(int, int);
+int	 pfctl_clear_stats(struct pfctl_handle *, int);
 int	 pfctl_get_skip_ifaces(void);
 int	 pfctl_check_skip_ifaces(char *);
 int	 pfctl_adjust_skip_ifaces(struct pfctl *);
@@ -353,9 +353,9 @@ pfctl_disable(int dev, int opts)
 }
 
 int
-pfctl_clear_stats(int dev, int opts)
+pfctl_clear_stats(struct pfctl_handle *h, int opts)
 {
-	if (ioctl(dev, DIOCCLRSTATUS))
+	if (pfctl_clear_status(h))
 		err(1, "DIOCCLRSTATUS");
 	if ((opts & PF_OPT_QUIET) == 0)
 		fprintf(stderr, "pf: statistics cleared\n");
@@ -3237,7 +3237,7 @@ main(int argc, char *argv[])
 			pfctl_clear_src_nodes(dev, opts);
 			break;
 		case 'i':
-			pfctl_clear_stats(dev, opts);
+			pfctl_clear_stats(pfh, opts);
 			break;
 		case 'a':
 			pfctl_flush_eth_rules(dev, opts, anchorname);
@@ -3248,7 +3248,7 @@ main(int argc, char *argv[])
 				pfctl_clear_altq(dev, opts);
 				pfctl_clear_iface_states(dev, ifaceopt, opts);
 				pfctl_clear_src_nodes(dev, opts);
-				pfctl_clear_stats(dev, opts);
+				pfctl_clear_stats(pfh, opts);
 				pfctl_clear_fingerprints(dev, opts);
 				pfctl_clear_interface_flags(dev, opts);
 			}
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index d1aa57a941cc..0ea4741f8937 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -2502,6 +2502,7 @@ int			 pf_ioctl_getrules(struct pfioc_rule *);
 int			 pf_ioctl_addrule(struct pf_krule *, uint32_t,
 			    uint32_t, const char *, const char *, uid_t uid,
 			    pid_t);
+void			 pf_ioctl_clear_status(void);
 
 void			 pf_krule_free(struct pf_krule *);
 void			 pf_krule_clear_counters(struct pf_krule *);
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 1b22d49a6255..be5e38664a76 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -2424,6 +2424,24 @@ pf_stop(void)
 	return (error);
 }
 
+void
+pf_ioctl_clear_status(void)
+{
+	PF_RULES_WLOCK();
+	for (int i = 0; i < PFRES_MAX; i++)
+		counter_u64_zero(V_pf_status.counters[i]);
+	for (int i = 0; i < FCNT_MAX; i++)
+		pf_counter_u64_zero(&V_pf_status.fcounters[i]);
+	for (int i = 0; i < SCNT_MAX; i++)
+		counter_u64_zero(V_pf_status.scounters[i]);
+	for (int i = 0; i < KLCNT_MAX; i++)
+		counter_u64_zero(V_pf_status.lcounters[i]);
+	V_pf_status.since = time_second;
+	if (*V_pf_status.ifname)
+		pfi_update_status(V_pf_status.ifname, NULL);
+	PF_RULES_WUNLOCK();
+}
+
 static int
 pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
 {
@@ -3765,19 +3783,7 @@ DIOCGETSTATESV2_full:
 	}
 
 	case DIOCCLRSTATUS: {
-		PF_RULES_WLOCK();
-		for (int i = 0; i < PFRES_MAX; i++)
-			counter_u64_zero(V_pf_status.counters[i]);
-		for (int i = 0; i < FCNT_MAX; i++)
-			pf_counter_u64_zero(&V_pf_status.fcounters[i]);
-		for (int i = 0; i < SCNT_MAX; i++)
-			counter_u64_zero(V_pf_status.scounters[i]);
-		for (int i = 0; i < KLCNT_MAX; i++)
-			counter_u64_zero(V_pf_status.lcounters[i]);
-		V_pf_status.since = time_second;
-		if (*V_pf_status.ifname)
-			pfi_update_status(V_pf_status.ifname, NULL);
-		PF_RULES_WUNLOCK();
+		pf_ioctl_clear_status();
 		break;
 	}
 
diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index 8f0349d6f121..67a785e54d6f 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -1214,6 +1214,14 @@ out:
 	return (error);
 }
 
+static int
+pf_handle_clear_status(struct nlmsghdr *hdr, struct nl_pstate *npt)
+{
+	pf_ioctl_clear_status();
+
+	return (0);
+}
+
 static const struct nlhdr_parser *all_parsers[] = {
 	&state_parser,
 	&addrule_parser,
@@ -1302,6 +1310,13 @@ static const struct genl_cmd pf_cmds[] = {
 		.cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL,
 		.cmd_priv = PRIV_NETINET_PF,
 	},
+	{
+		.cmd_num = PFNL_CMD_CLEAR_STATUS,
+		.cmd_name = "CLEARSTATUS",
+		.cmd_cb = pf_handle_clear_status,
+		.cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL,
+		.cmd_priv = PRIV_NETINET_PF,
+	},
 };
 
 void
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
index e486e9781b2e..10440eaf6366 100644
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -47,6 +47,7 @@ enum {
 	PFNL_CMD_KILLSTATES = 9,
 	PFNL_CMD_SET_STATUSIF = 10,
 	PFNL_CMD_GET_STATUS = 11,
+	PFNL_CMD_CLEAR_STATUS = 12,
 	__PFNL_CMD_MAX,
 };
 #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1)

From nobody Tue Jun  4 14:59:33 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VttzV1rSfz5Lc4G;
	Tue, 04 Jun 2024 14:59:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VttzV0JFBz4rJJ;
	Tue,  4 Jun 2024 14:59:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717513174;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ABK02C1J9ExuoWlJdRvVLCM92pgMssJnn4Kl/W7IriA=;
	b=TMiLcSAN+X4B8tJh83LaF9WV82SyModPbhF0m7f4+BXuDLoRNMypSitHMsShZNVUcMk3CG
	+OtvSJXifAh6JYDjHTQFuXF69+yYiTG5IQ/CgliTI9omdDr3pp7MxSfGUBwNlwOBccXfp5
	LWx+7G0QZQGVqDyJaH8PRHWDatV4Bmuk+m8KvW9dbxVR4QWOslSXTAiUeJ0AlHcG1z3rmg
	n7P8qywqmbNG3FeFBljk/W4g31LR0pes1SgdXBuLxViOMvDs3TQ345PBmFtsOQqGkZPgAy
	1xsG1DZxyf6WocKsIyqq30nXA7kbSOAuOwnxXhesBoo0lQdkl/PLkmQQtRiAqw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717513174; a=rsa-sha256; cv=none;
	b=a2g/vSPFiRRKFs3aburofOc3/vSGZoxlcoOulmrydlyig23hEkz6QrdYpGiiDoRKZOHec4
	QcuWpmaqs+Ee9LIOOOVtmj4Fwd5Rxzo95B6TpiGyNFYWalJbUV7eYNiv0MMHtW45Rw5D1r
	tLmEeEh8T03Ui0ZjDAM7ZKT3mrMfpXos2OnZ4ZhBtdAKvqZMoxAixruxrgpBwdAikfYsbN
	EgCopP/uro73thcFfZ7Rrrw2I/qJaXdiM4OrHfC8Yy8Zm87r6NfG5IdSLo6khxy47JfVPg
	kT4njufMhzxlKzoGQCRZ3WTJNYPQFv2b5y3gqpULRuKup+oa9ckSnSM/pOBcXw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717513174;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ABK02C1J9ExuoWlJdRvVLCM92pgMssJnn4Kl/W7IriA=;
	b=SV0O+C4QOzyJm5eq44Wj/PFHDsGBgbkxvp3SCz57ZlXnV7pwjgCDyIL4MygLHl+13h+1qf
	+zPcMFb9xYyL9zbcXQA2D5lIG0jdLFo9ByjGkujbPsEdoFcm3OmMONinQsidL4VZrFeu0Y
	Q57wNIhx+A9P0YgQZ4FCbUCoQHoziPP8xHGux6BJZuoAtTt903PaI4ZzkyDOMCS7zfTzRx
	Jrpk6INvI1jAeq1Ah2m91L3AW6B3oNQFDyJBXU8gdlg5YVnd0/uQALEwMIpkBSCO0RhOgD
	Gl+vnJYn9ZvRMaDkKbt/s52yZ8lQ6Gf60QWyuh1y3cDC7FFMrqQWFfUrMfExUw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VttzT719DzNBK;
	Tue,  4 Jun 2024 14:59:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454ExX2D050096;
	Tue, 4 Jun 2024 14:59:33 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454ExXfN050093;
	Tue, 4 Jun 2024 14:59:33 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 14:59:33 GMT
Message-Id: <202406041459.454ExXfN050093@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: a9d7ff4e5e6d - main - pf tests: basic status get/clear
  test
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: a9d7ff4e5e6d37ace0f9bf1c2344e00cb8182c83
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=a9d7ff4e5e6d37ace0f9bf1c2344e00cb8182c83

commit a9d7ff4e5e6d37ace0f9bf1c2344e00cb8182c83
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-05-30 18:28:30 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 12:59:58 +0000

    pf tests: basic status get/clear test
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/Makefile  |  1 +
 tests/sys/netpfil/pf/status.sh | 73 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile
index 867b98e5f6c2..5c0e43cbbf23 100644
--- a/tests/sys/netpfil/pf/Makefile
+++ b/tests/sys/netpfil/pf/Makefile
@@ -41,6 +41,7 @@ ATF_TESTS_SH+=	altq \
 		set_skip \
 		set_tos \
 		src_track \
+		status \
 		syncookie \
 		synproxy \
 		table \
diff --git a/tests/sys/netpfil/pf/status.sh b/tests/sys/netpfil/pf/status.sh
new file mode 100644
index 000000000000..bfd916a40c01
--- /dev/null
+++ b/tests/sys/netpfil/pf/status.sh
@@ -0,0 +1,73 @@
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2024 Rubicon Communications, LLC (Netgate)
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "basic" "cleanup"
+basic_head()
+{
+	atf_set descr 'Basic get/clear status test case'
+	atf_set require.user root
+}
+
+basic_body()
+{
+	pft_init
+
+	epair=$(vnet_mkepair)
+
+	vnet_mkjail one ${epair}a
+	jexec one ifconfig ${epair}a 192.0.2.1/24 up
+	vnet_mkjail two ${epair}b
+	jexec two ifconfig ${epair}b 192.0.2.2/24 up
+
+	jexec one pfctl -e
+	pft_set_rules one "pass"
+
+	# Sanity check
+	atf_check -s exit:0 -o ignore \
+	    jexec two ping -c 1 192.0.2.1
+
+	atf_check -s exit:0 -o not-match:'searches[[:space:]]+0' \
+	    jexec one pfctl -si
+
+	atf_check -s exit:0 -o ignore -e ignore \
+	    jexec one pfctl -Fi
+
+	atf_check -s exit:0 -o match:'searches[[:space:]]+0' \
+	    jexec one pfctl -si
+}
+
+basic_cleanup()
+{
+	pft_cleanup
+}
+
+atf_init_test_cases()
+{
+	atf_add_test_case "basic"
+}
+

From nobody Tue Jun  4 14:59:35 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VttzW2zrzz5Lc8W;
	Tue, 04 Jun 2024 14:59:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VttzW13Wtz4rT3;
	Tue,  4 Jun 2024 14:59:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717513175;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3DCVV8BJp3Q1RYMElDIXCwEIzK1VIZI9/2Td2lb86Lk=;
	b=iZCKsadCFdNbVIJVx0XQs4gRBWhlK8tNCCFJdb3M58RddUv2os2csNY5xh06o9yFnT5BXX
	jpOQmq//pxTx6Uvs7JkCX8uYEZ5Ok14xKRlq8br+P1yVCP9yEooZq9o3TKQcbVRcTAHx42
	+tp+FdCeCiTuDsK+Wq7WggLD62l3XAivtYGmPSXnnh9wOFPDEla99bVsoDuctgLI3lyI8h
	faSctnzkI3k3PEDk4FFtbg9PDd2WjAZpsEcoQndlco24B77B02xyWje4BDfo6oeC3OzG98
	MGcdXZMGBewIR2fy7c/+Xli3/xV+DrGHN7DZQ6EBzVBilAJC7mwqXaxRNV5ZhA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717513175; a=rsa-sha256; cv=none;
	b=nwmRepL0MQxAryGFPWljHK9d0hgWzq/OsZ9N4g/bDlbZRfF0ZFVS+iaK7PFZ3J0+NaqXf3
	XFoAo4wOhsYjMbEqENctBZI6MOpUcW5UIjeCrS6uV51h7RKWKoUdjVwj1FkTS4/FPZ+0rR
	jT15lzxniyvvXwO8pxXrLFTlSHcYVc+z3QGe0H80Es4AtXg6Oy/E2lhYeXbF8/JppYi5W9
	WkQGGHBeyBl148YQDMfElMtw1dKD/OeuvT7xwetzIwW4TKBd9S+fqAErg9iXB+kMtOXCwF
	TIvgq37QZBmHhGSGE9sMo51v43cbLNmB78tBfjP19lL7N1ewNOcq2OXwZlRR1g==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717513175;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3DCVV8BJp3Q1RYMElDIXCwEIzK1VIZI9/2Td2lb86Lk=;
	b=O0b4UuDUyiTVHztx/M7pyyF6HOy/uSitcb25bK73DJLM7UdSKSmlT3gsrBibAi+6v/HGlK
	UjB8tZwimHiYEvdux1l2aqs7N7h7HtN1VWNa/RwcDUBekR1CNEgmT/M+Yksel/RYfzBsoF
	gzg3UNhdCQSf830qRjt6b4u8h15IfYC8lyDcaC1TzA+SVXqGbYUI5kXn0BWzBu4ycpyIZw
	0zxxr1YQBgngXPpXa12rwJ8Gml7RkUIiZKGarMsr8y1Rrg9x0U0EE7Vnfmi0/WE5XpCPX8
	TMsS4oFKztw/UxKlgp43nJnkFn2qD0/I+9b6OsxQFTOcM6O/AHuD12g4OPkSdA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VttzW0fVvzNQW;
	Tue,  4 Jun 2024 14:59:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454ExZvj050138;
	Tue, 4 Jun 2024 14:59:35 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454ExZPI050135;
	Tue, 4 Jun 2024 14:59:35 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 14:59:35 GMT
Message-Id: <202406041459.454ExZPI050135@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 71d3c7041d70 - main - pf: convert DIOCNATLOOK to
  netlink
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 71d3c7041d7021ae15ff3b366b6cba9e4190283e
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=71d3c7041d7021ae15ff3b366b6cba9e4190283e

commit 71d3c7041d7021ae15ff3b366b6cba9e4190283e
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-05-31 13:51:38 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 12:59:58 +0000

    pf: convert DIOCNATLOOK to netlink
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 contrib/pf/ftp-proxy/filter.c  |  62 ++++++++++++------------
 contrib/pf/tftp-proxy/filter.c |  56 +++++++++++-----------
 lib/libpfctl/libpfctl.c        |  55 +++++++++++++++++++++
 lib/libpfctl/libpfctl.h        |  18 +++++++
 sys/netpfil/pf/pf_nl.c         | 106 +++++++++++++++++++++++++++++++++++++++++
 sys/netpfil/pf/pf_nl.h         |  12 +++++
 6 files changed, 250 insertions(+), 59 deletions(-)

diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c
index 7893be97f9b2..e3276f88489e 100644
--- a/contrib/pf/ftp-proxy/filter.c
+++ b/contrib/pf/ftp-proxy/filter.c
@@ -352,27 +352,27 @@ int
 server_lookup4(struct sockaddr_in *client, struct sockaddr_in *proxy,
     struct sockaddr_in *server)
 {
-	struct pfioc_natlook pnl;
-
-	memset(&pnl, 0, sizeof pnl);
-	pnl.direction = PF_OUT;
-	pnl.af = AF_INET;
-	pnl.proto = IPPROTO_TCP;
-	memcpy(&pnl.saddr.v4, &client->sin_addr.s_addr, sizeof pnl.saddr.v4);
-	memcpy(&pnl.daddr.v4, &proxy->sin_addr.s_addr, sizeof pnl.daddr.v4);
-	pnl.sport = client->sin_port;
-	pnl.dport = proxy->sin_port;
-	
-	if (ioctl(pfctl_fd(pfh), DIOCNATLOOK, &pnl) == -1)
+	struct pfctl_natlook_key k = {};
+	struct pfctl_natlook r = {};
+
+	k.direction = PF_OUT;
+	k.af = AF_INET;
+	k.proto = IPPROTO_TCP;
+	memcpy(&k.saddr.v4, &client->sin_addr.s_addr, sizeof(k.saddr.v4));
+	memcpy(&k.daddr.v4, &proxy->sin_addr.s_addr, sizeof(k.daddr.v4));
+	k.sport = client->sin_port;
+	k.dport = proxy->sin_port;
+
+	if (pfctl_natlook(pfh, &k, &r))
 		return (-1);
 
 	memset(server, 0, sizeof(struct sockaddr_in));
 	server->sin_len = sizeof(struct sockaddr_in);
 	server->sin_family = AF_INET;
-	memcpy(&server->sin_addr.s_addr, &pnl.rdaddr.v4,
-	    sizeof server->sin_addr.s_addr);
-	server->sin_port = pnl.rdport;
-		
+	memcpy(&server->sin_addr.s_addr, &r.daddr.v4,
+	    sizeof(server->sin_addr.s_addr));
+	server->sin_port = r.dport;
+
 	return (0);
 }
 
@@ -380,26 +380,26 @@ int
 server_lookup6(struct sockaddr_in6 *client, struct sockaddr_in6 *proxy,
     struct sockaddr_in6 *server)
 {
-	struct pfioc_natlook pnl;
-
-	memset(&pnl, 0, sizeof pnl);
-	pnl.direction = PF_OUT;
-	pnl.af = AF_INET6;
-	pnl.proto = IPPROTO_TCP;
-	memcpy(&pnl.saddr.v6, &client->sin6_addr.s6_addr, sizeof pnl.saddr.v6);
-	memcpy(&pnl.daddr.v6, &proxy->sin6_addr.s6_addr, sizeof pnl.daddr.v6);
-	pnl.sport = client->sin6_port;
-	pnl.dport = proxy->sin6_port;
-	
-	if (ioctl(pfctl_fd(pfh), DIOCNATLOOK, &pnl) == -1)
+	struct pfctl_natlook_key k = {};
+	struct pfctl_natlook r = {};
+
+	k.direction = PF_OUT;
+	k.af = AF_INET6;
+	k.proto = IPPROTO_TCP;
+	memcpy(&k.saddr.v6, &client->sin6_addr.s6_addr, sizeof(k.saddr.v6));
+	memcpy(&k.daddr.v6, &proxy->sin6_addr.s6_addr, sizeof(k.daddr.v6));
+	k.sport = client->sin6_port;
+	k.dport = proxy->sin6_port;
+
+	if (pfctl_natlook(pfh, &k, &r))
 		return (-1);
 
 	memset(server, 0, sizeof(struct sockaddr_in6));
 	server->sin6_len = sizeof(struct sockaddr_in6);
 	server->sin6_family = AF_INET6;
-	memcpy(&server->sin6_addr.s6_addr, &pnl.rdaddr.v6,
-	    sizeof server->sin6_addr);
-	server->sin6_port = pnl.rdport;
+	memcpy(&server->sin6_addr.s6_addr, &r.daddr.v6,
+	    sizeof(server->sin6_addr));
+	server->sin6_port = r.dport;
 
 	return (0);
 }
diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c
index 1e6d54303996..3cf2e1fcf3ab 100644
--- a/contrib/pf/tftp-proxy/filter.c
+++ b/contrib/pf/tftp-proxy/filter.c
@@ -363,26 +363,26 @@ int
 server_lookup4(struct sockaddr_in *client, struct sockaddr_in *proxy,
     struct sockaddr_in *server, u_int8_t proto)
 {
-	struct pfioc_natlook pnl;
-
-	memset(&pnl, 0, sizeof pnl);
-	pnl.direction = PF_OUT;
-	pnl.af = AF_INET;
-	pnl.proto = proto;
-	memcpy(&pnl.saddr.v4, &client->sin_addr.s_addr, sizeof pnl.saddr.v4);
-	memcpy(&pnl.daddr.v4, &proxy->sin_addr.s_addr, sizeof pnl.daddr.v4);
-	pnl.sport = client->sin_port;
-	pnl.dport = proxy->sin_port;
-
-	if (ioctl(pfctl_fd(pfh), DIOCNATLOOK, &pnl) == -1)
+	struct pfctl_natlook_key k = {};
+	struct pfctl_natlook r = {};
+
+	k.direction = PF_OUT;
+	k.af = AF_INET;
+	k.proto = proto;
+	memcpy(&k.saddr.v4, &client->sin_addr.s_addr, sizeof(k.saddr.v4));
+	memcpy(&k.daddr.v4, &proxy->sin_addr.s_addr, sizeof(k.daddr.v4));
+	k.sport = client->sin_port;
+	k.dport = proxy->sin_port;
+
+	if (pfctl_natlook(pfh, &k, &r))
 		return (-1);
 
 	memset(server, 0, sizeof(struct sockaddr_in));
 	server->sin_len = sizeof(struct sockaddr_in);
 	server->sin_family = AF_INET;
-	memcpy(&server->sin_addr.s_addr, &pnl.rdaddr.v4,
+	memcpy(&server->sin_addr.s_addr, &r.daddr.v4,
 	    sizeof server->sin_addr.s_addr);
-	server->sin_port = pnl.rdport;
+	server->sin_port = r.dport;
 
 	return (0);
 }
@@ -391,26 +391,26 @@ int
 server_lookup6(struct sockaddr_in6 *client, struct sockaddr_in6 *proxy,
     struct sockaddr_in6 *server, u_int8_t proto)
 {
-	struct pfioc_natlook pnl;
-
-	memset(&pnl, 0, sizeof pnl);
-	pnl.direction = PF_OUT;
-	pnl.af = AF_INET6;
-	pnl.proto = proto;
-	memcpy(&pnl.saddr.v6, &client->sin6_addr.s6_addr, sizeof pnl.saddr.v6);
-	memcpy(&pnl.daddr.v6, &proxy->sin6_addr.s6_addr, sizeof pnl.daddr.v6);
-	pnl.sport = client->sin6_port;
-	pnl.dport = proxy->sin6_port;
-	
-	if (ioctl(pfctl_fd(pfh), DIOCNATLOOK, &pnl) == -1)
+	struct pfctl_natlook_key k = {};
+	struct pfctl_natlook r = {};
+
+	k.direction = PF_OUT;
+	k.af = AF_INET6;
+	k.proto = proto;
+	memcpy(&k.saddr.v6, &client->sin6_addr.s6_addr, sizeof k.saddr.v6);
+	memcpy(&k.daddr.v6, &proxy->sin6_addr.s6_addr, sizeof k.daddr.v6);
+	k.sport = client->sin6_port;
+	k.dport = proxy->sin6_port;
+
+	if (pfctl_natlook(pfh, &k, &r))
 		return (-1);
 
 	memset(server, 0, sizeof(struct sockaddr_in6));
 	server->sin6_len = sizeof(struct sockaddr_in6);
 	server->sin6_family = AF_INET6;
-	memcpy(&server->sin6_addr.s6_addr, &pnl.rdaddr.v6,
+	memcpy(&server->sin6_addr.s6_addr, &r.daddr.v6,
 	    sizeof server->sin6_addr);
-	server->sin6_port = pnl.rdport;
+	server->sin6_port = r.dport;
 
 	return (0);
 }
diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 771097a33dab..d5cd6c4bda60 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -2435,3 +2435,58 @@ pfctl_set_statusif(struct pfctl_handle *h, const char *ifname)
 
 	return (e.error);
 }
+
+#define	_IN(_field)	offsetof(struct genlmsghdr, _field)
+#define	_OUT(_field)	offsetof(struct pfctl_natlook, _field)
+static struct snl_attr_parser ap_natlook[] = {
+	{ .type = PF_NL_SRC_ADDR, .off = _OUT(saddr), .cb = snl_attr_get_in6_addr },
+	{ .type = PF_NL_DST_ADDR, .off = _OUT(daddr), .cb = snl_attr_get_in6_addr },
+	{ .type = PF_NL_SRC_PORT, .off = _OUT(sport), .cb = snl_attr_get_uint16 },
+	{ .type = PF_NL_DST_PORT, .off = _OUT(dport), .cb = snl_attr_get_uint16 },
+};
+static struct snl_field_parser fp_natlook[] = {};
+#undef _IN
+#undef _OUT
+SNL_DECLARE_PARSER(natlook_parser, struct genlmsghdr, fp_natlook, ap_natlook);
+
+int
+pfctl_natlook(struct pfctl_handle *h, const struct pfctl_natlook_key *k,
+    struct pfctl_natlook *r)
+{
+	struct snl_writer nw;
+	struct snl_errmsg_data e = {};
+	struct nlmsghdr *hdr;
+	uint32_t seq_id;
+	int family_id;
+
+	family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME);
+	if (family_id == 0)
+		return (ENOTSUP);
+
+	snl_init_writer(&h->ss, &nw);
+	hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_NATLOOK);
+	hdr->nlmsg_flags |= NLM_F_DUMP;
+
+	snl_add_msg_attr_u8(&nw, PF_NL_AF, k->af);
+	snl_add_msg_attr_u8(&nw, PF_NL_DIRECTION, k->direction);
+	snl_add_msg_attr_u8(&nw, PF_NL_PROTO, k->proto);
+	snl_add_msg_attr_ip6(&nw, PF_NL_SRC_ADDR, &k->saddr.v6);
+	snl_add_msg_attr_ip6(&nw, PF_NL_DST_ADDR, &k->daddr.v6);
+	snl_add_msg_attr_u16(&nw, PF_NL_SRC_PORT, k->sport);
+	snl_add_msg_attr_u16(&nw, PF_NL_DST_PORT, k->dport);
+
+	if ((hdr = snl_finalize_msg(&nw)) == NULL)
+		return (ENXIO);
+
+	seq_id = hdr->nlmsg_seq;
+
+	if (! snl_send_message(&h->ss, hdr))
+		return (ENXIO);
+
+	while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) {
+		if (! snl_parse_nlmsg(&h->ss, hdr, &natlook_parser, r))
+			continue;
+	}
+
+	return (e.error);
+}
diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h
index e130fe0fe842..e7625252638c 100644
--- a/lib/libpfctl/libpfctl.h
+++ b/lib/libpfctl/libpfctl.h
@@ -475,4 +475,22 @@ int	pfctl_table_get_addrs(int dev, struct pfr_table *tbl, struct pfr_addr
 	    *addr, int *size, int flags);
 int	pfctl_set_statusif(struct pfctl_handle *h, const char *ifname);
 
+struct pfctl_natlook_key {
+	sa_family_t af;
+	uint8_t direction;
+	uint8_t proto;
+	struct pf_addr saddr;
+	struct pf_addr daddr;
+	uint16_t sport;
+	uint16_t dport;
+};
+struct pfctl_natlook {
+	struct pf_addr saddr;
+	struct pf_addr daddr;
+	uint16_t sport;
+	uint16_t dport;
+};
+int	pfctl_natlook(struct pfctl_handle *h,
+	    const struct pfctl_natlook_key *k, struct pfctl_natlook *r);
+
 #endif
diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index 67a785e54d6f..b9dc7358ae28 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -26,6 +26,9 @@
  * SUCH DAMAGE.
  *
  */
+#include <sys/cdefs.h>
+#include "opt_inet.h"
+#include "opt_inet6.h"
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -1222,12 +1225,108 @@ pf_handle_clear_status(struct nlmsghdr *hdr, struct nl_pstate *npt)
 	return (0);
 }
 
+struct pf_nl_natlook {
+	sa_family_t af;
+	uint8_t direction;
+	uint8_t proto;
+	struct pf_addr src;
+	struct pf_addr dst;
+	uint16_t sport;
+	uint16_t dport;
+};
+
+#define	_IN(_field)	offsetof(struct genlmsghdr, _field)
+#define	_OUT(_field)	offsetof(struct pf_nl_natlook, _field)
+static const struct nlattr_parser nla_p_natlook[] = {
+	{ .type = PF_NL_AF, .off = _OUT(af), .cb = nlattr_get_uint8 },
+	{ .type = PF_NL_DIRECTION, .off = _OUT(direction), .cb = nlattr_get_uint8 },
+	{ .type = PF_NL_PROTO, .off = _OUT(proto), .cb = nlattr_get_uint8 },
+	{ .type = PF_NL_SRC_ADDR, .off = _OUT(src), .cb = nlattr_get_in6_addr },
+	{ .type = PF_NL_DST_ADDR, .off = _OUT(dst), .cb = nlattr_get_in6_addr },
+	{ .type = PF_NL_SRC_PORT, .off = _OUT(sport), .cb = nlattr_get_uint16 },
+	{ .type = PF_NL_DST_PORT, .off = _OUT(dport), .cb = nlattr_get_uint16 },
+};
+static const struct nlfield_parser nlf_p_natlook[] = {};
+#undef _IN
+#undef _OUT
+NL_DECLARE_PARSER(natlook_parser, struct genlmsghdr, nlf_p_natlook, nla_p_natlook);
+
+static int
+pf_handle_natlook(struct nlmsghdr *hdr, struct nl_pstate *npt)
+{
+	struct pf_nl_natlook	 attrs = {};
+	struct pf_state_key_cmp	 key = {};
+	struct nl_writer	*nw = npt->nw;
+	struct pf_state_key	*sk;
+	struct pf_kstate	*state;
+	struct genlmsghdr	*ghdr_new;
+	int			 error, m;
+	int			 sidx, didx;
+
+	error = nl_parse_nlmsg(hdr, &natlook_parser, npt, &attrs);
+	if (error != 0)
+		return (error);
+
+	if (attrs.proto == 0 ||
+	    PF_AZERO(&attrs.src, attrs.af) ||
+	    PF_AZERO(&attrs.dst, attrs.af) ||
+	    ((attrs.proto == IPPROTO_TCP || attrs.proto == IPPROTO_UDP) &&
+	     (attrs.sport == 0 || attrs.dport == 0)))
+		return (EINVAL);
+
+	/* NATLOOK src and dst are reversed, so reverse sidx/didx */
+	sidx = (attrs.direction == PF_IN) ? 1 : 0;
+	didx = (attrs.direction == PF_IN) ? 0 : 1;
+
+	key.af = attrs.af;
+	key.proto = attrs.proto;
+	PF_ACPY(&key.addr[sidx], &attrs.src, attrs.af);
+	key.port[sidx] = attrs.sport;
+	PF_ACPY(&key.addr[didx], &attrs.dst, attrs.af);
+	key.port[didx] = attrs.dport;
+
+	state = pf_find_state_all(&key, attrs.direction, &m);
+	if (state == NULL)
+		return (ENOENT);
+	if (m > 1) {
+		PF_STATE_UNLOCK(state);
+		return (E2BIG);
+	}
+
+	if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) {
+		PF_STATE_UNLOCK(state);
+		return (ENOMEM);
+	}
+
+	ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr);
+	ghdr_new->cmd = PFNL_CMD_NATLOOK;
+	ghdr_new->version = 0;
+	ghdr_new->reserved = 0;
+
+	sk = state->key[sidx];
+
+	nlattr_add_in6_addr(nw, PF_NL_SRC_ADDR, &sk->addr[sidx].v6);
+	nlattr_add_in6_addr(nw, PF_NL_DST_ADDR, &sk->addr[didx].v6);
+	nlattr_add_u16(nw, PF_NL_SRC_PORT, sk->port[sidx]);
+	nlattr_add_u16(nw, PF_NL_DST_PORT, sk->port[didx]);
+
+	PF_STATE_UNLOCK(state);
+
+	if (!nlmsg_end(nw)) {
+		nlmsg_abort(nw);
+		return (ENOMEM);
+	}
+
+	return (0);
+}
+
 static const struct nlhdr_parser *all_parsers[] = {
 	&state_parser,
 	&addrule_parser,
 	&getrules_parser,
 	&clear_states_parser,
 	&set_statusif_parser,
+	&natlook_parser,
 };
 
 static int family_id;
@@ -1317,6 +1416,13 @@ static const struct genl_cmd pf_cmds[] = {
 		.cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL,
 		.cmd_priv = PRIV_NETINET_PF,
 	},
+	{
+		.cmd_num = PFNL_CMD_NATLOOK,
+		.cmd_name = "NATLOOK",
+		.cmd_cb = pf_handle_natlook,
+		.cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL,
+		.cmd_priv = PRIV_NETINET_PF,
+	},
 };
 
 void
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
index 10440eaf6366..7c2ef3712dc7 100644
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -48,6 +48,7 @@ enum {
 	PFNL_CMD_SET_STATUSIF = 10,
 	PFNL_CMD_GET_STATUS = 11,
 	PFNL_CMD_CLEAR_STATUS = 12,
+	PFNL_CMD_NATLOOK = 13,
 	__PFNL_CMD_MAX,
 };
 #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1)
@@ -316,6 +317,17 @@ enum pf_get_status_types_t {
 	PF_GS_BCOUNTERS		= 16, /* u64 array */
 };
 
+enum pf_natlook_types_t {
+	PF_NL_UNSPEC,
+	PF_NL_AF		= 1, /* u8 */
+	PF_NL_DIRECTION		= 2, /* u8 */
+	PF_NL_PROTO		= 3, /* u8 */
+	PF_NL_SRC_ADDR		= 4, /* in6_addr */
+	PF_NL_DST_ADDR		= 5, /* in6_addr */
+	PF_NL_SRC_PORT		= 6, /* u16 */
+	PF_NL_DST_PORT		= 7, /* u16 */
+};
+
 #ifdef _KERNEL
 
 void	pf_nl_register(void);

From nobody Tue Jun  4 14:59:36 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VttzX4B0Sz5LcC3;
	Tue, 04 Jun 2024 14:59:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VttzX2MmNz4rYx;
	Tue,  4 Jun 2024 14:59:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717513176;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=FQH1hHvLgHy7kqz4SSnlXfvZXpGTkyKjLYQZF7qlScU=;
	b=F09mPoqrLZCHHYgnvOz5VQD1nl8suVlrPBuBonRd6EI9eFtGMR48qHs6xa+x033mtSQXPp
	u4Zn/96sMKV3YIRcm6z9XqahLPKWrflfhSnZuTBH2tlfPKPCeJ7rQ9fkDQyeEUKdsYx9ge
	JoZVM8UYlUeHLie2SzMruzURXtTP2QjMzvxS4FuJ0rE3lGuNfW+KuYGqJ0Vah8fiwlxlRq
	uzxLfjYjLlbXbDma2udmAl+pGGi9nWvLRdvg6SsnMok0OtlwAEzAPNGHgCUN/kdI5ikzHU
	A1BxFpgJiCOy6+5VSPbkCBtricZgyohatI7vrjDi+6WCqOxZG4gGU0lFsgvBfA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717513176; a=rsa-sha256; cv=none;
	b=Ta9QVWpLSkqm98ev017j724MqRBErj0fnd5D8hcarOe0HD87EGKZWrJqxnRpfOfqJIo+se
	U24FTRdbdFmOi8ZlCJCcR5gYIyB73mbWL6C3RWFNjlmwbQQthAzCY5douVGdPMOVku0HY7
	r8Uc1RFkjaN6HPbYtUrOmgDj1t5LB/5Yv6LegCv1fQaiD2/jwpQXRUkueYUq1KaIXe8N2f
	HUVbSMZwv/qfQezSjRPD7uTfIzebBJJ6kNejXu31tNvmbzh9Wlnk9dpVJ4U4joTkbe3mYg
	W/Z0QfteoXeHBhnKOvk/vdoZ0Ymsf7Ml0fU03VNaFp41m0TeLdvkth4df+ic8A==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717513176;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=FQH1hHvLgHy7kqz4SSnlXfvZXpGTkyKjLYQZF7qlScU=;
	b=rOaflw9aLQTsAnjB7D6ZvxqhpVxqyUd3I/yfffvzlj6aIdkPDqBZqq23YNacQbGKpLYMiQ
	q7SP2Zkv/Tbn6D2B1tMWoYZey1pa1i3qrWDBU4AjRA5dX0lS/gkaTEd9wZNWpDKV2+s8Gu
	cD0pajpJn7m9fiLAcrNI3dOlwyyLRcyEXKkZDCrxsKbKJ6Np+oUEy4H8qgbMohWKCqeZ66
	kskD9ZvW1GYfA2y3XDaWHfFc4k6kiu17n9192Kam6yE1cEjQVUYwBmvPg4m+o0MsaXrqf5
	RJ9WYrCoswFmWlp6tgDVjpvMK4laL4DR+sfozaLj2dshp9a+FPtaowfTb+R+Vg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VttzX1xYZzNQX;
	Tue,  4 Jun 2024 14:59:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454ExaBV050183;
	Tue, 4 Jun 2024 14:59:36 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454ExaDo050180;
	Tue, 4 Jun 2024 14:59:36 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 14:59:36 GMT
Message-Id: <202406041459.454ExaDo050180@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: c36c90a2cc17 - main - pf: convert DIOCSETDEBUG to
  netlink
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: c36c90a2cc171d21f78a6f0e28269c0cea37c2e1
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=c36c90a2cc171d21f78a6f0e28269c0cea37c2e1

commit c36c90a2cc171d21f78a6f0e28269c0cea37c2e1
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-01 18:07:22 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 12:59:59 +0000

    pf: convert DIOCSETDEBUG to netlink
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 lib/libpfctl/libpfctl.c   | 32 ++++++++++++++++++++++++++++++++
 lib/libpfctl/libpfctl.h   |  1 +
 sbin/pfctl/parse.y        |  2 +-
 sbin/pfctl/pfctl.c        |  8 ++++----
 sbin/pfctl/pfctl_parser.h |  2 +-
 sys/netpfil/pf/pf_nl.c    | 37 +++++++++++++++++++++++++++++++++++++
 sys/netpfil/pf/pf_nl.h    |  6 ++++++
 7 files changed, 82 insertions(+), 6 deletions(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index d5cd6c4bda60..42339af5642b 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -2490,3 +2490,35 @@ pfctl_natlook(struct pfctl_handle *h, const struct pfctl_natlook_key *k,
 
 	return (e.error);
 }
+
+int
+pfctl_set_debug(struct pfctl_handle *h, uint32_t level)
+{
+	struct snl_writer nw;
+	struct snl_errmsg_data e = {};
+	struct nlmsghdr *hdr;
+	uint32_t seq_id;
+	int family_id;
+
+	family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME);
+	if (family_id == 0)
+		return (ENOTSUP);
+
+	snl_init_writer(&h->ss, &nw);
+	hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_SET_DEBUG);
+
+	snl_add_msg_attr_u32(&nw, PF_SD_LEVEL, level);
+
+	if ((hdr = snl_finalize_msg(&nw)) == NULL)
+		return (ENXIO);
+
+	seq_id = hdr->nlmsg_seq;
+
+	if (! snl_send_message(&h->ss, hdr))
+		return (ENXIO);
+
+	while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) {
+	}
+
+	return (e.error);
+}
diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h
index e7625252638c..ae1457e9304b 100644
--- a/lib/libpfctl/libpfctl.h
+++ b/lib/libpfctl/libpfctl.h
@@ -492,5 +492,6 @@ struct pfctl_natlook {
 };
 int	pfctl_natlook(struct pfctl_handle *h,
 	    const struct pfctl_natlook_key *k, struct pfctl_natlook *r);
+int	pfctl_set_debug(struct pfctl_handle *h, uint32_t level);
 
 #endif
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 9ec86f898240..92e6e36f3b23 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -763,7 +763,7 @@ option		: SET REASSEMBLE yesno optnodf		{
 				free($3);
 				YYERROR;
 			}
-			if (pfctl_set_debug(pf, $3) != 0) {
+			if (pfctl_do_set_debug(pf, $3) != 0) {
 				yyerror("error setting debuglevel %s", $3);
 				free($3);
 				YYERROR;
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 08c3d5c98321..8776ec7f82dc 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -2695,7 +2695,7 @@ pfctl_cfg_syncookies(struct pfctl *pf, uint8_t val, struct pfctl_watermarks *w)
 }
 
 int
-pfctl_set_debug(struct pfctl *pf, char *d)
+pfctl_do_set_debug(struct pfctl *pf, char *d)
 {
 	u_int32_t	level;
 
@@ -2719,7 +2719,7 @@ pfctl_set_debug(struct pfctl *pf, char *d)
 	level = pf->debug;
 
 	if ((pf->opts & PF_OPT_NOACTION) == 0)
-		if (ioctl(dev, DIOCSETDEBUG, &level))
+		if (pfctl_set_debug(pfh, level))
 			err(1, "DIOCSETDEBUG");
 
 	if (pf->opts & PF_OPT_VERBOSE)
@@ -2731,7 +2731,7 @@ pfctl_set_debug(struct pfctl *pf, char *d)
 int
 pfctl_load_debug(struct pfctl *pf, unsigned int level)
 {
-	if (ioctl(pf->dev, DIOCSETDEBUG, &level)) {
+	if (pfctl_set_debug(pf->h, level)) {
 		warnx("DIOCSETDEBUG");
 		return (1);
 	}
@@ -2777,7 +2777,7 @@ pfctl_set_interface_flags(struct pfctl *pf, char *ifname, int flags, int how)
 void
 pfctl_debug(int dev, u_int32_t level, int opts)
 {
-	if (ioctl(dev, DIOCSETDEBUG, &level))
+	if (pfctl_set_debug(pfh, level))
 		err(1, "DIOCSETDEBUG");
 	if ((opts & PF_OPT_QUIET) == 0) {
 		fprintf(stderr, "debug level set to '");
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index 6534baa9a7dd..58532ad37e12 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -291,7 +291,7 @@ int	pfctl_set_optimization(struct pfctl *, const char *);
 int	pfctl_set_limit(struct pfctl *, const char *, unsigned int);
 int	pfctl_set_logif(struct pfctl *, char *);
 int	pfctl_set_hostid(struct pfctl *, u_int32_t);
-int	pfctl_set_debug(struct pfctl *, char *);
+int	pfctl_do_set_debug(struct pfctl *, char *);
 int	pfctl_set_interface_flags(struct pfctl *, char *, int, int);
 int	pfctl_cfg_syncookies(struct pfctl *, uint8_t, struct pfctl_watermarks *);
 
diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index b9dc7358ae28..1074c561cd15 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -1320,6 +1320,35 @@ pf_handle_natlook(struct nlmsghdr *hdr, struct nl_pstate *npt)
 	return (0);
 }
 
+struct pf_nl_set_debug
+{
+	uint32_t level;
+};
+#define	_OUT(_field)	offsetof(struct pf_nl_set_debug, _field)
+static const struct nlattr_parser nla_p_set_debug[] = {
+	{ .type = PF_SD_LEVEL, .off = _OUT(level), .cb = nlattr_get_uint32 },
+};
+static const struct nlfield_parser nlf_p_set_debug[] = {};
+#undef _OUT
+NL_DECLARE_PARSER(set_debug_parser, struct genlmsghdr, nlf_p_set_debug, nla_p_set_debug);
+
+static int
+pf_handle_set_debug(struct nlmsghdr *hdr, struct nl_pstate *npt)
+{
+	struct pf_nl_set_debug attrs = {};
+	int error;
+
+	error = nl_parse_nlmsg(hdr, &set_debug_parser, npt, &attrs);
+	if (error != 0)
+		return (error);
+
+	PF_RULES_WLOCK();
+	V_pf_status.debug = attrs.level;
+	PF_RULES_WUNLOCK();
+
+	return (0);
+}
+
 static const struct nlhdr_parser *all_parsers[] = {
 	&state_parser,
 	&addrule_parser,
@@ -1327,6 +1356,7 @@ static const struct nlhdr_parser *all_parsers[] = {
 	&clear_states_parser,
 	&set_statusif_parser,
 	&natlook_parser,
+	&set_debug_parser,
 };
 
 static int family_id;
@@ -1423,6 +1453,13 @@ static const struct genl_cmd pf_cmds[] = {
 		.cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL,
 		.cmd_priv = PRIV_NETINET_PF,
 	},
+	{
+		.cmd_num = PFNL_CMD_SET_DEBUG,
+		.cmd_name = "SET_DEBUG",
+		.cmd_cb = pf_handle_set_debug,
+		.cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL,
+		.cmd_priv = PRIV_NETINET_PF,
+	},
 };
 
 void
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
index 7c2ef3712dc7..ab199e308a38 100644
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -49,6 +49,7 @@ enum {
 	PFNL_CMD_GET_STATUS = 11,
 	PFNL_CMD_CLEAR_STATUS = 12,
 	PFNL_CMD_NATLOOK = 13,
+	PFNL_CMD_SET_DEBUG = 14,
 	__PFNL_CMD_MAX,
 };
 #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1)
@@ -328,6 +329,11 @@ enum pf_natlook_types_t {
 	PF_NL_DST_PORT		= 7, /* u16 */
 };
 
+enum pf_set_debug_types_t {
+	PF_SD_UNSPEC,
+	PF_SD_LEVEL		= 1, /* u32 */
+};
+
 #ifdef _KERNEL
 
 void	pf_nl_register(void);

From nobody Tue Jun  4 14:59:37 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VttzY49tHz5Lc8d;
	Tue, 04 Jun 2024 14:59:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VttzY3Jdvz4rLr;
	Tue,  4 Jun 2024 14:59:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717513177;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ODgfYjCSbNg1UdqK9Y2Y/Yal30JyV3aXKb07VSmKY1o=;
	b=fXGb9WDfTj7XplZk7p6KxbRTsgZutJwNJ6g1ijkQjHShuMgSkUuIkV599QT7qqB7LkP6sK
	mucWe8jrObSot1SePV80C8ldHYtzmzWmnAnNsQo/U6ZqFVo+DS4VVcksqdUp7guXbs0hwx
	QYRcOoaC+nHIHa3cjIVrp45d1hMZrutZfLOlU48l1sFZGwGf1MJNAjNoRVc2TJ0oMGiSHa
	Xuu7OWyRd8bjKUf7UCBNhTsxzq5ZdJiROHqVxBnrgP6e2eZ3arrDJS6UT+T20e0IzEMWB0
	GaR7G+kjCWiGoYsPdMJz9mz8kcA1D7+sLuRUDG41OtRSrzZwXM7yMrht2HNvsA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717513177; a=rsa-sha256; cv=none;
	b=hGoSmd3cZIDReDZ53T6Ki8A9r4Luyf83cBcx348jYjsgMTOFPRulLwhWueAYWs1Bv8M+YG
	fBRplPW2JhjMSw4oXbxySi8nb+nscgkitklhM223rybAs/pDS/u+tph7j5TFBMUYH4VHx5
	CUgBXhm+Me30Nki0u9Y/1VAKjapL1wEFEkrLr10JUdNNq8OF9OxuLFWTFKFgxQ7VGAWFS+
	iN/kL7DEy0C4+CtNB3QWm85TCw896VZNipbG88mMkpblYM/IxABXljA2FJsUqkolig5Y7u
	SQBAkKrr1AlU/eHD5XUSwqgcIEfVdLE1VHi96v0jr0M3R+MmvMrmYMEKnqUCfw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717513177;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ODgfYjCSbNg1UdqK9Y2Y/Yal30JyV3aXKb07VSmKY1o=;
	b=WGBX051zaYMmcr6xEpmptxtMeY5QeUsmpZqsg0EyOBY/nhyKTgjW8wBgRD3HM0nXA2QAQe
	Uv3zzh1aJ0ViJcr1SchU9sfWZi149SS/SEhD8nntAWRjdTc84RhfTIve6PtJ/KLrTaWUS7
	5FtAjMcV5Z+I8fKjJG5jdvisnZ6CE8oTyFrCBATSzLDT1rdjVuCR0nU052jjRae7omgYdq
	hN4D84Vqq/Pq97RqxppitDLMw0Q/haS42HTHARI8Utqe7kgGw/2vHed+ZiO8FwXYp83JOm
	yaUWcEgbgDK8ZCkTTMZM7hnZUXY+ZIM7nFtHC56SWVyZXn3SkJ6l5K07uW+fxg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VttzY2xDlzNZK;
	Tue,  4 Jun 2024 14:59:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454Exb02050234;
	Tue, 4 Jun 2024 14:59:37 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454ExbV0050231;
	Tue, 4 Jun 2024 14:59:37 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 14:59:37 GMT
Message-Id: <202406041459.454ExbV0050231@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: cce69517551d - main - pf tests: basic debug level
  test
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: cce69517551d954105aeb72d083af55d901103bf
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=cce69517551d954105aeb72d083af55d901103bf

commit cce69517551d954105aeb72d083af55d901103bf
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-01 18:07:56 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 12:59:59 +0000

    pf tests: basic debug level test
    
    Set & retrieve the debug level.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/Makefile |  1 +
 tests/sys/netpfil/pf/debug.sh | 56 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile
index 5c0e43cbbf23..089db2f19766 100644
--- a/tests/sys/netpfil/pf/Makefile
+++ b/tests/sys/netpfil/pf/Makefile
@@ -7,6 +7,7 @@ TESTS_SUBDIRS+=	ioctl
 
 ATF_TESTS_SH+=	altq \
 		anchor \
+		debug \
 		divert-to \
 		dup \
 		ether \
diff --git a/tests/sys/netpfil/pf/debug.sh b/tests/sys/netpfil/pf/debug.sh
new file mode 100644
index 000000000000..18a7febfbb5b
--- /dev/null
+++ b/tests/sys/netpfil/pf/debug.sh
@@ -0,0 +1,56 @@
+#
+# SPDX-License-Identifier: BSD-2-Clause
+#
+# Copyright (c) 2024 Rubicon Communications, LLC (Netgate)
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+. $(atf_get_srcdir)/utils.subr
+
+atf_test_case "basic" "cleanup"
+basic_head()
+{
+	atf_set descr 'Test setting and retrieving debug level'
+	atf_set require.user root
+}
+
+basic_body()
+{
+	pft_init
+
+	vnet_mkjail debug
+	atf_check -s exit:0 -e ignore \
+	    jexec debug pfctl -x loud
+
+	atf_check -s exit:0 -o match:'Debug: Loud' \
+	    jexec debug pfctl -si
+}
+
+basic_cleanup()
+{
+	pft_cleanup
+}
+
+atf_init_test_cases()
+{
+	atf_add_test_case "basic"
+}

From nobody Tue Jun  4 14:59:38 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VttzZ5wymz5Lc6W;
	Tue, 04 Jun 2024 14:59:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VttzZ4Pywz4rTd;
	Tue,  4 Jun 2024 14:59:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717513178;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=GznJ25zeRLfVa0Md4VTk2+69uEwZ2ryurJyvlNiagrw=;
	b=ICRF8HZm7hdZ3uhp7OcMsvjeQZLDtHke/tnAVZ7KIoEbx5Nve8lilYdDpF2gbu/tp6OEmp
	KnfOCicLxUmzRNEao0Pz/TjbJkS5fNF1VwF7UqfpI8YhE2GoFvuHf+8J0JdB9KDla3JP1X
	b61liNUTRZvrG1/ObOhTGn4VsPHeE/qxO8TApKLYICHjhpewEPds/GWuL8E5tV1eLm7NCY
	L6L1bwhIZRFgkxbei3rLr9LHwFHGmsAb8oFaF5iyxQ30dM3Zu23bGw6oFhXp2md5AiY3iU
	RCPat/OXcQqEYtam6k/kY5vV1x5nQmV3cX0ochYsdMAjSe8PMlIGezGrrS7NEA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717513178; a=rsa-sha256; cv=none;
	b=M5KX1zji0nTicMNKGs/5s04N/N74mAQLEpF41tU3lUx72hxDnPdPzYG06fhO1ercMEYWle
	MopNXVlXrpJvOSHrPVjoaou729OPNYJ5GTfnZaRZyy7yZYDgwo/XDYRJXrVJS5uJ2tnAoZ
	+8hJwb9w0r5iRUlNkmuv6sJPg6QstTcW5xBgawDdvfI62u1I1WX5xZO7TVSsNT2nzdGfnv
	vV9ekOFCxTNQzDNNNLf7QLNKmOYymPz6Xob2ZJO3GhPrpR6LCZWT4MOrcxw674vZJEXsw0
	wDmUNNdzVgXw0U408lmi6aG8DCGtY/atk9tdzigM1vdQBOc0kVt2WC74lEqt1w==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717513178;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=GznJ25zeRLfVa0Md4VTk2+69uEwZ2ryurJyvlNiagrw=;
	b=mR3G/mD9pSy4mEhHZs+nVO7rZtSyFRv4p2QjkvqMF1a7bBw/MdfNKykl99Vesk4nHGkAMG
	r89Bo++ItaQgST46yA+NXsaCSv+V4qHtqmAZIEEGK3vwA0lW/Fdv2DxHWLwolyqPfJOhsc
	l8H5gGUbSfxU0/Tg0xkgjn6HVIpWQwBU+we/TdSGPoQWZavqcZK4c6CFwsYA0juQUM1BSJ
	XZTJ+15YCwnG/Dfv3/quZI0PO1kIp6ikztNaytM+dzULH6f9n9iI94TOm4P6CtNSGNsGfm
	17iDHGnaReugQR1eoB80xDTlO2JbfgXq/i9fCWt2yMrX4H+U2qWZ3CQlb5r4rA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VttzZ3zz4zN7w;
	Tue,  4 Jun 2024 14:59:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454ExcIQ050289;
	Tue, 4 Jun 2024 14:59:38 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454Excwu050286;
	Tue, 4 Jun 2024 14:59:38 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 14:59:38 GMT
Message-Id: <202406041459.454Excwu050286@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 1c5b886e1116 - main - pf tests: make ether:dummynet
  test a little more robust
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 1c5b886e111663d3c7e30beddae9c10445f620d4
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=1c5b886e111663d3c7e30beddae9c10445f620d4

commit 1c5b886e111663d3c7e30beddae9c10445f620d4
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-01 20:37:36 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 12:59:59 +0000

    pf tests: make ether:dummynet test a little more robust
    
    Allow slightly more bandwidth, but cause ping to give up sooner.
    
    MFC after:      1 week
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/ether.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh
index 9a1ab1b005d7..e1855949476b 100644
--- a/tests/sys/netpfil/pf/ether.sh
+++ b/tests/sys/netpfil/pf/ether.sh
@@ -415,7 +415,7 @@ dummynet_body()
 	# Sanity check
 	atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2
 
-	jexec alcatraz dnctl pipe 1 config bw 30Byte/s
+	jexec alcatraz dnctl pipe 1 config bw 300Byte/s
 	jexec alcatraz pfctl -e
 	pft_set_rules alcatraz \
 		"ether pass in dnpipe 1"
@@ -430,14 +430,14 @@ dummynet_body()
 	ping -i .1 -c 5 -s 1200 192.0.2.2
 
 	# We should now be hitting the limits and get this packet dropped.
-	atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2
+	atf_check -s exit:2 -o ignore ping -c 1 -t 1 -s 1200 192.0.2.2
 
 	# We can now also dummynet outbound traffic!
 	pft_set_rules alcatraz \
 		"ether pass out dnpipe 1"
 
 	# We should still be hitting the limits and get this packet dropped.
-	atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2
+	atf_check -s exit:2 -o ignore ping -c 1 -t 1 -s 1200 192.0.2.2
 }
 
 dummynet_cleanup()

From nobody Tue Jun  4 14:59:39 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vttzb6qfFz5LcC8;
	Tue, 04 Jun 2024 14:59:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vttzb5ZVyz4rhs;
	Tue,  4 Jun 2024 14:59:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717513179;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=5a/IUPU8iSQ6AnmamFrDbqxC/6Y+amXjBsGDjnhq9ic=;
	b=VIkZ4Qa1fQ8BJ58btybIIPM5gf2/Vi+UJhcGXzTd/EvYVfoukgQFRToID5kveCc4f2/BBW
	ZzTr5pS8wOOGFyvLpFDRlSVleRB1e3T70LV8nxTbAmgSp5hf+GxjSQm/E5jSTqdbl9o/ap
	9v5shZuWzeZgTwGodZGcHBTVufGBDHkSJPsSuxyiqquM7ofU3xu94Mx76TmHNr0xPoJ/8v
	uXQ9LbrcTIwT3thm5WanRuAg2a+whvXrXlatQ52im38Myg840crsfl7927NZcL29ShpmRL
	Ox6OozRgp6GBxSJlIRto7ZfOmbn+LURfOzIyFqw19dwGIQzKAIcw3YKNSM8gFA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717513179; a=rsa-sha256; cv=none;
	b=wS4VX+JhHmRFKu4TtNr5n0QBYpczbapQztW/r2U8nG6JheJJ9PzK/bKzy0qIJMPpQ9ZO2D
	/HSLe0kQwg//d7PRYaFl8cyt8gW+21oNGFTuhEWyoMan9aF6wrLrCJJtpZsiFwIkLrGtRk
	99N64ER/ILC4KQ7n+V9CG63ZAvpKOm6S67kLwssppiI/H3G/fTLKKhlI10kMdcaUnqLHjg
	1O09EV5AefZeQIzkqd7inUBuruXnrkybVeuhjfZxb2VGI257eOL6q6GFikv9ZmdR7WMsJq
	Xmz9NBPlExFv2f/ksUdB/OnT2GXiNVLYHR3js/TwlrD94qTOMP+8z/7N1gXeNQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717513179;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=5a/IUPU8iSQ6AnmamFrDbqxC/6Y+amXjBsGDjnhq9ic=;
	b=HYDucRpulroGJC4tSB0A3QMr3sEzxALpxJRyGU6Rzy4hzuMdBFZuGNINkChLUT6+YJa8jf
	2tSw7MQZOS8wDeFd8MnRaJd0yp6RFXTQUMsY9AeVvuA+h5wnZbK9VZIDasfkEcdf+72MIF
	dNK1kV4Qfxkn5/rER3+KvnoEQyx75mXIc/VPh1aApJS0Hlar6mK2/eKuSDVTeuCck/SEPQ
	4fIAGY1Y2b1n9JmRBU7CEdRz4KL/atNlmG3OabaohVz8K9hWVS7VLH8qRTE9Hd66Om7AX6
	48FyLbWDvziDx47fmyefqdhjjjBe0WJvqKxW5bshopuJOewVJWeGct3xjh7oMw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vttzb550XzNZL;
	Tue,  4 Jun 2024 14:59:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454ExdEY050340;
	Tue, 4 Jun 2024 14:59:39 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454Exdc2050337;
	Tue, 4 Jun 2024 14:59:39 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 14:59:39 GMT
Message-Id: <202406041459.454Exdc2050337@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 2144e31d8f85 - main - netpfil tests: make the pls
  tests more robust
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 2144e31d8f85c38da875a180f4c016ea8e08fadf
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2144e31d8f85c38da875a180f4c016ea8e08fadf

commit 2144e31d8f85c38da875a180f4c016ea8e08fadf
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-03 19:27:59 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 12:59:59 +0000

    netpfil tests: make the pls tests more robust
    
    Give them more time to hit the expected loss numbers.
    We see occasional failures during CI runs. This makes that less likely.
    
    MFC after:      1 week
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/common/dummynet.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh
index 3c930cfe2aff..0df0db4546c8 100644
--- a/tests/sys/netpfil/common/dummynet.sh
+++ b/tests/sys/netpfil/common/dummynet.sh
@@ -557,7 +557,7 @@ pls_basic_body()
 	# are dropped (84 - 96 responses).
 	# repeat up to 6 times if the initial
 	# checks fail
-	atf_check -s exit:0 -o match:'100 packets transmitted, (8[4-9]|9[0-6]) packets received' -r 6:10 ping -i 0.010 -c 100 192.0.2.2
+	atf_check -s exit:0 -o match:'100 packets transmitted, (8[4-9]|9[0-6]) packets received' -r 20:10 ping -i 0.010 -c 100 192.0.2.2
 }
 
 pls_basic_cleanup()
@@ -604,7 +604,7 @@ pls_gilbert_body()
 	# are dropped (70 - 85 responses).
 	# repeat up to 6 times if the initial
 	# checks fail
-	atf_check -s exit:0 -o match:'100 packets transmitted, (7[0-9]|8[0-5]) packets received' -r 6:10 ping -i 0.010 -c 100 192.0.2.2
+	atf_check -s exit:0 -o match:'100 packets transmitted, (7[0-9]|8[0-5]) packets received' -r 20:10 ping -i 0.010 -c 100 192.0.2.2
 }
 
 pls_gilbert_cleanup()

From nobody Tue Jun  4 15:21:57 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtvTP1jR0z5LgWx
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Tue, 04 Jun 2024 15:22:01 +0000 (UTC)
	(envelope-from shawn.webb@hardenedbsd.org)
Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtvTN4tyRz40Ys
	for <dev-commits-src-main@freebsd.org>; Tue,  4 Jun 2024 15:22:00 +0000 (UTC)
	(envelope-from shawn.webb@hardenedbsd.org)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-7eb3a348247so5208439f.1
        for <dev-commits-src-main@freebsd.org>; Tue, 04 Jun 2024 08:22:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=hardenedbsd.org; s=google; t=1717514519; x=1718119319; darn=freebsd.org;
        h=in-reply-to:content-disposition:mime-version:references:message-id
         :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
        bh=pTSJHZVZj1ncAxsmZyI9XraOlC3l13IxljIR/fVbtBU=;
        b=P4yIl9RGF8XE8KozPdPzI7ETRvnjGRePhdh40YZumzXJ6HMt6Oh1P1uaSNkOCSiIx0
         iMdb29/4qfwgTIZ9bGBO9SNo+w2Ui4wJvM8/CdP6c/vYrXwiFlQ6LANA12cHF49bon+I
         +sjy+ryuG4VxSb7D7sLLsCmHLf7IYDnH1tI0qszhY6GXhd2JwsuejpBslpYKOgNa2Iwu
         OwnqnM9AmmkNkUXFsxpSj17lBUEZngaQg6UAX/78M/4CnK2tOrNKeiyLSfivk9bsviEJ
         AqA4rPHgCp1UReASlAGZKPoE/AYXMNrXS0F+MbRn8g4opTGrm+R8lSO5tZddj9m3Qeuo
         7/xg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717514519; x=1718119319;
        h=in-reply-to:content-disposition:mime-version:references:message-id
         :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to;
        bh=pTSJHZVZj1ncAxsmZyI9XraOlC3l13IxljIR/fVbtBU=;
        b=PHmu0ieeY5qFkAY7nVn1i7j0j2Zh4Ey/hRnwilB09l6WrUrUhZMDA+d0vhTvpHHIwa
         b5ra45xLMrB6WA09lJPwOOTpzaILvIj0tOVN7bfLeRrlN6Rxztp5lOeMk+EzZPS2oL9C
         c/wJ6Yo4C5uewrzZzOJh0gDGtIy5TLYBcbCgIphfMyYMyP2gULh2c/KK7+Q97hqZrs2b
         +cNTeTvOwL94wgyhBPngXTaQhTpdziJgh+Oh+SVyxuFlEE2d8lwjeyEsGpu2ZV3mjtVb
         aClPXixE255nnNLX2f1yqdfmu2SC3C+5feJuzPc8rOohbOns6bw1yd1HrquKEIqJZgmG
         SSVg==
X-Forwarded-Encrypted: i=1; AJvYcCVeuc4AA5ACASs3okDXr9sSYiogdR8oEkDeAntvOyG/2MUdPtfI57oDFzK0kaBkTzQmCaGxb8XAabrVBp3I6YMtD08OHFVW438hrABsHwqPag==
X-Gm-Message-State: AOJu0YytN9nQJlThx1l4IODgat2H8Dc2PFteZlbzwzAYSkI8fIOEPCNH
	CDMdkT3jfiyy+7tGot3L3InTCE6/PmVsP3sBP1Ge/UDkkL6ZO3n2XGk98nCEjvQ=
X-Google-Smtp-Source: AGHT+IGkfE8F6z07lnApwcC46lDwJtOlyq+ScvKO5xwRMtcLsUuBugi3Z//SiIo5ohsYwG8XKPzsPQ==
X-Received: by 2002:a05:6602:6d11:b0:7ea:ff17:d3a5 with SMTP id ca18e2360f4ac-7eaffea28c9mr1581068439f.10.1717514519243;
        Tue, 04 Jun 2024 08:21:59 -0700 (PDT)
Received: from mutt-hbsd ([184.99.37.29])
        by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4b60c29db9dsm391065173.123.2024.06.04.08.21.58
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 04 Jun 2024 08:21:58 -0700 (PDT)
Date: Tue, 4 Jun 2024 15:21:57 +0000
From: Shawn Webb <shawn.webb@hardenedbsd.org>
To: Stefan =?utf-8?B?RcOfZXI=?= <se@freebsd.org>
Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, 
	dev-commits-src-main@freebsd.org
Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD
 systems
Message-ID: <yby7q4ygywjeglrngvzdrcwfcdodc2lqw5a4m2lenq4ck7mcet@bror4anr4vny>
X-Operating-System: FreeBSD mutt-hbsd 15.0-CURRENT-HBSD FreeBSD
 15.0-CURRENT-HBSD 
X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
References: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="w6kuvq3p3istedrw"
Content-Disposition: inline
In-Reply-To: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]
X-Rspamd-Queue-Id: 4VtvTN4tyRz40Ys


--w6kuvq3p3istedrw
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=DFer wrote:
> The branch main has been updated by se:
>=20
> URL: https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8=
a63bdb60fa486a
>=20
> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
> Author:     Stefan E=DFer <se@FreeBSD.org>
> AuthorDate: 2024-06-04 06:26:09 +0000
> Commit:     Stefan E=DFer <se@FreeBSD.org>
> CommitDate: 2024-06-04 06:26:09 +0000
>=20
>     newfs_msdos: fix build on non-FreeBSD systems
>    =20
>     Disable data area alignment if the build environment does not define
>     PAGE_SIZE (e.g., when building on Linux or macOS).
>    =20
>     Reported by:    jrtc27
>     MFC after:      1 week
> ---
>  sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
>  1 file changed, 4 insertions(+)
>=20
> diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c
> index 423fbbcadcc5..1bca560a59e1 100644
> --- a/sbin/newfs_msdos/mkfs_msdos.c
> +++ b/sbin/newfs_msdos/mkfs_msdos.c
> @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, con=
st struct msdos_options *op)
>  	    if (o.align)
>  		alignto =3D bpb.bpbSecPerClust;
>  	    else
> +#ifdef	PAGE_SIZE
>  		alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec;
> +#else
> +	        alignto =3D 1;
> +#endif

Imagine the following:

1. someone builds FreeBSD on Linux or macOS
2. that build is deployed
3. FreeBSD is rebuilt on that deployment

Could the value of alignto be different on step 1 versus step 3?

Thanks,

--=20
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50
https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A=
4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc

--w6kuvq3p3istedrw
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmZfMQwACgkQ/y5nonf4
4fqdVQ//a8kGQZCX9aIFfavw8Mv7/xh578+eVUGl5a9OY6Qri3QJjHyjvvfvU3Hm
LFHrN/IyqNaj/K/a+R4Gqxbv+a0UhvYnHu6WYGySoYE8hZPyqkPMUwtT0HaSAbNS
hC6S42iIJVV3e0hK/0JtiE+mkXl+AINhN9Aw91nVKKmKHX68kcWFjz812zGP8R5s
EJnCsAi8Ja6KCV1+2EH4sL87c37ikQGdl1D594yJCEtBh0+khBXTyj171vWcBPBP
fojdX7ayzUI49uUV0scbpwnFR9RT5yww7zEvarZzW858TSS448GW7BuHtoC95iwi
9YOcQK0ib64VlcxfKZY91HlF9Ef4/BvK6aV7Ce0rpHa5b5V2i1gRyI8gekRNFR4W
Uv5fA6TdrLgG9CNVrur71j3jZFuu9Q1atfDdJO9BVk/2sWnFw6zmEBCRk3YkdmbG
DDu7IByV4+NwLgYfGLiE2IJxY9tIcVr2hxu9jz/JXV8DCiGLQN/cVNcLAF23WYen
cHAuTFSuytiadGarYwOgfOJuaIhabcgp2QkmAWeHvU4/KnCuc6hb2p3db06k2n6J
87+pgLX0jv/FV7gcUvsEvaWEG5wVBu4OkdCX/J4zSGKSqaCotyEfK1NV9lONS/mG
dh5+J81nbew8w2EcJpR6yGK0tPpqOWRlwfyUGHR1CMrqJ4HoQBQ=
=jkgX
-----END PGP SIGNATURE-----

--w6kuvq3p3istedrw--

From nobody Tue Jun  4 15:46:54 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtw2N74j6z5M0Xy
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Tue, 04 Jun 2024 15:47:08 +0000 (UTC)
	(envelope-from wlosh@bsdimp.com)
Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtw2N4Ky5z43gr
	for <dev-commits-src-main@freebsd.org>; Tue,  4 Jun 2024 15:47:08 +0000 (UTC)
	(envelope-from wlosh@bsdimp.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-681bc7f50d0so4111824a12.0
        for <dev-commits-src-main@freebsd.org>; Tue, 04 Jun 2024 08:47:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1717516027; x=1718120827; darn=freebsd.org;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=Hh2j0I2ssvf0kZA/+15d8GSh3vo3k1RM9AsMvI88CoQ=;
        b=HIsn86h4rRTpJM1r/edeSMvMdiaYlwTfPd+KquIHOW1y6ie31CAFOTAzU4uyvh+qPS
         1Q7MqnS/e4VzSH1TWCfMNCos6L31DAdNgG0R7DcJOck3BNZ/ojsH2jop7ClnGFzEOB/6
         6ZrUttB7EZL6GgNsKSOaQ9jFDL3E+LXK2csBJUrLN8H4u2je7Yh0qkOac4jD2ZzDn0/Y
         /ade421xpM6V4DSiaKYyUYYsau4Hp9inTOjAavDBBfJ/nwAdRGcTt4PI8+K6JvCD2zTD
         Oel8zYl7uqSn4nnxANOA0wrVjSXn+YKPGrzjhq12oEpijv2RDRb9IPhawDCBQXYl055B
         86QQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717516027; x=1718120827;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=Hh2j0I2ssvf0kZA/+15d8GSh3vo3k1RM9AsMvI88CoQ=;
        b=jPXjTjQdiDBqmUgU1M/jyotqEY8SOA2qRGaTVcBVBIJMS7f1oI2KLtXqW0e9GxXhme
         fMdx9y7jjIA2gRKcpJOnnsYjmrnFEVbeGuA/CwxHxir4mEs4Nb+tMsrj7kytnS//MXxU
         xR1TtaLJXP6MUjtHKx3EBIPRzb+AsKb8824UCgu6MOJUJDNSY/IV1Q6t+o1YSbSdBu1k
         fQ2/yJNq4BRMVyaMeRuOQ981i0Q7RIX/umFPUAAyLUtwgZ2Nwpl8iIvs5JWMWovsMM0F
         zK7RKXk9AuilHAE525XqKbPYtPUe0F1TucDhxZjHqxJerJ4xA0lzqv3z6fFXmG/IvgTW
         VwCQ==
X-Forwarded-Encrypted: i=1; AJvYcCWr41qmzAM2yVRUDTL/VeIDkOfHSYH17fp66JOxfUb9O0CBPXUOMqGqZXN1ele5QSorrGkkh5kxtkOGayXy7tM6NGPA0usA5nSoKFaa4Khs5w==
X-Gm-Message-State: AOJu0Yy00ncZgdEn1dxLOYCcukNqiHLmj+Hd1gtNxwOEUiBbShJeLXfM
	TyPc8XA3qrDQET/BheGw8vAZzSZyC50GDuZfqNqYyTM9jZ+WN5HEtBScpYDFss9rV1kmcabSf2B
	05UYxnAKu/2V8P4Zm4ewdRuv1tSZq4FWu7rh96DuAZDeM3Zv8hic=
X-Google-Smtp-Source: AGHT+IHIjADzAwrHgc9LFrhMsUUqthGP46wi0+P370OF9keqw/PyMrDAaPr91Ft/hL1ytRCj56kpiuAT9ZzqiceO/UU=
X-Received: by 2002:a17:90a:ce8d:b0:2c1:e9db:92c8 with SMTP id
 98e67ed59e1d1-2c2530778famr4408811a91.12.1717516027045; Tue, 04 Jun 2024
 08:47:07 -0700 (PDT)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
References: <202406040628.4546SJ98088668@gitrepo.freebsd.org> <yby7q4ygywjeglrngvzdrcwfcdodc2lqw5a4m2lenq4ck7mcet@bror4anr4vny>
In-Reply-To: <yby7q4ygywjeglrngvzdrcwfcdodc2lqw5a4m2lenq4ck7mcet@bror4anr4vny>
From: Warner Losh <imp@bsdimp.com>
Date: Tue, 4 Jun 2024 09:46:54 -0600
Message-ID: <CANCZdfqC223GvT+O=PCuZfL997bY235k7n9=AznphPMgACoDHg@mail.gmail.com>
Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems
To: Shawn Webb <shawn.webb@hardenedbsd.org>
Cc: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= <se@freebsd.org>, src-committers@freebsd.org, 
	dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Content-Type: multipart/alternative; boundary="000000000000b0449b061a125c4d"
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]
X-Rspamd-Queue-Id: 4Vtw2N4Ky5z43gr

--000000000000b0449b061a125c4d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Jun 4, 2024 at 9:22=E2=80=AFAM Shawn Webb <shawn.webb@hardenedbsd.o=
rg>
wrote:

> On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=C3=9Fer wrote:
> > The branch main has been updated by se:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bd=
b60fa486a
> >
> > commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
> > Author:     Stefan E=C3=9Fer <se@FreeBSD.org>
> > AuthorDate: 2024-06-04 06:26:09 +0000
> > Commit:     Stefan E=C3=9Fer <se@FreeBSD.org>
> > CommitDate: 2024-06-04 06:26:09 +0000
> >
> >     newfs_msdos: fix build on non-FreeBSD systems
> >
> >     Disable data area alignment if the build environment does not defin=
e
> >     PAGE_SIZE (e.g., when building on Linux or macOS).
> >
> >     Reported by:    jrtc27
> >     MFC after:      1 week
> > ---
> >  sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/sbin/newfs_msdos/mkfs_msdos.c
> b/sbin/newfs_msdos/mkfs_msdos.c
> > index 423fbbcadcc5..1bca560a59e1 100644
> > --- a/sbin/newfs_msdos/mkfs_msdos.c
> > +++ b/sbin/newfs_msdos/mkfs_msdos.c
> > @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype,
> const struct msdos_options *op)
> >           if (o.align)
> >               alignto =3D bpb.bpbSecPerClust;
> >           else
> > +#ifdef       PAGE_SIZE
> >               alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec;
> > +#else
> > +             alignto =3D 1;
> > +#endif
>
> Imagine the following:
>
> 1. someone builds FreeBSD on Linux or macOS
> 2. that build is deployed
> 3. FreeBSD is rebuilt on that deployment
>

So this is due to makefs pulling this code in. That's built both as a host
tool and as a normal target tool. The former is only used to make make
release work, iirc and will create small MSDOS images for EFI, where the
code in question likely doesn't matter. The latter is also used for the
target program newfs_msdos, which is used generically on a FreeBSD system
to make a filesystem. That program will have been built with the target's
PAGE_SIZE, so is fine.

There might be slight differences in images generated without the -a flag,
but even then the release images are just used for the installer where
minor differences like this won't matter.

So newfs_msdos: Same no matter how built.
FreeBSD release image: Minor, trivial variation, maybe, in the created
image. We don't guarantee 100% reproducible images in general just yet.

Warner

Could the value of alignto be different on step 1 versus step 3?
>
> Thanks,
>
> --
> Shawn Webb
> Cofounder / Security Engineer
> HardenedBSD
>
> Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50
>
> https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/0=
3A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
>

--000000000000b0449b061a125c4d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jun 4, 2024 at 9:22=E2=80=AFA=
M Shawn Webb &lt;<a href=3D"mailto:shawn.webb@hardenedbsd.org">shawn.webb@h=
ardenedbsd.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex">On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=C3=9Fer wr=
ote:<br>
&gt; The branch main has been updated by se:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47=
faaa8131df3cd8a63bdb60fa486a" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb60fa486a<=
/a><br>
&gt; <br>
&gt; commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Stefan E=C3=9Fer &lt;se@FreeBSD.org&gt;<br>
&gt; AuthorDate: 2024-06-04 06:26:09 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Stefan E=C3=9Fer &lt;se@FreeBSD.org&gt;<br>
&gt; CommitDate: 2024-06-04 06:26:09 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0newfs_msdos: fix build on non-FreeBSD systems<br>
&gt;=C2=A0 =C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0 =C2=A0Disable data area alignment if the build environmen=
t does not define<br>
&gt;=C2=A0 =C2=A0 =C2=A0PAGE_SIZE (e.g., when building on Linux or macOS).<=
br>
&gt;=C2=A0 =C2=A0 =C2=A0<br>
&gt;=C2=A0 =C2=A0 =C2=A0Reported by:=C2=A0 =C2=A0 jrtc27<br>
&gt;=C2=A0 =C2=A0 =C2=A0MFC after:=C2=A0 =C2=A0 =C2=A0 1 week<br>
&gt; ---<br>
&gt;=C2=A0 sbin/newfs_msdos/mkfs_msdos.c | 4 ++++<br>
&gt;=C2=A0 1 file changed, 4 insertions(+)<br>
&gt; <br>
&gt; diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msd=
os.c<br>
&gt; index 423fbbcadcc5..1bca560a59e1 100644<br>
&gt; --- a/sbin/newfs_msdos/mkfs_msdos.c<br>
&gt; +++ b/sbin/newfs_msdos/mkfs_msdos.c<br>
&gt; @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, =
const struct msdos_options *op)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (o.align)<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =3D bpb.=
bpbSecPerClust;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else<br>
&gt; +#ifdef=C2=A0 =C2=A0 =C2=A0 =C2=A0PAGE_SIZE<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =3D PAGE=
_SIZE / bpb.bpbBytesPerSec;<br>
&gt; +#else<br>
&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =3D 1;<br>
&gt; +#endif<br>
<br>
Imagine the following:<br>
<br>
1. someone builds FreeBSD on Linux or macOS<br>
2. that build is deployed<br>
3. FreeBSD is rebuilt on that deployment<br></blockquote><div><br></div><di=
v>So this is due to makefs pulling this code in. That&#39;s built both as a=
 host tool and as a normal target tool. The former is only used to make mak=
e release work, iirc and will create small MSDOS images for EFI, where the =
code in question likely doesn&#39;t matter. The latter is also used for the=
 target program newfs_msdos, which is used generically on a FreeBSD system =
to make a filesystem. That program will have been built with the target&#39=
;s PAGE_SIZE, so is fine.</div><div><br></div><div>There might be slight di=
fferences in images generated without the -a flag, but even then the releas=
e images are just used for the installer where minor differences like this =
won&#39;t matter.</div><div><br></div><div>So newfs_msdos: Same no matter h=
ow built.</div><div>FreeBSD release image: Minor, trivial variation, maybe,=
 in the created image. We don&#39;t guarantee 100% reproducible images in g=
eneral just yet.</div><div><br></div><div>Warner</div><div><br></div><block=
quote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1=
px solid rgb(204,204,204);padding-left:1ex">
Could the value of alignto be different on step 1 versus step 3?<br><br>
Thanks,<br>
<br>
-- <br>
Shawn Webb<br>
Cofounder / Security Engineer<br>
HardenedBSD<br>
<br>
Tor-ified Signal: +1 303-901-1600 / shawn_webb_opsec.50<br>
<a href=3D"https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Sha=
wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc" rel=3D"noreferrer=
" target=3D"_blank">https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/m=
aster/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc</a><br>
</blockquote></div></div>

--000000000000b0449b061a125c4d--

From nobody Tue Jun  4 16:59:38 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtxf21sKnz5M9n6;
	Tue, 04 Jun 2024 16:59:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtxf21Kzdz4Fty;
	Tue,  4 Jun 2024 16:59:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717520378;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=8TLE+RR0UNcZuF/lVnMB7DjKNmchaEydZe2bTQTwyjU=;
	b=mNSu55qYkIAZ4Y308M3++p022Mwug88oTOC4+bDDpzinCzAaz7zT0ALZlgKfyVdsDZAosk
	xDMwsXs6RS/Ncs9Fg6JUFkP5LymS7ACDIwtUSZNAvtCL/z/vOtQWy7dp/tRySXBKs6b8sE
	EyAIwfClRhqoM5hFqftCgEHBgpZ+uhs6IMTZwiZUDxpHrTDwtNTyDT7eedM2ta7pkr589j
	qFgieVqDF+hqdKSekDtuGoIk1joASA9lcNQbpQ/OF/AMWRbBEKf/vxffcqkgfEcr8HYcLJ
	DO140NZCCd/tryCBJTW8BdRd+0JReiqRz9aRc7hUYNDeGo3ljrES3VJQelDUMw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717520378; a=rsa-sha256; cv=none;
	b=GkyX9hbmWVgCCu3qaHD6OV/TqQPamAPG6l7KAPGZiKoCYb0a5FXsxEL4DNeYvIv3To1kk6
	PiesM5wJYF1sqZ8n/3/ztT3s2LADAEf2LRewSE1cUIbEIL5YNpzJdBXa1RliM+y5VxIxv2
	o74H/MZmV1Qfo6c9h1dxaXUEaDFGJByLCsf3dE7X7o/M5J7xNtSG0lBu/0pkI/T+lggje6
	rYA6VlBtVxK3L1GKAMoJ1whi8tr2PgUC2VNlqnm84iP2zbk26ecME2ZhcYfTzEXIfdbMfJ
	fbOG/BhjC1Uw3nLcvVn1HFTcYeALr794PEc86XHdOViGB83eSdGL38SgVDlYfQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717520378;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=8TLE+RR0UNcZuF/lVnMB7DjKNmchaEydZe2bTQTwyjU=;
	b=l7+gW9I58giD+VC7HLzw5Gi8H/x+4a5x/zTbdSIQohmtM9LScziqvVSue+bQTyKycs1Aay
	ByPlvYQUCFW4mGj9YfNhmVAAe6xI5tV42jwZ5ZL/nj0X3ODhY3QVkqu4/wqV6kc341DXBM
	ilc+HormZC4P+TCw1+FtGYdBisO6AyjWXE2FcBtYBp3Kk/H0iq3KDK5dA0SK10U0kTNiWQ
	68AMQdWBo2j7YN6H5gyjO8rOqU35PxY39eXBGTcUYcQ+dhawW9ARIYNnxfajIDc6LNoaWV
	8LciVhnufrINBqnBqj25cHU3xiUrqAKkk8pQjGWAPLBSbZJ7ohLNIcVHDrrhsw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtxf20xHZzRFH;
	Tue,  4 Jun 2024 16:59:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454GxcQP053354;
	Tue, 4 Jun 2024 16:59:38 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454GxceM053351;
	Tue, 4 Jun 2024 16:59:38 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 16:59:38 GMT
Message-Id: <202406041659.454GxceM053351@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Warner Losh <imp@FreeBSD.org>
Subject: git: 623d432b154a - main - typo: Fix side -> size since
  it matters to the meaning...
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: imp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 623d432b154a7fc0bd75f3ca221114808b6e9113
Auto-Submitted: auto-generated

The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=623d432b154a7fc0bd75f3ca221114808b6e9113

commit 623d432b154a7fc0bd75f3ca221114808b6e9113
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-06-02 14:38:11 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-06-04 16:59:01 +0000

    typo: Fix side -> size since it matters to the meaning...
    
    batch side doesn't make sense, but batch size does. Fix.
    
    Sponsored by:           Netflix
---
 lib/libthr/tests/umtx_op_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/libthr/tests/umtx_op_test.c b/lib/libthr/tests/umtx_op_test.c
index 48417623e7da..8f964f9a923b 100644
--- a/lib/libthr/tests/umtx_op_test.c
+++ b/lib/libthr/tests/umtx_op_test.c
@@ -35,7 +35,7 @@
 /*
  * This is an implementation detail of _umtx_op(2), pulled from
  * sys/kern/kern_umtx.c.  The relevant bug observed that requests above the
- * batch side would not function as intended, so it's important that this
+ * batch size would not function as intended, so it's important that this
  * reflects the BATCH_SIZE configured there.
  */
 #define	UMTX_OP_BATCH_SIZE	128

From nobody Tue Jun  4 17:08:12 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtxqw6QVVz5MC7W;
	Tue, 04 Jun 2024 17:08:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtxqw5h1Kz4Gt0;
	Tue,  4 Jun 2024 17:08:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717520892;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=9B59isP7Gn9PYdfnoqI6a+SjW5iO8BKKfd8sS6SLdg0=;
	b=XD230It/sd/4ji6I8Pxy93C3R9ug+8LD5p50sacb3jJQT3U0f6GDkoGF95A6bPBBBBTApc
	1e553HZhHl1IPmYc3z+kTOVyganjNNotWztpQwUIQBjqJByjtv87JfwXylT7jx2MTka8O+
	r8MRlo/RsMNRvATUWmiSx6hcBWXQaGm50Sgkrk1Mvm/3ia07qwgeX99GjHtNmjkynlDDQD
	bZlegh8OcsGvFcXPR3QSeP38awv7iBnmWpRvALvqfHGx2nhco5lPsOc5aW3s6wgu/3MLvW
	T1CgsEaItoirevVdRvwQVsVadYc+IMinqDbHRrtkmenfprCd+R70QyuJnTGrOA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717520892; a=rsa-sha256; cv=none;
	b=Msj/cPBaXO8wnvTA6wg2ur4y/JinUQzrIZUfBWgBwOpV6Kw5wJL13hsSaf4QsYc56II15l
	JrtFLkXFH3rg+qaMmZPTtVFynaKKrj75pa5YRU+bLegcEule6cg4tuly5RPjWYFPIozYTS
	mZOT6/pVpb0jyClrxB8O0WsLj88lm4tpxnoaX6fsqfSQfiC7BH+yhFVdb/hy1a4T4E/N40
	3iGid8CkdrFJoGnI3hDUGAJiqlfBKwkiLkI8FEvrPRq5QvtE6XuVNWLNAV/gZw+ceUyaGN
	80SjL3nbuuTt9TopAuKCkRStrEEwcTII46dRYu84pQA7T90Y5eTDNA24/G2FSA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717520892;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=9B59isP7Gn9PYdfnoqI6a+SjW5iO8BKKfd8sS6SLdg0=;
	b=Fg7aY2iArJhSgLexn7s5s4IOm9Hocp01I5sXwiplj7cPPlX9deoRFVLEbEZR6ECeBOP/nf
	/c704cIvOLjAvHqssL6kxF3EMBi1B5yOnQV7A3I8RfvRj/iU5muer8TiD5lr0yeNkfqtaq
	pWHfm/RlKzr4VaFBMQbQhStvBv/94TRRucO1IuqCQrYd4rZnCELrzLvXrIroTF/DArSDhW
	Hbq1sO9yyWPJcmqo6CPzqtG8XL4X7teJCf248LrNGbgDn2nkzGjP6Un660W9Vy2gAw6cGf
	SndvkbXhlyEHU7JaQCJ0mollXbf8DYGWFvNHZezuaLVOvxDc5qGYNCSigdcLVw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtxqw5HtzzRn1;
	Tue,  4 Jun 2024 17:08:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454H8CJL070928;
	Tue, 4 Jun 2024 17:08:12 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454H8C1n070925;
	Tue, 4 Jun 2024 17:08:12 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 17:08:12 GMT
Message-Id: <202406041708.454H8C1n070925@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Jessica Clarke <jrtc27@FreeBSD.org>
Subject: git: 9712479723b6 - main - ObsoleteFiles.inc: Add missed
  riscv64 file for LLVM 17
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jrtc27
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 9712479723b69ee15a1a1d3d550436aff55cf8ac
Auto-Submitted: auto-generated

The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=9712479723b69ee15a1a1d3d550436aff55cf8ac

commit 9712479723b69ee15a1a1d3d550436aff55cf8ac
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-06-04 17:07:56 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-06-04 17:07:56 +0000

    ObsoleteFiles.inc: Add missed riscv64 file for LLVM 17
    
    LLVM 17 was the first version we shipped asan_static for.
---
 ObsoleteFiles.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index bacd17a57b30..19eefda42fe9 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -370,6 +370,7 @@ OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-aarch64.a
 OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-i386.a
 OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-powerpc64.a
 OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-powerpc64le.a
+OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-riscv64.a
 OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.asan_static-x86_64.a
 OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi-aarch64.a
 OLD_FILES+=usr/lib/clang/17/lib/freebsd/libclang_rt.cfi-arm.a

From nobody Tue Jun  4 17:44:54 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtyfG22D6z5MHpH;
	Tue, 04 Jun 2024 17:44:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtyfG1Lvsz4L40;
	Tue,  4 Jun 2024 17:44:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717523094;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=c64MkCuF5SoiZlwz2RLmi9fRuvJhe/yL3jnvOO8+Efg=;
	b=Vg155FaZwSmOQbYVnAMByhHXPQBFojBsW/3c19FVSh5O4vtxAq2t3JnhE706XFo4ellcqR
	t4iLmXuh+D7mbcP23dAeX0zHs6aw8+FXueT/Idh5T4k7WDBito0j3AI7NDfpo76GpPiBe7
	X0niDxeagm2CcJvkYnbTTFRj9QX50pybHZ++CWwgMs4/E+Qoi3qrgUMywcWObwQo7AJG25
	Tg0B31WDQ9FmE6raSub8YVZ4ql9C0MjbPl5iQVAZDZRxufAcFhrISxFSsSAopwkrDVL/uO
	kYE56XJCw1FmiUeeR3wtX64sQF5tfAh+HrRWtc+TWSEzm5b21QlGA10v0L/l4g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717523094; a=rsa-sha256; cv=none;
	b=W+pWCu8DhtZ+hkCcYxLTFWeDFb6ggKI4L8coWg/Rwjcf6fu8/IVLjt0kx0v66NQot/cI5s
	fltyqzeQNxJHVGZdYjcEpc/mJQwnfJYVOlsSEsiXcX8kNjGTBUIBn8G09z0eVR87WaeefD
	kVbjZRBfj1BRnPRtZUDFoH6JxiWGvNJ/OTB0V0ETYT0qPZ9z3OqP0fdwiN633EPdamdDe5
	LxYVzzLVHOzbEkJGvUncKD2rn0MtylC46FKuvABKat4Uqh/Y9+7hhNIHS8rUHilPpnnJ+a
	YU+UdWAGC2mc0H7r8oMNyfinFMiDz+rV0fcmLwLVLv6hn/q6lhnmsKPBr4l8hA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717523094;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=c64MkCuF5SoiZlwz2RLmi9fRuvJhe/yL3jnvOO8+Efg=;
	b=ugexQ+lD0wciVy3dai/A6BKlNHq+s4exLbD6O0qE0th5sDjBJWjVaa0N1HlGLT4Z26jiK1
	jSryyKvkHWlaMr1dSj/1m80RDkDoKA6DZrHMja48JH3K3U7q8fsnen/psn3LLLVXAa9kZy
	fVJk8Xydv/CG8IFI7qvLSFjh8bD9C5VkWkOTOIIXy5AdVpjR8TYbb1HcHu46MS+FaQ2jvM
	8qw5LPQBouky8+acsv/EnYAuR263BUj86f0FetxsL7vyaaODUk1zb5kbjRQg2GjXNR6WPz
	MGkLTBjx+im82r643qz4E/5/BElH8/k2r2gQM8LQ38VQ64rV6slrKU3Lva82HQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtyfG0yBQzS7S;
	Tue,  4 Jun 2024 17:44:54 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454HisjR037054;
	Tue, 4 Jun 2024 17:44:54 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454HisFP037051;
	Tue, 4 Jun 2024 17:44:54 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 17:44:54 GMT
Message-Id: <202406041744.454HisFP037051@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 4779b16fa61f - main - pf: fix overly large copy in
  pf_rule_to_krule()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 4779b16fa61f858ad5c449834f550fbd5e162d98
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=4779b16fa61f858ad5c449834f550fbd5e162d98

commit 4779b16fa61f858ad5c449834f550fbd5e162d98
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-04 12:55:02 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 17:44:20 +0000

    pf: fix overly large copy in pf_rule_to_krule()
    
    The timeout array in struct pf_rule has PFTM_OLD_MAX entries, the one in
    struct pf_krule has PFTM_MAX entries (and PFTM_MAX > PFTM_OLD_MAX).
    Use the smaller of the sizes when copying.
    
    Reported by:    CheriBSD
    MFC after:      1 week
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sys/netpfil/pf/pf_ioctl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index be5e38664a76..99cb3bd85d57 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -1972,7 +1972,8 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule)
 	krule->os_fingerprint = rule->os_fingerprint;
 
 	krule->rtableid = rule->rtableid;
-	bcopy(rule->timeout, krule->timeout, sizeof(krule->timeout));
+	/* pf_rule->timeout is smaller than pf_krule->timeout */
+	bcopy(rule->timeout, krule->timeout, sizeof(rule->timeout));
 	krule->max_states = rule->max_states;
 	krule->max_src_nodes = rule->max_src_nodes;
 	krule->max_src_states = rule->max_src_states;

From nobody Tue Jun  4 17:44:55 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VtyfH4FFmz5MHlm;
	Tue, 04 Jun 2024 17:44:55 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VtyfH2JxSz4L6J;
	Tue,  4 Jun 2024 17:44:55 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717523095;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=KVx/8Wh4hm1ahYyBEgsdTro4Zd9BQh3xmhzoSyQpp1E=;
	b=YBwhCLYFw8Eatr8FiQUCyaRP0rGsvVyfslgut3+HsmttdK/ISxyP0wli8uFXWOr2Gr5qAn
	WC8rQ5bJsEUdTOBtbRVkxkQdGnZeqc+c4Fohah41yTzqgBP35lkSKAup7qFPBrDz1bOkiy
	inZWfZG/Z+TQtmaRdY57/KxiGFO71+dsHvCA3s3TIzM/u9VO4jT3ekZZcK5Zck64sgh3Yy
	309dGm6lL2JQtzuz4lzcG1apHIGxNqZGIA0sdmkin9s4XNdwDvLlaPm/+3XopH/YK01TS1
	5oVoRyLxSPK/6Yx3xcaFHaSd0IMH3V1RW8dbtFRmvUdnmA+4DWGDOsyUa9OEsA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717523095; a=rsa-sha256; cv=none;
	b=Vrd1kX1TnDYSMxCLupu6czf6Lj+hGbK2Di00EtQo0Z7QeEdY5MeCnb/y7Eb0Sfnj+BRNN5
	MFojYpB9Y4L9FyVVsSt6gtx0TPYicHo7Y4fWZ+J/LLoCtdb2x7V+/idvCP+MXbalmx/kbO
	s/RIe8lTmf/7QMqSYJgOGt/x2Wnmzbu2J6msthX3+MVCOhnRs4ArOz7lDkaoYtAOTsO4OA
	gy+KMEL1N75JtGLeRQKof3f7ygiYEn+QWtexBd9BQnmZpLBrrn/csBxGgO/7dYy77tdXZr
	KHxqtkvTfSQ5HWn1vW+SjsxHyupVEe7C5Cnlc3PlMpnSeypzDpz1WC624JN4qA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717523095;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=KVx/8Wh4hm1ahYyBEgsdTro4Zd9BQh3xmhzoSyQpp1E=;
	b=P43/CWdCk88IJ0FQqKvn3G7tFJvAKI4JGSW0bTbK5uqrY9OBBwgNCknYOR2R7XGDLKlFG6
	JiV3WfbuHfp12pineiGD3F4ez4xz6X+avOnqQV/WwlYnU26SyAOh9ny5tKo1K3Bmn9Iuj+
	8nPu1wVw21KuFONjsx4K5wQLqtCBKZ+SXIpZmYzeg2NEjs8yM+uy2/tp7o/KwfVB9E0r06
	o/bYox/kLJwg61ZBB7AJRWFYO9yywNLqXh83rS/jkkl705ygnRzb3XVHA2/mNcCHFn9ts8
	3mvk7AYjIcmwI/8WaBhrDPPdPUZQbWtBl/aHTPYqI86rZCn+4VO/5muYnf1Iog==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VtyfH1w4TzSN9;
	Tue,  4 Jun 2024 17:44:55 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454Hitw1037105;
	Tue, 4 Jun 2024 17:44:55 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454Hitud037102;
	Tue, 4 Jun 2024 17:44:55 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 17:44:55 GMT
Message-Id: <202406041744.454Hitud037102@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 84ff9e9122ac - main - pf: fix overly large memcpy()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 84ff9e9122acf23252680784724d6d565e734d31
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=84ff9e9122acf23252680784724d6d565e734d31

commit 84ff9e9122acf23252680784724d6d565e734d31
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-04 15:29:13 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 17:44:20 +0000

    pf: fix overly large memcpy()
    
    We only want to copy the labels array, we don't want to copy the counter as well.
    
    Reported by:    CheriBSD
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sys/netpfil/pf/pf_nl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index 1074c561cd15..cf5146c716c6 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -532,7 +532,7 @@ nlattr_get_nested_pf_rule_labels(struct nlattr *nla, struct nl_pstate *npt, cons
 	if (error != 0)
 		return (error);
 
-	memcpy(target, parsed_labels.labels, sizeof(parsed_labels));
+	memcpy(target, parsed_labels.labels, sizeof(parsed_labels.labels));
 
 	return (0);
 }

From nobody Tue Jun  4 17:48:16 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtyk85pKyz5MJQg;
	Tue, 04 Jun 2024 17:48:16 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtyk85FM3z4LnQ;
	Tue,  4 Jun 2024 17:48:16 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717523296;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=PWCEKUe/9sQF4rmfT/pe99GQi0LA4YSzAetZkRYLcA4=;
	b=rz3S9Vek87NUgFYcTzokzPFjcInKkuJoBP0BzpwPnHjJQBT9IcXgDqZqJShr/ZOGVReeac
	KePibyQK3tJQzWzTZdqE3rP1RfYu0+l6L5ybMvHuo46kyZg7WGzcPNoQSJSmt0UA6cE+fz
	w1OZ2UqR0w6gIvwP8MFOnMoYuZTHpePeFBjl2WVXy+8vYMqFyMRwomxszOHhOluRN4EDAd
	xDzY6L+CWDFw5ZT0jUDAXzvIhRWYWc0vvf/5j/3vmg8dynIPyKtCkEylX7lFASnWyZi6Ua
	O5wXbyKnJ/o4KmEwqMeN2nIaZIRi9FLanC5N+S0jKLCF7t2H+3NOxat77cOCSg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717523296; a=rsa-sha256; cv=none;
	b=AGQ+PM2OLzBlaOFfdH6ULycB4M4JoIYcLe2W69PQD5sMH0LcyVu9HuntBtn9p6xMptXX8E
	WQxgIPbbA2r9fFeqWMPgJ7ARd52JWBRzVJvsBaxLJq1zmbGHVx7qvqRWkKxmiBkaBdMCz8
	ac7Wa5VQ20b44IqZyv14P2XqcA32yue2w4FRAgY/Oti9zhdrciPWfjIcX29Z6OoWcMO5c6
	CZc2Vscfr0DCwjwaecnVkv6WXHGUo/+hICHjdl/x9pGX7QVEqLoF/siClR/b65JjcyJdWt
	kD1WGyia3itQr+/iSOyCi5I9IZPulwplIPfU42q+sJ0EM5VjVPsMeS5Ypv7k1w==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717523296;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=PWCEKUe/9sQF4rmfT/pe99GQi0LA4YSzAetZkRYLcA4=;
	b=PB2ZeL8XrxSjEEix9tNBzK2mxwicyFeUw6g5SgExW2P/Ga70XpMZaXQcAmRrvvKiCLkEu0
	STWYx3nMl45JzlM0ZcnZ352ucCrW8KQUzyz/MaH2JJp+IAr3F2dcNQvpv692kQhdN2h4/L
	bXleDAHm5curb99z8Gj23wpjnkijPjQDTn74f6dBzNBEbuLF0gxCEyyOSVGPvUWqSC46qZ
	ULZxVJrSJ8RHcX4nrCrzeT8dPfZYBXKatiB6yNynHygyuzsw7PS6I6Ht2ugVNgdyDailr4
	/OAHUGlC2/k24QoYPPnm4YnktCD4PZXoMt1OWVGYOAAzsd0Aqlrbe+YUNN9APQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtyk84rQrzSJr;
	Tue,  4 Jun 2024 17:48:16 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454HmGS9037694;
	Tue, 4 Jun 2024 17:48:16 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454HmG9S037691;
	Tue, 4 Jun 2024 17:48:16 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 17:48:16 GMT
Message-Id: <202406041748.454HmG9S037691@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: 41d6858ebd6a - main - git-arc.1: list width typo
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 41d6858ebd6ae0431196c1bc6f03f8e388eae8e6
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=41d6858ebd6ae0431196c1bc6f03f8e388eae8e6

commit 41d6858ebd6ae0431196c1bc6f03f8e388eae8e6
Author:     Alexander Ziaee <concussious@runbox.com>
AuthorDate: 2024-06-01 06:19:33 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 17:46:46 +0000

    git-arc.1: list width typo
    
    Reviewed by:    mhorne
    MFC after:      3 days
    Fixes:          760be44702 ("git-arc: document "create" command options")
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1272
---
 tools/tools/git/git-arc.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tools/git/git-arc.1 b/tools/tools/git/git-arc.1
index 5ada942d13a9..10662899f5fc 100644
--- a/tools/tools/git/git-arc.1
+++ b/tools/tools/git/git-arc.1
@@ -73,7 +73,7 @@ The available verbs are:
 .It Cm create
 Create new Differential Revisions from the specified commits.
 Accepts options:
-.Bl -tag -width subscriber
+.Bl -tag -width "-s subscriber"
 .It Fl l
 Before processing commit(s) display list of commits to be processed
 and wait for confirmation.

From nobody Tue Jun  4 18:02:23 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtz2R6t7bz5MKrl;
	Tue, 04 Jun 2024 18:02:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtz2R6Hdjz4NXf;
	Tue,  4 Jun 2024 18:02:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717524143;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=02IGJ3Oa/EFnZi8v2kDdqbc6ioKA271Y/g+a6WUuivk=;
	b=tM0InckHh6r6Uc4h8wkVK9lt7mfw+XCCO8znpjGB5elFL0qr/4Mj4LE/6of7+T7N8YYAPT
	K7PUFkfj28cV2fVhm3cPbXUN0QnNM92E+M2eO6t5fZjQZarAB7DsrRKw0Vb3+rJANpUdIh
	Br8U4jv7KcEOFJxz0fm5GKqnxz4D+ORbh5pG3tPiNv/Nv/xhTHiXIT0Xd4PmhRw2aGzyz7
	xe+gXm6Z/audscwfy7Y7ek5vPoXU0M6tbNmFAIhN6+iHYaG/o0Wtd69ElZ7KHTdt13P5UR
	mpbxemXDuQ58trTEP9jdUu2E4i9jaWiDCaEUIevtmYy5VXM6P6nGN1sJoQnOBg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717524143; a=rsa-sha256; cv=none;
	b=R5AoYnEUFHl2c5VrQ3gbWPuLBwxZv/jtxNktp/lI9pkAcXtM41sabpnd8NCVncFL0x3E3k
	2i9EQsBEas2yYaSM32vZrAHEMda02Wzivgb+T80JOGnUsE6HwR16sJ2FLNBKqvIB89HSLu
	vN7nKK8m65GrwAdeUoIVSAwPMgZj/0yQIgNwMwt7XV+sRPCuhA8n6SZidrErB4hJHdOBtT
	iX7K9l9y1sk5H8VDGPxus8J+dUMp4xIqkNea6ZxSIYG4Uxlp1oy4Mfgi7cesfhmiF8eLeY
	EZswlHMIxLCxuHlrhIHl8JLvD7YIUy6cP0GXIAFMeKzDIhOX5pTNAAfWYdCwfg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717524143;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=02IGJ3Oa/EFnZi8v2kDdqbc6ioKA271Y/g+a6WUuivk=;
	b=Hz7hU+tObGzWxQq8U0uu9gtUiXEXFmb1yOr9e0F2bVfD79/5HC36wkS6udf0TolMaQumrF
	gsqbdedEomcZH8fPhOLxpIeWTEviMR5UU1TBgrulZMc/ag4mK5BBcRCN8KNYREi4kgUG++
	NT5qR3TERygiatHcK3UobqIKIeVgi7BLCV0RIkIddYVcwkyD2+ejUF/svlWoPP35mQwiBy
	svqZ7ihJmAegd4Jcybm2SelmtMfnO4+zu7FJxAfIzhB/2ckP4wvu7OiNegY6pGJr1Z3+aL
	Z70WDnMNcqEgL8VM0sOozgzNTF47Qi5V0U+Ly12xypQhCqWO6tK+Rv/EZgCEtw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtz2R5vYBzTBL;
	Tue,  4 Jun 2024 18:02:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454I2NaL071877;
	Tue, 4 Jun 2024 18:02:23 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454I2N1c071874;
	Tue, 4 Jun 2024 18:02:23 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 18:02:23 GMT
Message-Id: <202406041802.454I2N1c071874@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: 9ff1462976fc - main - x86: simplify ceil(log2(x))
  function
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 9ff1462976fce4f4389be9a3357eadd22d04d308
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=9ff1462976fce4f4389be9a3357eadd22d04d308

commit 9ff1462976fce4f4389be9a3357eadd22d04d308
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-04 18:00:25 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-04 18:00:25 +0000

    x86: simplify ceil(log2(x)) function
    
    A function called mask_width in one place and log2 in the other
    calculates its value in a more complex way than necessary. A simpler
    implementation offered here saves a few bytes in the functions that
    call it.
    
    Reviewed by:    alc, avg
    Differential Revision:  https://reviews.freebsd.org/D45483
---
 sys/amd64/vmm/x86.c  | 5 ++---
 sys/x86/x86/mp_x86.c | 6 ++----
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/sys/amd64/vmm/x86.c b/sys/amd64/vmm/x86.c
index 3cf689217590..aa8f87c98fe8 100644
--- a/sys/amd64/vmm/x86.c
+++ b/sys/amd64/vmm/x86.c
@@ -61,14 +61,13 @@ SYSCTL_INT(_hw_vmm_topology, OID_AUTO, cpuid_leaf_b, CTLFLAG_RDTUN,
     &cpuid_leaf_b, 0, NULL);
 
 /*
- * Round up to the next power of two, if necessary, and then take log2.
- * Returns -1 if argument is zero.
+ * Compute ceil(log2(x)).  Returns -1 if x is zero.
  */
 static __inline int
 log2(u_int x)
 {
 
-	return (fls(x << (1 - powerof2(x))) - 1);
+	return (x == 0 ? -1 : fls(x - 1));
 }
 
 int
diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c
index 1027c2c8972b..3c08f7fa987d 100644
--- a/sys/x86/x86/mp_x86.c
+++ b/sys/x86/x86/mp_x86.c
@@ -183,15 +183,13 @@ mem_range_AP_init(void)
 }
 
 /*
- * Round up to the next power of two, if necessary, and then
- * take log2.
- * Returns -1 if argument is zero.
+ * Compute ceil(log2(x)).  Returns -1 if x is zero.
  */
 static __inline int
 mask_width(u_int x)
 {
 
-	return (fls(x << (1 - powerof2(x))) - 1);
+	return (x == 0 ? -1 : fls(x - 1));
 }
 
 /*

From nobody Tue Jun  4 18:08:37 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtz9d5sxLz5MM2j;
	Tue, 04 Jun 2024 18:08:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtz9d5KYYz4P1h;
	Tue,  4 Jun 2024 18:08:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717524517;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=24afK4efuJ+k2wFWX7FJBtmypjT8cIqN/Dbl8em61iA=;
	b=UeUxcscLV7yAs9pRbXPO+IIpdSlIHgdatG61QGlKG3pcAgxunLvPGlwQu4GvYMxKqG7/FW
	QEy+JhbXcn7B5QvlSd5vrs/iwDozO3EX/ulrFh29Ccs8yZz8nkpsogxszkRpbAJYIEDIU5
	vrlBBCJukJHaeuneGGYq72gG37TiAhjSSKZNbgo2spdbH5EpOlcZL8RY4xgY8SjUuLITVB
	+bchpd7FSoDgolhfp88ePHIXm2T7SQYOQhpDeH1f8zC2r+ey8KB7OHd5nqz1Bti7PmIUQ9
	KvdfB0Ta27RYAhZLfq3UhITkpudSqS91q97IHYanrQF7J7L960C+ca5NF1xLcQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717524517; a=rsa-sha256; cv=none;
	b=N6uOjAgcKZiZZwe/26aSQx3u/CnyJf4yLB5tvXCLmhiulBV/PqWtH6gNmco23XyUykxkL0
	8ni5mIvk6jSQmHYhT6ItDLoMURAA3LViT+k2VjsMJbA9aZnDqBgoBTnz9D6Kt5wM1Loqcq
	yQq5AkYBNklQ6BkB1SYbHjRrGYFL4kHh0jf4FNTdOoZBA72J2igLVtpBnfyxU6DjAjZdBI
	wzDHAFqsE05+9mVKmZFqjiSIRfpPLeJUXGK0rTHYvsDwfisIEwsK7VNjjxZiEN6o25Or34
	j5iCt7zgS+PWTkZ29AWdjJlIxWeAQxf8p/k2V9hoNYZKGpdf9qtLjkmHd8O78w==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717524517;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=24afK4efuJ+k2wFWX7FJBtmypjT8cIqN/Dbl8em61iA=;
	b=C4xpdZouLmCea/gHvU5Y7nL3qR2prbPccOml9qw5jUnkzbpJXG1U1OEnoNSw6JkpFrXFIE
	mh4xU70DSUrWNLzr2GFHd1gCqTpTB6GxXkowjixcCxw/mgf5Tgk5WOL/TeJgr7FxIijQhB
	CPGFGm7SKtG6FsbQS25D/2rggZ88w13r0z1VW8mgefQvFH/gpovn7S60vYfrkrffAr2vPb
	fXyyh+Qz+w0HaM3D+ihleGjEamUmp43BMhMiYsF/V+L8r0SPALSM0LiUjz43pvfWnYpCSn
	JB8EKODMgxLEYnj9g8w5ojC0FgDX/c395uSwB5aipcUD7zfMtg4A2TJ6M6Kjpw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtz9d4VbbzTL1;
	Tue,  4 Jun 2024 18:08:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454I8bwL072913;
	Tue, 4 Jun 2024 18:08:37 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454I8buP072910;
	Tue, 4 Jun 2024 18:08:37 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 18:08:37 GMT
Message-Id: <202406041808.454I8buP072910@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: 543d55d79109 - main - vm_phys: use ilog2(x) instead
  of fls(x)-1
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 543d55d79109ce47e43a98af16232aa86d0e02ec
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=543d55d79109ce47e43a98af16232aa86d0e02ec

commit 543d55d79109ce47e43a98af16232aa86d0e02ec
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-04 18:07:07 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-04 18:07:07 +0000

    vm_phys: use ilog2(x) instead of fls(x)-1
    
    One of these changes saves two instructions on an amd64
    GENERIC-NODEBUG build. The rest are entirely cosmetic, because the
    compiler can deduce that x is nonzero, and avoid the needless test.
    
    Reviewed by:    alc
    Differential Revision:  https://reviews.freebsd.org/D45331
---
 sys/vm/vm_phys.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 66ad9c13dceb..62e84a5b52bd 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -699,14 +699,14 @@ vm_phys_enq_beg(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
 
 	KASSERT(npages == 0 ||
 	    (VM_PAGE_TO_PHYS(m) &
-	    ((PAGE_SIZE << (fls(npages) - 1)) - 1)) == 0,
+	    ((PAGE_SIZE << ilog2(npages)) - 1)) == 0,
 	    ("%s: page %p and npages %u are misaligned",
 	    __func__, m, npages));
         while (npages > 0) {
 		KASSERT(m->order == VM_NFREEORDER,
 		    ("%s: page %p has unexpected order %d",
 		    __func__, m, m->order));
-                order = fls(npages) - 1;
+                order = ilog2(npages);
 		KASSERT(order < VM_NFREEORDER,
 		    ("%s: order %d is out of range", __func__, order));
                 vm_freelist_add(fl, m, order, tail);
@@ -735,7 +735,7 @@ vm_phys_enq_range(vm_page_t m, u_int npages, struct vm_freelist *fl, int tail)
 
 	KASSERT(npages == 0 ||
 	    ((VM_PAGE_TO_PHYS(m) + npages * PAGE_SIZE) &
-	    ((PAGE_SIZE << (fls(npages) - 1)) - 1)) == 0,
+	    ((PAGE_SIZE << ilog2(npages)) - 1)) == 0,
 	    ("vm_phys_enq_range: page %p and npages %u are misaligned",
 	    m, npages));
 	while (npages > 0) {
@@ -1193,7 +1193,7 @@ vm_phys_enqueue_contig(vm_page_t m, u_long npages)
 	lo = atop(VM_PAGE_TO_PHYS(m));
 	if (m < m_end &&
 	    (diff = lo ^ (lo + npages - 1)) != 0) {
-		order = min(flsll(diff) - 1, VM_NFREEORDER - 1);
+		order = min(ilog2(diff), VM_NFREEORDER - 1);
 		m = vm_phys_enq_range(m, roundup2(lo, 1 << order) - lo, fl, 1);
 	}
 
@@ -1225,7 +1225,7 @@ vm_phys_free_contig(vm_page_t m, u_long npages)
 	vm_domain_free_assert_locked(vm_pagequeue_domain(m));
 
 	lo = atop(VM_PAGE_TO_PHYS(m));
-	max_order = min(flsll(lo ^ (lo + npages)) - 1, VM_NFREEORDER - 1);
+	max_order = min(ilog2(lo ^ (lo + npages)), VM_NFREEORDER - 1);
 
 	m_start = m;
 	order_start = ffsll(lo) - 1;

From nobody Tue Jun  4 18:27:58 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtzby4rY6z5MNsl;
	Tue, 04 Jun 2024 18:27:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtzby4CYQz4R0J;
	Tue,  4 Jun 2024 18:27:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717525678;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=SG7kJrRmjEuEj/9uLYSObnWfpHR0s7izT6E8B7xiJ1M=;
	b=ek2YxoRFY/c81mFSeDdyrDUv6ogb6LLlCjExqSyZYcc1yZLD3tsNEShpZ9blBYiajh9btA
	BDB0Vtu6WW1HlRwi/F6BB+Hh//CB6yxILj3OKicRynv7P9ZjeDoOZQ5RSUhPFzdcPv/Xon
	0ARwat+MfN2B+c3/Pn/PUEdL6BH+LanNI8b4YJStTJSq3gPliETvk+42nY55llGFBWfFsY
	y8IE3osB2Jp97+wgpKZPHLHbXB6Q9ciMJyZ9kCP1aP+PPX2EtDAaEOXi1I+kUhWVZK7W7R
	fBGfOIfG3j6G2fJLI0pQTiDdYjtk9xUIXv14ox++O5wiKhv4dWx+IgXggaQ2uw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717525678; a=rsa-sha256; cv=none;
	b=juJHYMl2Ajs9AazhtY2dPkSHQ2aW0eSAJ7KxXWI61Wli/C2Kq1mvrCq5Qzjc6/ejUf3Xi7
	iCNTg7e5E3oX8j6kbx3fIee0giLbYGD90jhRTigM3GchIJbyuWlqo9ATPafuMKte9P7HzH
	RCJssukd3MjOj+doFCeB1ZOIrtvtlALoFBNqdmIkf9zg7gM0p96qhqtP3QNVAP2yeiMUVs
	yM7L8nKhc3DjuISlOi0jJr4KURpm5f0gN1AAnu+sfMuEk9BbaSS3uV05L/LdTT8gZV4/t2
	K1ctpQ73fVEAczzRgyd5VFC1UI9+MbFyoJQiBSwCYJZRgBJLmIorkxiQHuyuag==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717525678;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=SG7kJrRmjEuEj/9uLYSObnWfpHR0s7izT6E8B7xiJ1M=;
	b=N0VM4E8tPR3qgshy8BrVVH0/uYIIpzk8dVRqUtOvDmLED4WttUzwjxdnLL8ifl4BFf0jyL
	6kExKTh/N9O2d2PTIOY97WAcwx/B0OIm08T/2VPBs3eA3ebBbX3nKWIZs0evuBC2YcROq8
	8GXU43rIRD6FVvxGI9JlEEy6lvzcTB8nlBJ+IDPdj/+8pX8Pgj4eChILVz7jUcIXow376z
	1jq/7qBdTS4/I2a16qSIxkj8Z69qkmDf/72xc9dX8072G4cechJggOeZc49xE2ohOuPjFy
	nFqWpK7ioCr7r7d3bjsJf2sYjEa9EChSxbXcaxI3CiwmuZJ46EqyKwHGhwBhUw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtzby3hvHzTjH;
	Tue,  4 Jun 2024 18:27:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454IRwMa005942;
	Tue, 4 Jun 2024 18:27:58 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454IRwpF005939;
	Tue, 4 Jun 2024 18:27:58 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 18:27:58 GMT
Message-Id: <202406041827.454IRwpF005939@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: 8327796cc873 - main - build.7: nit section order, tag
  spdx
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8327796cc873ad86dfdef2846412a68709dcbbf2
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=8327796cc873ad86dfdef2846412a68709dcbbf2

commit 8327796cc873ad86dfdef2846412a68709dcbbf2
Author:     Alexander Ziaee <concussious@runbox.com>
AuthorDate: 2024-06-02 13:23:40 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 18:27:50 +0000

    build.7: nit section order, tag spdx
    
    Reviewed by:    mhorne
    MFC after:      3 days
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1273
---
 share/man/man7/build.7 | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index 596c64da0673..6b270ea7b81d 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -1,3 +1,6 @@
+.\"-
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
 .\" Copyright (c) 2000
 .\"	Mike W. Meyer
 .\"
@@ -891,11 +894,6 @@ cd /usr/src
 make TARGET_ARCH=armv6 buildworld buildkernel
 make TARGET_ARCH=armv6 DESTDIR=/clients/arm installworld installkernel
 .Ed
-.Sh HISTORY
-The
-.Nm
-manpage first appeared in
-.Fx 4.3 .
 .Sh SEE ALSO
 .Xr cc 1 ,
 .Xr install 1 ,
@@ -911,5 +909,10 @@ manpage first appeared in
 .Xr etcupdate 8 ,
 .Xr reboot 8 ,
 .Xr shutdown 8
+.Sh HISTORY
+The
+.Nm
+manpage first appeared in
+.Fx 4.3 .
 .Sh AUTHORS
 .An Mike W. Meyer Aq Mt mwm@mired.org

From nobody Tue Jun  4 18:27:59 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtzbz5y8pz5MP3f;
	Tue, 04 Jun 2024 18:27:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtzbz4ggQz4R4H;
	Tue,  4 Jun 2024 18:27:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717525679;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=YnLnkbhThxu33m0fuM2/nZ7gvQSmHzo0iZPK5DN+9zw=;
	b=JU+j8eOTAXl/tSPa+LEVqoIuyYicIqgxL8HDjPMsaUCKy7aAyFTJ2Tfb+E2UycNrEjCdRL
	9Q7TvBJDlK+ZaEaVXtT2Bj5DXOKz/g22H+pkEfMd3KgfnyRPeJvRZ43PRGqUjxxaD+vO43
	q3aejzgaqQkJbBk3KFF13Em9sN1RuzQURn1uvrF8KNHXhVQdZ0QBG8YkuMqoWZ/pCDmdW2
	4ZQ5wrVMxCdBOKhxbzLR10esdzY3PsKaOyShPWitrQzbCf/3HE3/a6P/OFkcqRMPraX1Yk
	J3/CUz3Bl/td1zfycxZnRgJXdut52jsQaa2j0i49wxVPwY2IBPizXFkXJ8afPA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717525679; a=rsa-sha256; cv=none;
	b=EMo2jWxnRLycvaWKX+HROOrtolXTSezhNpgyPTPOJXxZdeZn+gmoI6eV9hgvFSowmEQqmn
	7DH+NnawDz9QbVxeKDjRJYp7G22YcSZsfYRedzAH4yi+2FOZoQJaqWQEeP08VJExfM+HK6
	x6apGhn2R48T4lxXFxZTTb6PKL6tx6YuRpV2+MZ8CnMO4uhG55o/YIkcbPCL81044rWRDL
	Z6t+gj/QCT7edVNUALpDLPxugIJ7aJuFxSaZo938Ab23CBdCkrxWScs7vb0jbfZtuwvUVX
	CW0Y5hEzO4lMY/QB8xPDPeyJZJTA1Rus4A+yQsrtaUZ6JntQuYqqeUT3Ofs9Rg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717525679;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=YnLnkbhThxu33m0fuM2/nZ7gvQSmHzo0iZPK5DN+9zw=;
	b=vRxSDVzw++2gx66mE0Ax5CWy1er46V1cwmXSbPBqJhxUzDxTrbzYQSHBix/JOJGwa4Ahuc
	QWLP3XCXCvyed4Q7XEH1YRMLfmvnegM73uNCtrvC67uX+2Tch3VbWyQRY5Vof3QtS/kZEa
	6tqj9T+4+xeEveO3cBLJMkqiJzDnlwTmPYSny3DJ7O1fQ7wl98ljVq3Z/WGTlZdIfWfSfj
	7wd0iYS+YaZOn8Dkk2lk5vzl793IoiKJZDym/3i7hGZZJ0vAoBZLAYe+PaQSWAeGFeeBnU
	lUgURwkkYMJNdQ/H6YAKUxdwDrMdPc7jIc/3f2N8Ck055VszpwPmJE+ExfBGgw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtzbz4HJ3zTjJ;
	Tue,  4 Jun 2024 18:27:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454IRxu9005988;
	Tue, 4 Jun 2024 18:27:59 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454IRxCg005985;
	Tue, 4 Jun 2024 18:27:59 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 18:27:59 GMT
Message-Id: <202406041827.454IRxCg005985@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: a8a2d5ef126f - main - build.7: +freebsd to description,
  link development
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: a8a2d5ef126f9ed866f2524a4fe012ba831add2f
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=a8a2d5ef126f9ed866f2524a4fe012ba831add2f

commit a8a2d5ef126f9ed866f2524a4fe012ba831add2f
Author:     Alexander Ziaee <concussious@runbox.com>
AuthorDate: 2024-06-02 13:25:19 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 18:27:50 +0000

    build.7: +freebsd to description, link development
    
    Reviewed by:    mhorne
    MFC after:      3 days
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1273
---
 share/man/man7/build.7 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index 6b270ea7b81d..b6f8c0a2881f 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -30,7 +30,9 @@
 .Os
 .Sh NAME
 .Nm build
-.Nd General instructions on how to build the system
+.Nd general instructions on how to build the
+.Fx
+system
 .Sh DESCRIPTION
 The sources for the
 .Fx
@@ -901,6 +903,7 @@ make TARGET_ARCH=armv6 DESTDIR=/clients/arm installworld installkernel
 .Xr make.conf 5 ,
 .Xr src.conf 5 ,
 .Xr arch 7 ,
+.Xr development 7 ,
 .Xr pkg 7 ,
 .Xr ports 7 ,
 .Xr release 7 ,

From nobody Tue Jun  4 18:28:00 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtzc11XSSz5MNyL;
	Tue, 04 Jun 2024 18:28:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtzc06sjXz4R4Q;
	Tue,  4 Jun 2024 18:28:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717525681;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Xg5MQISZdlxUUW4pHsXkOzNqYG7Leic/IbJGpVPGFAY=;
	b=WC7uL+HG4dgmgy5zc8UtwdxZkXCCivbiTSbmRVF8elvojaj5glwF78IGD5tqvzjNolt1u0
	bxWt7HLDTbWI5ucWjqONHadoWMgcFFDkWKwbuevL99btoGfZ/SPa4aE8FCc5UJZDFiRXOc
	6TIigNwX1WetNoWbHGeaxdUsFTMvAD2WCsfJOHWBeDpgU29f4kWoBFDaEYbPFsJBWpxGXb
	wLPguzF7lea1n8tjduDDBw2AXpntPqVM9GdA28KzZi9Gv8sAm7LEX9FXtXpZY7/Kz0VTMx
	xYtXB9FTPoKPdM5kgtntsTKb7c8ZNNSul8oT7EZ2esf7Sz/RjzYf6+lR1edmaw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717525681; a=rsa-sha256; cv=none;
	b=njic7HkzMYuxZJ10ZK9vF4fw+vvoEl34cvvyaJdVA7QDgUhWAKdXoCs+otA1wMMxRDHPmS
	c6eSPfxJ2cY5RCa7H0nyMIvVRbxApXIdvfseu5BT61NCrgO7TwYBRiuCf/3Bk61AAk1Ylh
	aVycBwAMw3aVC9MRSI+bmGuDxHzj8So32FCkKZqOAKn5OrYlaqd+9pZq0KMf8I1YFHTP3M
	rRAM5DRcTQJDJUNYbFc4WnrDvS62Qj+dL8rhkAWSQWzByehfLVNCI2CXZguOG5xhPlqwSy
	/C5ufGG5n0TaYPV7h4YhUEH4qqSCwedlxByW79hN93e9Fc0Sz/RxQKrzw7GvLA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717525681;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Xg5MQISZdlxUUW4pHsXkOzNqYG7Leic/IbJGpVPGFAY=;
	b=VzLnIYQfP/PQAo6IUeJjaBEpO0oT0geeRh8DRv8eI9PS+MTMINkfUoebcrLk9/SwFxS1nl
	TSu9Jq+aopmQxPcxHuaWyTVJ/76DCwY0DWMAuhdtwNNcmF5J/BpLftQz76Ws9whhmscrWc
	tLueIjMrk7GnTvpc4RQrVJyPG9HCI8F2coD5Azxi6yK61FRMCTUbaR76TW5r+0Jh+XedK8
	teZIly4bj5nJhddHLUK6SHxxK4ejHfeIl5GhKfVW9VRxq6PElypm+2k7TrAhwt/qxGflt/
	mzP/2WbbNqOOaNqoaN0+L1jcgK9vJW2BOw6gQcr3wM3louXJWJeA0lQ/7HIgbQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vtzc052MkzThm;
	Tue,  4 Jun 2024 18:28:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454IS0Fk006035;
	Tue, 4 Jun 2024 18:28:00 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454IS0W4006032;
	Tue, 4 Jun 2024 18:28:00 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 18:28:00 GMT
Message-Id: <202406041828.454IS0W4006032@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: afa166be99fc - main - build.7: update cross-compile
  example
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: afa166be99fc202027ab5b2030205b59d5104299
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=afa166be99fc202027ab5b2030205b59d5104299

commit afa166be99fc202027ab5b2030205b59d5104299
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-06-04 18:22:54 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 18:27:50 +0000

    build.7: update cross-compile example
    
    Replace armv6 with the more-relevant arm64.
    
    MFC after:      3 days
---
 share/man/man7/build.7 | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index b6f8c0a2881f..3c71c14e6039 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -25,7 +25,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd August 1, 2023
+.Dd June 4, 2024
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -889,12 +889,13 @@ method of updating your system from the latest sources, please see the
 section in
 .Pa src/UPDATING .
 .Pp
-The following sequence of commands can be used to cross-build the
-system for the armv6 architecture on an amd64 host:
+The following sequence of commands can be used to cross-build the system for
+the arm64 (aarch64) architecture on a different host architecture, such as
+amd64:
 .Bd -literal -offset indent
 cd /usr/src
-make TARGET_ARCH=armv6 buildworld buildkernel
-make TARGET_ARCH=armv6 DESTDIR=/clients/arm installworld installkernel
+make TARGET=arm64 buildworld buildkernel
+make TARGET=arm64 DESTDIR=/clients/arm64 installworld installkernel
 .Ed
 .Sh SEE ALSO
 .Xr cc 1 ,

From nobody Tue Jun  4 18:33:43 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vtzkg3Xljz5MPWT;
	Tue, 04 Jun 2024 18:33:47 +0000 (UTC)
	(envelope-from glebius@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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vtzkg2zt4z4Sd4;
	Tue,  4 Jun 2024 18:33:47 +0000 (UTC)
	(envelope-from glebius@freebsd.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717526027;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=SFH9K2YR3EZQxcTihcGRMwfqO2NM+MzPvOflALIjNCQ=;
	b=qGWYkaCsgKgdVS5DjXMIinnHuMxRuZHC01s5YxzPTgac1jqcX1brZQkNPOar8pAeDhdIZe
	oitnl29hhvVGSA2DEdw55nrkVKMO0p8dqxQqWtmgm9ZPybpou2U2/3uLZcZ+cV/p4EqT4/
	InJhxtu71COxS6agu8pGAK8WOjZC9+e7fsq3Y/1KDnghOke6ViYZz7l80dQ4Q9r+yIYg9/
	A7BzpADJHs+0hn9FKF45vbUWVIdtRCNAAhW9RSSikT2d2855OAc1tqDymcqJXtGyFczy78
	i0PMgd1NpZ3BGZOYaTTovaPblX6tpLXL2PN5ymgp1QWDEpwc1O4CuInNbBud1g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717526027; a=rsa-sha256; cv=none;
	b=A/iUld2CzYscisXFJ3Jo2acZO0nl6GKsB1bPh9wizEL4K49oo3TSxdli0YGHE50r0lk/hw
	Le15s1ZFPdKQbOoRH4lpbEcF67TEDWmP1bbKq4jIZsOEg967F/0v6m9LZo5DKu6xpzqIhX
	14VIfNX8MiC4EL445UIUqE+1KufuJwru1KaVyNcqOpVu7k51DNaSctOubJwZEpdsXlXyr7
	oVFeI7r8SBt9aKNixqsIBVXTh3YdKXhlK4u3lq7xXnUrk21auucMqyQ+/qXN5aTMGxKVXH
	54k6M9yOOfPNmcGXZVqaLEEIzMMrw+zvEpTczDRmpgUdipiPPKZa9KVT4IslDw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717526027;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=SFH9K2YR3EZQxcTihcGRMwfqO2NM+MzPvOflALIjNCQ=;
	b=Bn1Fa1lnOB7VqKSA8U4EJalMkSbr96jybG+y3yWCxcfbb2rJh1Aftr4XuCJf2uZCwqcscF
	UbKMJvmsIYdn5AlaDZNR4hLsqia3VmbJn/AEgtFRbsH/hpU6cpV2smbHvYvUxQMmSw5H2m
	bfZ1huQ0LQW97vEOsDvyWPsgjIQZuC+GQWng4W+Zib8YplhU7ZWN7whfByZ1xHcc2BSKWB
	59RfitvxmurCZFcgXbAIA5623srOb49MZajQUa3kVY06voD6w94nIdvZiuAF4AoBLutAlx
	fX4RYw+orEvhCoa6sx28j/wwnD0ZVysqhbukgU1YeD50eLpQe4/Eo5k6f3+yZg==
Received: from cell.glebi.us (glebi.us [162.251.186.162])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: glebius)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4Vtzkf59bfzHkR;
	Tue,  4 Jun 2024 18:33:46 +0000 (UTC)
	(envelope-from glebius@freebsd.org)
Date: Tue, 4 Jun 2024 11:33:43 -0700
From: Gleb Smirnoff <glebius@freebsd.org>
To: Brooks Davis <brooks@freebsd.org>
Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org,
	dev-commits-src-main@freebsd.org
Subject: Re: git: 9b8db66402e9 - main - netgraph: provide separate malloc
 type for nodes that are missing it
Message-ID: <Zl9eBxOKnnx0WBrX@cell.glebi.us>
References: <202405311620.44VGK2xX033356@gitrepo.freebsd.org>
 <ZloQ5HpJa27AWVP4@spindle.one-eyed-alien.net>
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <ZloQ5HpJa27AWVP4@spindle.one-eyed-alien.net>

On Fri, May 31, 2024 at 06:03:16PM +0000, Brooks Davis wrote:
B> > Author:     Dmitry Lukhtionov <dmitryluhtionov@gmail.com>
B> > AuthorDate: 2024-05-31 16:19:54 +0000
B> > Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
B> > CommitDate: 2024-05-31 16:19:54 +0000
B> > 
B> >     netgraph: provide separate malloc type for nodes that are missing it
B> >     
B> >     The kernel option NG_SEPARATE_MALLOC helps to debug memory leaks in
B> >     netgraph(4).  Several nodes were missing the support.
B> 
B> I realize this commit didn't create the option, but is there really
B> enough of a cost to having multiple malloc types to justify an option at
B> all?

This is just how it has been since early days of netgraph, and it makes
some missing nodes to honor the flag, thus I just accepted the
submission.

I have no objection if afedorov@ or anybody else takes a more thoughful
evaluation and changes that.

-- 
Gleb Smirnoff

From nobody Tue Jun  4 20:06:30 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv1ng0kssz5MQ8C;
	Tue, 04 Jun 2024 20:06:31 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv1nf6vz5z4fcp;
	Tue,  4 Jun 2024 20:06:30 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717531591;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=lhWDlSSg6Q6S7OoP2DI7Qq9dNRIx5AB2R4/omjPWnu4=;
	b=OtafCPhdH9mYPdrGTtHrtLumJQy6JUdzd8m3Kayj4mjqcAynUYccXs008+jksuG4MHVxkI
	rIgq58907Zhg7pToAosr2tA77wg8DcSC0/zUmqmZtmCoMAt4UXcNzWUtYoA95zbVU/GFIh
	ui+uTnBnu+InoCbMLq+HD6rYVQ1nx5zLzAjtluVTE+KJtjegANggcTudhdNhK39gitzbOC
	CfrYE8aE+eV+uOPElsYHTqluJhQnjHUahBtXXCgfKIF4IZADEeQXP3YCHS9claLqLqrKTb
	+zBDf7FPyFnejetPNkWBpi9EmPBbbQqq4bEmxTpsbrsZpu1dywZF+jye4Arkpw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717531591; a=rsa-sha256; cv=none;
	b=H/rZRc7maK6/1wkVq/v/qoQB36RVdKsCtv9hP8yL583tuA8REarsLERm/kMGWzCSRayPDb
	/5mK1evjiPpAglOF+MSF3DSItkpqmXkNzS9DDQ1M4I51IuGx6ud9dLUCHgxWmGuDA3CFvu
	Bv91ltN9wOsfB9qHIEWRZI6T3e/MG/7906SiRumJ0YXAjklorn/r1yC5qv7emil2hYuuOJ
	18DZ58QkdtnJGzJNgEGMpRov7oheukt4nGL8L+hHikDN170/j1Azz8gSEr82uJdgjJ1FyV
	Rru/86VrIJNDn6U7O7ipgA3SWogMNuGmnO5X4iQnh2/5N+akMBA4O27i8kevfw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717531591;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=lhWDlSSg6Q6S7OoP2DI7Qq9dNRIx5AB2R4/omjPWnu4=;
	b=EHzsFSZ8GoBs6X0TRpPec64N5wn+FGkh+f1I4DLaoPPXXwYJsq7KpWTxc698wuziw2cPSL
	EO9I95nNCHUtjGkkMCCyDhjGSiZF1ZveR4TL0tMfRVX7yEmTTr2StQA7PSAA8ghhadk31l
	dfLWKf8PMk908YwM9FG73y3x/22BOiBTFpAfSBAgvEqm35QDEE58MgplfXds7p2aVUKvPU
	9Qk8mMH8DBppPC5aynxrVtPG6KxeQxkeZxRAuvvvF2onDnXCzM2qDRcC7qpGrAc7nE2Dbc
	y+bgqPhIpF872wdNCU+XXHB2q2F7IjsOWqvzAPAug82yjrUFZ+sjh4blvwIA+A==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv1nf6W58zXls;
	Tue,  4 Jun 2024 20:06:30 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454K6U3N075071;
	Tue, 4 Jun 2024 20:06:30 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454K6UG9075068;
	Tue, 4 Jun 2024 20:06:30 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 20:06:30 GMT
Message-Id: <202406042006.454K6UG9075068@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mark Johnston <markj@FreeBSD.org>
Subject: git: 75cb949228bb - main - arm64/vmm: Add breakpoint and
  single-stepping support
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: markj
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 75cb949228bb97e49f35fd2b2585293a6b9212aa
Auto-Submitted: auto-generated

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=75cb949228bb97e49f35fd2b2585293a6b9212aa

commit 75cb949228bb97e49f35fd2b2585293a6b9212aa
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-04 18:58:08 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-04 18:58:08 +0000

    arm64/vmm: Add breakpoint and single-stepping support
    
    This will be used to implement parts of bhyve's gdb stub.
    
    Three VM capabilities are added, similar to amd64 without monitor mode.
    Two cause breakpoint and single-step exceptions to be raised to EL2 and
    then down to bhyve.  One lets the gdb stub mask hardware interrupts
    while single-stepping, since otherwise the guest will handle a timer
    interrupt before executing the target instruction and thus fail
    to make progress.
    
    Reviewed by:    bnovkov, andrew
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D44739
---
 sys/arm64/include/vmm.h   |  6 +++-
 sys/arm64/vmm/arm64.h     |  9 ++++++
 sys/arm64/vmm/vmm_arm64.c | 79 +++++++++++++++++++++++++++++++++++++++++++++--
 sys/arm64/vmm/vmm_stat.c  |  2 ++
 sys/arm64/vmm/vmm_stat.h  |  2 ++
 5 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/sys/arm64/include/vmm.h b/sys/arm64/include/vmm.h
index 8e2c9c868635..c06d2ad947e4 100644
--- a/sys/arm64/include/vmm.h
+++ b/sys/arm64/include/vmm.h
@@ -295,9 +295,11 @@ struct vre {
  */
 enum vm_cap_type {
 	VM_CAP_HALT_EXIT,
-	VM_CAP_MTRAP_EXIT,
 	VM_CAP_PAUSE_EXIT,
 	VM_CAP_UNRESTRICTED_GUEST,
+	VM_CAP_BRK_EXIT,
+	VM_CAP_SS_EXIT,
+	VM_CAP_MASK_HWINTR,
 	VM_CAP_MAX
 };
 
@@ -312,6 +314,8 @@ enum vm_exitcode {
 	VM_EXITCODE_PAGING,
 	VM_EXITCODE_SMCCC,
 	VM_EXITCODE_DEBUG,
+	VM_EXITCODE_BRK,
+	VM_EXITCODE_SS,
 	VM_EXITCODE_MAX
 };
 
diff --git a/sys/arm64/vmm/arm64.h b/sys/arm64/vmm/arm64.h
index 43459d14e143..8cfe77dcde6f 100644
--- a/sys/arm64/vmm/arm64.h
+++ b/sys/arm64/vmm/arm64.h
@@ -39,6 +39,9 @@
 struct vgic_v3;
 struct vgic_v3_cpu;
 
+/*
+ * Per-vCPU hypervisor state.
+ */
 struct hypctx {
 	struct trapframe tf;
 
@@ -104,6 +107,12 @@ struct hypctx {
 
 	struct vtimer_cpu 	vtimer_cpu;
 
+	uint64_t		setcaps;	/* Currently enabled capabilities. */
+
+	/* vCPU state used to handle guest debugging. */
+	uint64_t		debug_spsr;		/* Saved guest SPSR */
+	uint64_t		debug_mdscr;		/* Saved guest MDSCR */
+
 	struct vgic_v3_regs	vgic_v3_regs;
 	struct vgic_v3_cpu	*vgic_cpu;
 	bool			has_exception;
diff --git a/sys/arm64/vmm/vmm_arm64.c b/sys/arm64/vmm/vmm_arm64.c
index e71761f9ccef..e0547bcef914 100644
--- a/sys/arm64/vmm/vmm_arm64.c
+++ b/sys/arm64/vmm/vmm_arm64.c
@@ -700,7 +700,14 @@ handle_el1_sync_excp(struct hypctx *hypctx, struct vm_exit *vme_ret,
 		arm64_gen_reg_emul_data(esr_iss, vme_ret);
 		vme_ret->exitcode = VM_EXITCODE_REG_EMUL;
 		break;
-
+	case EXCP_BRK:
+		vmm_stat_incr(hypctx->vcpu, VMEXIT_BRK, 1);
+		vme_ret->exitcode = VM_EXITCODE_BRK;
+		break;
+	case EXCP_SOFTSTP_EL0:
+		vmm_stat_incr(hypctx->vcpu, VMEXIT_SS, 1);
+		vme_ret->exitcode = VM_EXITCODE_SS;
+		break;
 	case EXCP_INSN_ABORT_L:
 	case EXCP_DATA_ABORT_L:
 		vmm_stat_incr(hypctx->vcpu, esr_ec == EXCP_DATA_ABORT_L ?
@@ -1313,6 +1320,7 @@ vmmops_exception(void *vcpui, uint64_t esr, uint64_t far)
 int
 vmmops_getcap(void *vcpui, int num, int *retval)
 {
+	struct hypctx *hypctx = vcpui;
 	int ret;
 
 	ret = ENOENT;
@@ -1322,6 +1330,11 @@ vmmops_getcap(void *vcpui, int num, int *retval)
 		*retval = 1;
 		ret = 0;
 		break;
+	case VM_CAP_BRK_EXIT:
+	case VM_CAP_SS_EXIT:
+	case VM_CAP_MASK_HWINTR:
+		*retval = (hypctx->setcaps & (1ul << num)) != 0;
+		break;
 	default:
 		break;
 	}
@@ -1332,6 +1345,68 @@ vmmops_getcap(void *vcpui, int num, int *retval)
 int
 vmmops_setcap(void *vcpui, int num, int val)
 {
+	struct hypctx *hypctx = vcpui;
+	int ret;
+
+	ret = 0;
 
-	return (ENOENT);
+	switch (num) {
+	case VM_CAP_BRK_EXIT:
+		if ((val != 0) == (hypctx->setcaps & (1ul << num)) != 0)
+			break;
+		if (val != 0)
+			hypctx->mdcr_el2 |= MDCR_EL2_TDE;
+		else
+			hypctx->mdcr_el2 &= ~MDCR_EL2_TDE;
+		break;
+	case VM_CAP_SS_EXIT:
+		if ((val != 0) == (hypctx->setcaps & (1ul << num)) != 0)
+			break;
+
+		if (val != 0) {
+			hypctx->debug_spsr |= (hypctx->tf.tf_spsr & PSR_SS);
+			hypctx->debug_mdscr |= hypctx->mdscr_el1 &
+			    (MDSCR_SS | MDSCR_KDE);
+
+			hypctx->tf.tf_spsr |= PSR_SS;
+			hypctx->mdscr_el1 |= MDSCR_SS | MDSCR_KDE;
+			hypctx->mdcr_el2 |= MDCR_EL2_TDE;
+		} else {
+			hypctx->tf.tf_spsr &= ~PSR_SS;
+			hypctx->tf.tf_spsr |= hypctx->debug_spsr;
+			hypctx->debug_spsr &= ~PSR_SS;
+			hypctx->mdscr_el1 &= ~(MDSCR_SS | MDSCR_KDE);
+			hypctx->mdscr_el1 |= hypctx->debug_mdscr;
+			hypctx->debug_mdscr &= ~(MDSCR_SS | MDSCR_KDE);
+			hypctx->mdcr_el2 &= ~MDCR_EL2_TDE;
+		}
+		break;
+	case VM_CAP_MASK_HWINTR:
+		if ((val != 0) == (hypctx->setcaps & (1ul << num)) != 0)
+			break;
+
+		if (val != 0) {
+			hypctx->debug_spsr |= (hypctx->tf.tf_spsr &
+			    (PSR_I | PSR_F));
+			hypctx->tf.tf_spsr |= PSR_I | PSR_F;
+		} else {
+			hypctx->tf.tf_spsr &= ~(PSR_I | PSR_F);
+			hypctx->tf.tf_spsr |= (hypctx->debug_spsr &
+			    (PSR_I | PSR_F));
+			hypctx->debug_spsr &= ~(PSR_I | PSR_F);
+		}
+		break;
+	default:
+		ret = ENOENT;
+		break;
+	}
+
+	if (ret == 0) {
+		if (val == 0)
+			hypctx->setcaps &= ~(1ul << num);
+		else
+			hypctx->setcaps |= (1ul << num);
+	}
+
+	return (ret);
 }
diff --git a/sys/arm64/vmm/vmm_stat.c b/sys/arm64/vmm/vmm_stat.c
index 858ce980843a..05ece6f30579 100644
--- a/sys/arm64/vmm/vmm_stat.c
+++ b/sys/arm64/vmm/vmm_stat.c
@@ -161,5 +161,7 @@ VMM_STAT(VMEXIT_INSN_ABORT, "number of vmexits for an instruction abort");
 VMM_STAT(VMEXIT_UNHANDLED_SYNC, "number of vmexits for an unhandled synchronous exception");
 VMM_STAT(VMEXIT_IRQ, "number of vmexits for an irq");
 VMM_STAT(VMEXIT_FIQ, "number of vmexits for an interrupt");
+VMM_STAT(VMEXIT_BRK, "number of vmexits for a breakpoint exception");
+VMM_STAT(VMEXIT_SS, "number of vmexits for a single-step exception");
 VMM_STAT(VMEXIT_UNHANDLED_EL2, "number of vmexits for an unhandled EL2 exception");
 VMM_STAT(VMEXIT_UNHANDLED, "number of vmexits for an unhandled exception");
diff --git a/sys/arm64/vmm/vmm_stat.h b/sys/arm64/vmm/vmm_stat.h
index b0a06ef79253..402fa2f1b1e4 100644
--- a/sys/arm64/vmm/vmm_stat.h
+++ b/sys/arm64/vmm/vmm_stat.h
@@ -140,6 +140,8 @@ VMM_STAT_DECLARE(VMEXIT_INSN_ABORT);
 VMM_STAT_DECLARE(VMEXIT_UNHANDLED_SYNC);
 VMM_STAT_DECLARE(VMEXIT_IRQ);
 VMM_STAT_DECLARE(VMEXIT_FIQ);
+VMM_STAT_DECLARE(VMEXIT_BRK);
+VMM_STAT_DECLARE(VMEXIT_SS);
 VMM_STAT_DECLARE(VMEXIT_UNHANDLED_EL2);
 VMM_STAT_DECLARE(VMEXIT_UNHANDLED);
 #endif

From nobody Tue Jun  4 20:06:31 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv1nh0wKSz5MQBS;
	Tue, 04 Jun 2024 20:06:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv1nh0ZRdz4fXV;
	Tue,  4 Jun 2024 20:06:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717531592;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=s9bPS9Z8ncN+FM+JRKxzp4v1Epbr1jqhmh1iv+c9vYw=;
	b=qc5gYbbAmXEGWnC1tYlvrNp5k7jrNWWYA404d8jWcpnbMKxIIfLzj6qyfZukMvepHs7epR
	0YeJfzFMOLm7s8DpwFJphSwI998vytWGZV41qpOTlbCkOdWHBsFLjp8guvwdFObowkPolm
	IXPbRaajjzKO8vil/tMFDKpYXowo714EEmRSx1Fh1ZizagAHGy5kH0klJ8lhTpKLK98sBR
	gSU/j8RtJcFFM5aVphdQ5dofGNOnofLpSXQeMV/qRYS/pOpRBmtSD79UJXusuEr3gkvqdV
	xpLiLK6jvvmGbJC3j81jKsTH+VZKJ76gX87wXNXf2AMoGwdkpiZ5IOV7lYb5zg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717531592; a=rsa-sha256; cv=none;
	b=Cf4jqF5c4D066XqEHkT63MHoR39lIGkZto9sA7A65wg3suStP923RVdnYw5QmA+JuxL+8F
	C3zeN1OgAhuUWYQcgeoG30kSljD4sj3MTIUzvoabL0Y3/i7v9WfFarhMiReWMN1xAP7gWm
	Yn8zOc2mR0o0teLEUi8ycZ2IkiBm3GpFaE2LG2se1WXlvY2tVflUi3pVhhluo/dOAc69XU
	Z0YzCtsrdRd61YT7MCRmhb8tHdA3UXBOeb+Fi2+wDKf2lRJpcrX/Bbcx8iMQ8iLs+Ez0ge
	LoOShn6LFMdQN9L3yO0g0XaAgoek7QsauJAtTw1LQXGu+ZP/qDjLLg+gk9JTOg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717531592;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=s9bPS9Z8ncN+FM+JRKxzp4v1Epbr1jqhmh1iv+c9vYw=;
	b=QWiYcmajNvOfO0P+vF0Carj6lqHCxYz5JBKQIuXNxzG1jWOnLi6tVQoov/cWH+nVMcrzGx
	iRF+8CwMJDNxrIGB5lvx/V7uxQ6wU61XAnoH/sCJz6KAp6lN/NNhI2resG4dmKJ01ytRsO
	J0FqInhRWMnRkn3WdSwIs0D7nA100zdc2Adwp8/UufDaB7HsPczlqSD73Rhj4HfoX2F6jM
	vXBhdzUUTHtvXyRAnF5T53EVCNGJVz6lrsDIyiiIn2716PDqo/f8x5/vG+TbJDNkRxHFgx
	F0fRxupcRZFkOWAQRQGEKVbZLQxkSl+d/OhnCBegDpHQWDDCeF3l5T7zRS+3kA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv1nh07J0zYHn;
	Tue,  4 Jun 2024 20:06:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454K6VgZ075122;
	Tue, 4 Jun 2024 20:06:31 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454K6V6W075119;
	Tue, 4 Jun 2024 20:06:31 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 20:06:31 GMT
Message-Id: <202406042006.454K6V6W075119@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mark Johnston <markj@FreeBSD.org>
Subject: git: a0ca4af9455b - main - bhyve: Add arm64 support to the
  gdb stub
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: markj
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: a0ca4af9455b844c5e094fc1b09b1390ffa979fc
Auto-Submitted: auto-generated

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=a0ca4af9455b844c5e094fc1b09b1390ffa979fc

commit a0ca4af9455b844c5e094fc1b09b1390ffa979fc
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-04 19:03:17 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-04 19:03:17 +0000

    bhyve: Add arm64 support to the gdb stub
    
    - Add -G to the arm64 getopt handler.
    - Add static register definitions and extensible XML definitions.
    - Provide definitions for MD bits such as breakpoint encoding and
      length.
    - Ensure that bhyve re-injects breakpoint exceptions that it is not
      responsible for.
    
    Reviewed by:    andrew
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D44740
---
 usr.sbin/bhyve/aarch64/Makefile.inc       |   1 +
 usr.sbin/bhyve/aarch64/bhyverun_machdep.c |   6 +-
 usr.sbin/bhyve/aarch64/vmexit.c           |  20 +++-
 usr.sbin/bhyve/gdb.c                      | 151 +++++++++++++++++++++++++++---
 usr.sbin/bhyve/gdb/Makefile               |   3 +
 usr.sbin/bhyve/gdb/aarch64-core.xml       |  46 +++++++++
 6 files changed, 213 insertions(+), 14 deletions(-)

diff --git a/usr.sbin/bhyve/aarch64/Makefile.inc b/usr.sbin/bhyve/aarch64/Makefile.inc
index e2ea4414ca19..af458e719d44 100644
--- a/usr.sbin/bhyve/aarch64/Makefile.inc
+++ b/usr.sbin/bhyve/aarch64/Makefile.inc
@@ -7,3 +7,4 @@ SRCS+=	\
 SRCS+=	vmm_instruction_emul.c
 
 BHYVE_FDT_SUPPORT=
+BHYVE_GDB_SUPPORT=
diff --git a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c
index a5fd3f054706..fbaba3128def 100644
--- a/usr.sbin/bhyve/aarch64/bhyverun_machdep.c
+++ b/usr.sbin/bhyve/aarch64/bhyverun_machdep.c
@@ -99,6 +99,7 @@ bhyve_usage(int code)
 	    "       -C: include guest memory in core file\n"
 	    "       -c: number of CPUs and/or topology specification\n"
 	    "       -D: destroy on power-off\n"
+	    "       -G: start a debug server\n"
 	    "       -h: help\n"
 	    "       -k: key=value flat config file\n"
 	    "       -m: memory size\n"
@@ -119,7 +120,7 @@ bhyve_optparse(int argc, char **argv)
 	const char *optstr;
 	int c;
 
-	optstr = "hCDSWk:f:o:p:c:s:m:U:";
+	optstr = "hCDSWk:f:o:p:G:c:s:m:U:";
 	while ((c = getopt(argc, argv, optstr)) != -1) {
 		switch (c) {
 		case 'c':
@@ -134,6 +135,9 @@ bhyve_optparse(int argc, char **argv)
 		case 'D':
 			set_config_bool("destroy_on_poweroff", true);
 			break;
+		case 'G':
+			bhyve_parse_gdb_options(optarg);
+			break;
 		case 'k':
 			bhyve_parse_simple_config_file(optarg);
 			break;
diff --git a/usr.sbin/bhyve/aarch64/vmexit.c b/usr.sbin/bhyve/aarch64/vmexit.c
index 0d328ab4ff85..03fc2f8b21e3 100644
--- a/usr.sbin/bhyve/aarch64/vmexit.c
+++ b/usr.sbin/bhyve/aarch64/vmexit.c
@@ -49,6 +49,7 @@
 #include "bhyverun.h"
 #include "config.h"
 #include "debug.h"
+#include "gdb.h"
 #include "mem.h"
 #include "vmexit.h"
 
@@ -112,9 +113,10 @@ vmexit_suspend(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun)
 }
 
 static int
-vmexit_debug(struct vmctx *ctx __unused, struct vcpu *vcpu __unused,
+vmexit_debug(struct vmctx *ctx __unused, struct vcpu *vcpu,
     struct vm_run *vmrun __unused)
 {
+	gdb_cpu_suspend(vcpu);
 	return (VMEXIT_CONTINUE);
 }
 
@@ -250,6 +252,20 @@ vmexit_hyp(struct vmctx *ctx __unused, struct vcpu *vcpu __unused,
 	return (VMEXIT_ABORT);
 }
 
+static int
+vmexit_brk(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun)
+{
+	gdb_cpu_breakpoint(vcpu, vmrun->vm_exit);
+	return (VMEXIT_CONTINUE);
+}
+
+static int
+vmexit_ss(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun)
+{
+	gdb_cpu_debug(vcpu, vmrun->vm_exit);
+	return (VMEXIT_CONTINUE);
+}
+
 const vmexit_handler_t vmexit_handlers[VM_EXITCODE_MAX] = {
 	[VM_EXITCODE_BOGUS]  = vmexit_bogus,
 	[VM_EXITCODE_INST_EMUL] = vmexit_inst_emul,
@@ -257,4 +273,6 @@ const vmexit_handler_t vmexit_handlers[VM_EXITCODE_MAX] = {
 	[VM_EXITCODE_DEBUG] = vmexit_debug,
 	[VM_EXITCODE_SMCCC] = vmexit_smccc,
 	[VM_EXITCODE_HYP] = vmexit_hyp,
+	[VM_EXITCODE_BRK] = vmexit_brk,
+	[VM_EXITCODE_SS] = vmexit_ss,
 };
diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c
index 479ad407dbef..6df8026a0245 100644
--- a/usr.sbin/bhyve/gdb.c
+++ b/usr.sbin/bhyve/gdb.c
@@ -36,10 +36,17 @@
 #include <sys/socket.h>
 #include <sys/stat.h>
 
+#ifdef __aarch64__
+#include <machine/armreg.h>
+#endif
 #include <machine/atomic.h>
+#ifdef __amd64__
 #include <machine/specialreg.h>
+#endif
 #include <machine/vmm.h>
+
 #include <netinet/in.h>
+
 #include <assert.h>
 #ifndef WITHOUT_CAPSICUM
 #include <capsicum_helpers.h>
@@ -73,9 +80,19 @@
  */
 #define	GDB_SIGNAL_TRAP		5
 
+#if defined(__amd64__)
 #define	GDB_BP_SIZE		1
 #define	GDB_BP_INSTR		(uint8_t []){0xcc}
 #define	GDB_PC_REGNAME		VM_REG_GUEST_RIP
+#define	GDB_BREAKPOINT_CAP	VM_CAP_BPT_EXIT
+#elif defined(__aarch64__)
+#define	GDB_BP_SIZE		4
+#define	GDB_BP_INSTR		(uint8_t []){0x00, 0x00, 0x20, 0xd4}
+#define	GDB_PC_REGNAME		VM_REG_GUEST_PC
+#define	GDB_BREAKPOINT_CAP	VM_CAP_BRK_EXIT
+#else
+#error "Unsupported architecture"
+#endif
 
 _Static_assert(sizeof(GDB_BP_INSTR) == GDB_BP_SIZE,
     "GDB_BP_INSTR has wrong size");
@@ -146,10 +163,13 @@ static struct vcpu **vcpus;
 static int cur_vcpu, stopped_vcpu;
 static bool gdb_active = false;
 
-static const struct gdb_reg {
+struct gdb_reg {
 	enum vm_reg_name id;
 	int size;
-} gdb_regset[] = {
+}
+
+#ifdef __amd64__
+static const gdb_regset[] = {
 	{ .id = VM_REG_GUEST_RAX, .size = 8 },
 	{ .id = VM_REG_GUEST_RBX, .size = 8 },
 	{ .id = VM_REG_GUEST_RCX, .size = 8 },
@@ -191,6 +211,44 @@ static const struct gdb_reg {
 	{ .id = VM_REG_GUEST_TPR, .size = 8 },
 	{ .id = VM_REG_GUEST_EFER, .size = 8 },
 };
+#else /* __aarch64__ */
+static const gdb_regset[] = {
+	{ .id = VM_REG_GUEST_X0, .size = 8 },
+	{ .id = VM_REG_GUEST_X1, .size = 8 },
+	{ .id = VM_REG_GUEST_X2, .size = 8 },
+	{ .id = VM_REG_GUEST_X3, .size = 8 },
+	{ .id = VM_REG_GUEST_X4, .size = 8 },
+	{ .id = VM_REG_GUEST_X5, .size = 8 },
+	{ .id = VM_REG_GUEST_X6, .size = 8 },
+	{ .id = VM_REG_GUEST_X7, .size = 8 },
+	{ .id = VM_REG_GUEST_X8, .size = 8 },
+	{ .id = VM_REG_GUEST_X9, .size = 8 },
+	{ .id = VM_REG_GUEST_X10, .size = 8 },
+	{ .id = VM_REG_GUEST_X11, .size = 8 },
+	{ .id = VM_REG_GUEST_X12, .size = 8 },
+	{ .id = VM_REG_GUEST_X13, .size = 8 },
+	{ .id = VM_REG_GUEST_X14, .size = 8 },
+	{ .id = VM_REG_GUEST_X15, .size = 8 },
+	{ .id = VM_REG_GUEST_X16, .size = 8 },
+	{ .id = VM_REG_GUEST_X17, .size = 8 },
+	{ .id = VM_REG_GUEST_X18, .size = 8 },
+	{ .id = VM_REG_GUEST_X19, .size = 8 },
+	{ .id = VM_REG_GUEST_X20, .size = 8 },
+	{ .id = VM_REG_GUEST_X21, .size = 8 },
+	{ .id = VM_REG_GUEST_X22, .size = 8 },
+	{ .id = VM_REG_GUEST_X23, .size = 8 },
+	{ .id = VM_REG_GUEST_X24, .size = 8 },
+	{ .id = VM_REG_GUEST_X25, .size = 8 },
+	{ .id = VM_REG_GUEST_X26, .size = 8 },
+	{ .id = VM_REG_GUEST_X27, .size = 8 },
+	{ .id = VM_REG_GUEST_X28, .size = 8 },
+	{ .id = VM_REG_GUEST_X29, .size = 8 },
+	{ .id = VM_REG_GUEST_LR, .size = 8 },
+	{ .id = VM_REG_GUEST_SP, .size = 8 },
+	{ .id = VM_REG_GUEST_PC, .size = 8 },
+	{ .id = VM_REG_GUEST_CPSR, .size = 8 },
+};
+#endif
 
 #ifdef GDB_LOG
 #include <stdarg.h>
@@ -228,6 +286,7 @@ static void	remove_all_sw_breakpoints(void);
 static int
 guest_paging_info(struct vcpu *vcpu, struct vm_guest_paging *paging)
 {
+#ifdef __amd64__
 	uint64_t regs[4];
 	const int regset[4] = {
 		VM_REG_GUEST_CR0,
@@ -262,6 +321,31 @@ guest_paging_info(struct vcpu *vcpu, struct vm_guest_paging *paging)
 	else
 		paging->paging_mode = PAGING_MODE_PAE;
 	return (0);
+#else /* __aarch64__ */
+	uint64_t regs[6];
+	const int regset[6] = {
+		VM_REG_GUEST_TTBR0_EL1,
+		VM_REG_GUEST_TTBR1_EL1,
+		VM_REG_GUEST_TCR_EL1,
+		VM_REG_GUEST_TCR2_EL1,
+		VM_REG_GUEST_SCTLR_EL1,
+		VM_REG_GUEST_CPSR,
+	};
+
+	if (vm_get_register_set(vcpu, nitems(regset), regset, regs) == -1)
+		return (-1);
+
+	memset(paging, 0, sizeof(*paging));
+	paging->ttbr0_addr = regs[0] & ~(TTBR_ASID_MASK | TTBR_CnP);
+	paging->ttbr1_addr = regs[1] & ~(TTBR_ASID_MASK | TTBR_CnP);
+	paging->tcr_el1 = regs[2];
+	paging->tcr2_el1 = regs[3];
+	paging->flags = regs[5] & (PSR_M_MASK | PSR_M_32);
+	if ((regs[4] & SCTLR_M) != 0)
+		paging->flags |= VM_GP_MMU_ENABLED;
+
+	return (0);
+#endif /* __aarch64__ */
 }
 
 /*
@@ -294,7 +378,11 @@ guest_vaddr2paddr(struct vcpu *vcpu, uint64_t vaddr, uint64_t *paddr)
 static uint64_t
 guest_pc(struct vm_exit *vme)
 {
+#ifdef __amd64__
 	return (vme->rip);
+#else /* __aarch64__ */
+	return (vme->pc);
+#endif
 }
 
 static void
@@ -762,6 +850,7 @@ _gdb_set_step(struct vcpu *vcpu, int val)
 {
 	int error;
 
+#ifdef __amd64__
 	/*
 	 * If the MTRAP cap fails, we are running on an AMD host.
 	 * In that case, we request DB exits caused by RFLAGS.TF.
@@ -771,23 +860,31 @@ _gdb_set_step(struct vcpu *vcpu, int val)
 		error = vm_set_capability(vcpu, VM_CAP_RFLAGS_TF, val);
 	if (error == 0)
 		(void)vm_set_capability(vcpu, VM_CAP_MASK_HWINTR, val);
-
+#else /* __aarch64__ */
+	error = vm_set_capability(vcpu, VM_CAP_SS_EXIT, val);
+	if (error == 0)
+		error = vm_set_capability(vcpu, VM_CAP_MASK_HWINTR, val);
+#endif
 	return (error);
 }
 
 /*
- * Checks whether single-stepping is enabled for a given vCPU.
+ * Checks whether single-stepping is supported for a given vCPU.
  */
 static int
 _gdb_check_step(struct vcpu *vcpu)
 {
+#ifdef __amd64__
 	int val;
 
 	if (vm_get_capability(vcpu, VM_CAP_MTRAP_EXIT, &val) != 0) {
 		if (vm_get_capability(vcpu, VM_CAP_RFLAGS_TF, &val) != 0)
-			return -1;
+			return (-1);
 	}
-	return 0;
+#else /* __aarch64__ */
+	(void)vcpu;
+#endif
+	return (0);
 }
 
 /*
@@ -809,7 +906,7 @@ gdb_cpu_add(struct vcpu *vcpu)
 	vcpus[vcpuid] = vcpu;
 	CPU_SET(vcpuid, &vcpus_active);
 	if (!TAILQ_EMPTY(&breakpoints)) {
-		vm_set_capability(vcpu, VM_CAP_BPT_EXIT, 1);
+		vm_set_capability(vcpu, GDB_BREAKPOINT_CAP, 1);
 		debug("$vCPU %d enabled breakpoint exits\n", vcpuid);
 	}
 
@@ -912,7 +1009,7 @@ gdb_cpu_step(struct vcpu *vcpu)
 }
 
 /*
- * A general handler for VM_EXITCODE_DB.
+ * A general handler for single-step exceptions.
  * Handles RFLAGS.TF exits on AMD SVM.
  */
 void
@@ -921,10 +1018,15 @@ gdb_cpu_debug(struct vcpu *vcpu, struct vm_exit *vmexit)
 	if (!gdb_active)
 		return;
 
+#ifdef __amd64__
 	/* RFLAGS.TF exit? */
 	if (vmexit->u.dbg.trace_trap) {
 		gdb_cpu_step(vcpu);
 	}
+#else /* __aarch64__ */
+	(void)vmexit;
+	gdb_cpu_step(vcpu);
+#endif
 }
 
 /*
@@ -998,11 +1100,19 @@ gdb_cpu_breakpoint(struct vcpu *vcpu, struct vm_exit *vmexit)
 	} else {
 		debug("$vCPU %d injecting breakpoint at rip %#lx\n", vcpuid,
 		    guest_pc(vmexit));
+#ifdef __amd64__
 		error = vm_set_register(vcpu, VM_REG_GUEST_ENTRY_INST_LENGTH,
 		    vmexit->u.bpt.inst_length);
 		assert(error == 0);
 		error = vm_inject_exception(vcpu, IDT_BP, 0, 0, 0);
 		assert(error == 0);
+#else /* __aarch64__ */
+		uint64_t esr;
+
+		esr = (EXCP_BRK << ESR_ELx_EC_SHIFT) | vmexit->u.hyp.esr_el2;
+		error = vm_inject_exception(vcpu, esr, 0);
+		assert(error == 0);
+#endif
 	}
 	pthread_mutex_unlock(&gdb_lock);
 }
@@ -1053,8 +1163,10 @@ gdb_read_regs(void)
 
 	start_packet();
 	for (size_t i = 0; i < nitems(gdb_regset); i++) {
+#ifdef GDB_REG_FIRST_EXT
 		if (gdb_regset[i].id == GDB_REG_FIRST_EXT)
 			break;
+#endif
 		append_unsigned_native(regvals[i], gdb_regset[i].size);
 	}
 	finish_packet();
@@ -1318,7 +1430,7 @@ set_breakpoint_caps(bool enable)
 	while (!CPU_EMPTY(&mask)) {
 		vcpu = CPU_FFS(&mask) - 1;
 		CPU_CLR(vcpu, &mask);
-		if (vm_set_capability(vcpus[vcpu], VM_CAP_BPT_EXIT,
+		if (vm_set_capability(vcpus[vcpu], GDB_BREAKPOINT_CAP,
 		    enable ? 1 : 0) < 0)
 			return (false);
 		debug("$vCPU %d %sabled breakpoint exits\n", vcpu,
@@ -1327,6 +1439,20 @@ set_breakpoint_caps(bool enable)
 	return (true);
 }
 
+static void
+write_instr(uint8_t *dest, uint8_t *instr, size_t len)
+{
+	memcpy(dest, instr, len);
+#ifdef __arm64__
+	__asm __volatile(
+	    "dc cvau, %0\n"
+	    "dsb ish\n"
+	    "ic ialluis\n"
+	    "dsb ish\n"
+	    : : "r" (dest) : "memory");
+#endif
+}
+
 static void
 remove_all_sw_breakpoints(void)
 {
@@ -1339,7 +1465,7 @@ remove_all_sw_breakpoints(void)
 	TAILQ_FOREACH_SAFE(bp, &breakpoints, link, nbp) {
 		debug("remove breakpoint at %#lx\n", bp->gpa);
 		cp = paddr_guest2host(ctx, bp->gpa, sizeof(bp->shadow_inst));
-		memcpy(cp, bp->shadow_inst, sizeof(bp->shadow_inst));
+		write_instr(cp, bp->shadow_inst, sizeof(bp->shadow_inst));
 		TAILQ_REMOVE(&breakpoints, bp, link);
 		free(bp);
 	}
@@ -1395,14 +1521,15 @@ update_sw_breakpoint(uint64_t gva, int kind, bool insert)
 			bp = malloc(sizeof(*bp));
 			bp->gpa = gpa;
 			memcpy(bp->shadow_inst, cp, sizeof(bp->shadow_inst));
-			memcpy(cp, GDB_BP_INSTR, sizeof(bp->shadow_inst));
+			write_instr(cp, GDB_BP_INSTR, sizeof(bp->shadow_inst));
 			TAILQ_INSERT_TAIL(&breakpoints, bp, link);
 			debug("new breakpoint at %#lx\n", gpa);
 		}
 	} else {
 		if (bp != NULL) {
 			debug("remove breakpoint at %#lx\n", gpa);
-			memcpy(cp, bp->shadow_inst, sizeof(bp->shadow_inst));
+			write_instr(cp, bp->shadow_inst,
+			    sizeof(bp->shadow_inst));
 			TAILQ_REMOVE(&breakpoints, bp, link);
 			free(bp);
 			if (TAILQ_EMPTY(&breakpoints))
diff --git a/usr.sbin/bhyve/gdb/Makefile b/usr.sbin/bhyve/gdb/Makefile
index cc9ba4d224da..d9edbe02aea4 100644
--- a/usr.sbin/bhyve/gdb/Makefile
+++ b/usr.sbin/bhyve/gdb/Makefile
@@ -6,6 +6,9 @@ FILES+=		target.xml
 .if ${MACHINE_ARCH} == "amd64"
 XMLARCH=	i386:x86-64
 FILES+=		amd64.xml
+.elif ${MACHINE_ARCH} == "aarch64"
+XMLARCH=	aarch64
+FILES+=		aarch64-core.xml
 .endif
 
 .if !make(install*)
diff --git a/usr.sbin/bhyve/gdb/aarch64-core.xml b/usr.sbin/bhyve/gdb/aarch64-core.xml
new file mode 100644
index 000000000000..c44b679405b7
--- /dev/null
+++ b/usr.sbin/bhyve/gdb/aarch64-core.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2009-2012 Free Software Foundation, Inc.
+     Contributed by ARM Ltd.
+
+     Copying and distribution of this file, with or without modification,
+     are permitted in any medium without royalty provided the copyright
+     notice and this notice are preserved.  -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.aarch64.core">
+  <reg name="x0" bitsize="64"/>
+  <reg name="x1" bitsize="64"/>
+  <reg name="x2" bitsize="64"/>
+  <reg name="x3" bitsize="64"/>
+  <reg name="x4" bitsize="64"/>
+  <reg name="x5" bitsize="64"/>
+  <reg name="x6" bitsize="64"/>
+  <reg name="x7" bitsize="64"/>
+  <reg name="x8" bitsize="64"/>
+  <reg name="x9" bitsize="64"/>
+  <reg name="x10" bitsize="64"/>
+  <reg name="x11" bitsize="64"/>
+  <reg name="x12" bitsize="64"/>
+  <reg name="x13" bitsize="64"/>
+  <reg name="x14" bitsize="64"/>
+  <reg name="x15" bitsize="64"/>
+  <reg name="x16" bitsize="64"/>
+  <reg name="x17" bitsize="64"/>
+  <reg name="x18" bitsize="64"/>
+  <reg name="x19" bitsize="64"/>
+  <reg name="x20" bitsize="64"/>
+  <reg name="x21" bitsize="64"/>
+  <reg name="x22" bitsize="64"/>
+  <reg name="x23" bitsize="64"/>
+  <reg name="x24" bitsize="64"/>
+  <reg name="x25" bitsize="64"/>
+  <reg name="x26" bitsize="64"/>
+  <reg name="x27" bitsize="64"/>
+  <reg name="x28" bitsize="64"/>
+  <reg name="x29" bitsize="64"/>
+  <reg name="x30" bitsize="64"/>
+  <reg name="sp" bitsize="64" type="data_ptr"/>
+
+  <reg name="pc" bitsize="64" type="code_ptr"/>
+  <reg name="cpsr" bitsize="64"/>
+</feature>

From nobody Tue Jun  4 20:06:33 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv1nj2qs6z5MQ7F;
	Tue, 04 Jun 2024 20:06:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv1nj1P7wz4fpD;
	Tue,  4 Jun 2024 20:06:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717531593;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=PlShY+XOC/8ag/YhFR0QU9oOVez7uBD1fcuTQn29xok=;
	b=MnLZn1i0Z3uiE12aeMZS0dHNrLImR8UnPJYFzpOP5dWhQ9Fg7FXXcHqVtsrSkQI8PSX57Z
	xXGmBzB2bq68cPe4eo/p/DzjjvEimrFNLPF362QOC9p+WY86KprdC3m+cVJN4JBOyD1YAs
	xvXcp67tYs2nyNh2S89laAvCYYdd1qxqASmNMxjDGHl5RX+ignyUGla+td1dKBheqFdZU/
	xmpkB4hvPvcCAZhIWqjCA8E+TeZshxUbtid7LD6Q7AOx1ZA2+gndlSo2/6o+m1puCTWVpr
	QEgbpgKDhccArHehKy2S6CRQipyGzMGtS7Ls+DxTu9MeHI1I47IjEmJBrFGiOw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717531593; a=rsa-sha256; cv=none;
	b=QAwT1u2Q6+w3cOh2fljF6zXjT5JfN0vfS9k+1JeD6YZCfyA2iRPcOX7AxP6wygl9JBHKpw
	ftgulJAuMzI9PjN4gvecjcsZTCFxeBkXMnTrIqBRwoXoAzQ2fIybJDFmGsLPKPfI46B2E8
	EqZVulkMDSL67OxgCSsAD1LYHrMadtiGCVlX0esu0B8AgnWLqcnGSoqSCXbuJDN4chMm0D
	GZKpoT10mVlxAz72hgCyW26gbx/9Yievaa60Xm4fu85ld7GcVpKmzilIMpIGYXXVQuO4WZ
	DuSv4hN3XMXqY/8ay3nLL+jByVbSp0vcEGXe4xWfSFc1Ap9angtlce9G0lcjog==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717531593;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=PlShY+XOC/8ag/YhFR0QU9oOVez7uBD1fcuTQn29xok=;
	b=cFLfrus0PjEM15Hh5Ktim0+Izs9PhjYtciYM8hMlXe9vkUXGfrMDZqIToVkVigxiKMUnbZ
	X99fBF7Z5HRBK4m5O34NIUaCbVs5RD2j+8AIkzwSEjeMHNGG/2rw/5n6Ap0jCHEQ+e88Ky
	miVZ6DjNWEjX+eyNbVHSTfqRC13TfQnZhIkHq87/T1UgwoJHC0xP19NsvFnxxLVJryxveF
	VdaqGAdvkuh1OtSssnOHDJLjj7idiJCqJW6APVKqQBQZlFtudjl2WEziP1sDJiqdQDgn9t
	7ynuzDfHb0INW62gsGGpXfcT7nLPETQ4061lTBxClywyv0MVfr/SGf45oSF8NQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv1nj0psyzXxR;
	Tue,  4 Jun 2024 20:06:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454K6X3U075168;
	Tue, 4 Jun 2024 20:06:33 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454K6XQB075165;
	Tue, 4 Jun 2024 20:06:33 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 20:06:33 GMT
Message-Id: <202406042006.454K6XQB075165@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mark Johnston <markj@FreeBSD.org>
Subject: git: 05704402ac85 - main - bhyve: Add a stub VM_EXITCODE_REG_EMUL
  handler
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: markj
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 05704402ac85e0864eda63cecc20eb7810ecb503
Auto-Submitted: auto-generated

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=05704402ac85e0864eda63cecc20eb7810ecb503

commit 05704402ac85e0864eda63cecc20eb7810ecb503
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-04 19:06:42 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-04 19:06:42 +0000

    bhyve: Add a stub VM_EXITCODE_REG_EMUL handler
    
    This lets us print a few fields of interest before aborting the VM loop.
    
    No functional change intended.
    
    Reviewed by:    corvink, andrew
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D44741
---
 usr.sbin/bhyve/aarch64/vmexit.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/usr.sbin/bhyve/aarch64/vmexit.c b/usr.sbin/bhyve/aarch64/vmexit.c
index 03fc2f8b21e3..a47df27e54fc 100644
--- a/usr.sbin/bhyve/aarch64/vmexit.c
+++ b/usr.sbin/bhyve/aarch64/vmexit.c
@@ -84,6 +84,21 @@ fail:
 	return (VMEXIT_ABORT);
 }
 
+static int
+vmexit_reg_emul(struct vmctx *ctx __unused, struct vcpu *vcpu __unused,
+    struct vm_run *vmrun)
+{
+	struct vm_exit *vme;
+	struct vre *vre;
+
+	vme = vmrun->vm_exit;
+	vre = &vme->u.reg_emul.vre;
+
+	EPRINTLN("Unhandled register access: pc %#lx syndrome %#x reg %d\n",
+	    vme->pc, vre->inst_syndrome, vre->reg);
+	return (VMEXIT_ABORT);
+}
+
 static int
 vmexit_suspend(struct vmctx *ctx, struct vcpu *vcpu, struct vm_run *vmrun)
 {
@@ -269,6 +284,7 @@ vmexit_ss(struct vmctx *ctx __unused, struct vcpu *vcpu, struct vm_run *vmrun)
 const vmexit_handler_t vmexit_handlers[VM_EXITCODE_MAX] = {
 	[VM_EXITCODE_BOGUS]  = vmexit_bogus,
 	[VM_EXITCODE_INST_EMUL] = vmexit_inst_emul,
+	[VM_EXITCODE_REG_EMUL] = vmexit_reg_emul,
 	[VM_EXITCODE_SUSPENDED] = vmexit_suspend,
 	[VM_EXITCODE_DEBUG] = vmexit_debug,
 	[VM_EXITCODE_SMCCC] = vmexit_smccc,

From nobody Tue Jun  4 20:53:12 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv2qY0gPJz5MXFb;
	Tue, 04 Jun 2024 20:53:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv2qX4s7dz4pqt;
	Tue,  4 Jun 2024 20:53:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717534392;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=drcride9hjlZFmwndSbH1tGVs2B9cr8F8EnsM43YUGc=;
	b=x42081bG/zFH0eQJZKbJqV+nTJseA43wlfvfjCmGob90drg5ysKJtI9oiYrbDe2FAvm9LA
	Mz8/3nL4BvvKb6WNgR8s2yvAvd9GIlkuKjafq+jnnI7FKtkES1viigoCwr+b27iS5YNKwO
	BPeTtAxHy9oZJ2cDKpTs4ni9BuSJG2VGPQ5/Mi1iAcdRJ4h8BsjbfuztuCettABmtB+WMT
	ZVUG/n/YClzG6c7pkyTYLj78n1Uc6QNDVhYsTxoC4jA2+EQVumYtCL7sr9f5ZuvS+DpHpL
	WGV9FwSa8OJzb4flS816hEckyFXxB9P5IARKQBWTSLazv/bemxNZ/HcYDegM0g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717534392; a=rsa-sha256; cv=none;
	b=lMKVqo0yc+CxB0AcRbyg6zt4pjffauN6wyuvJJ9NXn2B0B6Uuos/JyopJzSwRzC9+0pDsm
	nmVfZ1Vz2S1aM8m2vhkk6Ayb2Won8ALqsYcjPodsGjbzJ5qfQEjV7wyOJcLE4XW29KrM5g
	R3nvAfKCHmjr/PBHpDI22yUDNaRlwlG9zH3lF1l+PTwGG8yzeGMVxozujp2qkfs/qxwB0m
	tjL93cjlseUCtODmS4ZuQ9N1jTjtmxBYWbJ/8HNO1mmM4eaHCaYJA3Jw4li7EgASp+L1/1
	iL975QppilYTy1nI/JKHO3CaD3jXxXBofTiuaQAsILc02fThTGLsOvrLh/0+AQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717534392;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=drcride9hjlZFmwndSbH1tGVs2B9cr8F8EnsM43YUGc=;
	b=ZsL0gs6KKfsc1/F9ylRGbKlOO4QhJWa66rM8m5awR7INczjkMEgads5AS7TbASW218AkTG
	Df1nQjy0fjJzRxj2qYfoNXmGz6P0S66Ar2r5zsO2W0eul0GfYfNKuX4kXxBHY+zjfDiac0
	jWWxbJllfMfiTrCQVuOVLyLmP+JandD+cH9PD9OyGdAXeDQgGbEAmVh8k8xC687jIMGBVB
	Tg4xAhhz6vBOOP7Fx3LPCbjZbGDpeULOfqdYDArToYKaEH6jygRkLsFDcKNcuQUI9mZcbW
	cNf4fEBrBid2hfVOo5hYqg/fZDqiA5UbK2hPz13j/P1DrtsceLSCiXxTTbvALA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv2qX4TKLzZMY;
	Tue,  4 Jun 2024 20:53:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454KrCYC058419;
	Tue, 4 Jun 2024 20:53:12 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454KrCaN058416;
	Tue, 4 Jun 2024 20:53:12 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 20:53:12 GMT
Message-Id: <202406042053.454KrCaN058416@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 480ad4055314 - main - vnet tests: check for if_bridge.ko
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 480ad4055314efbfff7eedbb34272031d836ba89
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=480ad4055314efbfff7eedbb34272031d836ba89

commit 480ad4055314efbfff7eedbb34272031d836ba89
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-04 18:02:18 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-04 20:16:56 +0000

    vnet tests: check for if_bridge.ko
    
    A number of tests create a bridge, but did not check if if_bridge.ko is loaded.
    
    We usually get away with that, because `ifconfig bridge create` autoloads the
    module, but if we run the tests in a jail (e.g. because of kyua's upcoming
    execenv.jail.params feature) we can't load the module and these tests can fail.
    
    Check if the module is loaded, skip the test if it is not.
    
    Reviewed by:    markj
    MFC after:      1 week
    Event:          Kitchener-Waterloo Hackathon 202406
    Differential Revision:  https://reviews.freebsd.org/D45487
---
 tests/sys/common/vnet.subr       |  7 +++++++
 tests/sys/net/if_bridge_test.sh  | 13 +++++++++++++
 tests/sys/net/if_ovpn/if_ovpn.sh |  2 ++
 tests/sys/netinet/carp.sh        |  8 ++++++++
 tests/sys/netpfil/common/rdr.sh  |  1 +
 tests/sys/netpfil/pf/altq.sh     |  4 +---
 tests/sys/netpfil/pf/pfsync.sh   |  1 +
 tests/sys/netpfil/pf/sctp.sh     |  1 +
 tests/sys/netpfil/pf/tcp.sh      |  1 +
 9 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/tests/sys/common/vnet.subr b/tests/sys/common/vnet.subr
index 183f7284d614..fd67385655fc 100644
--- a/tests/sys/common/vnet.subr
+++ b/tests/sys/common/vnet.subr
@@ -26,6 +26,13 @@ vnet_mkepair()
 	echo ${ifname%a}
 }
 
+vnet_init_bridge()
+{
+	if ! kldstat -q -m if_bridge; then
+		atf_skip "This test requires if_bridge"
+	fi
+}
+
 vnet_mkbridge()
 {
 	ifname=$(ifconfig bridge create)
diff --git a/tests/sys/net/if_bridge_test.sh b/tests/sys/net/if_bridge_test.sh
index 44370a905223..66656be1d84f 100755
--- a/tests/sys/net/if_bridge_test.sh
+++ b/tests/sys/net/if_bridge_test.sh
@@ -39,6 +39,7 @@ bridge_transmit_ipv4_unicast_head()
 bridge_transmit_ipv4_unicast_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair_alcatraz=$(vnet_mkepair)
 	epair_singsing=$(vnet_mkepair)
@@ -76,6 +77,7 @@ stp_head()
 stp_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair_one=$(vnet_mkepair)
 	epair_two=$(vnet_mkepair)
@@ -142,6 +144,7 @@ stp_vlan_head()
 stp_vlan_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair_one=$(vnet_mkepair)
 	epair_two=$(vnet_mkepair)
@@ -216,6 +219,7 @@ static_head()
 static_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair=$(vnet_mkepair)
 	bridge=$(vnet_mkbridge)
@@ -273,6 +277,7 @@ span_head()
 span_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair=$(vnet_mkepair)
 	epair_span=$(vnet_mkepair)
@@ -326,6 +331,7 @@ delete_with_members_head()
 delete_with_members_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	epair=$(vnet_mkepair)
@@ -352,6 +358,7 @@ mac_conflict_head()
 mac_conflict_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair=$(vnet_mkepair)
 
@@ -390,6 +397,7 @@ inherit_mac_head()
 inherit_mac_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	epair=$(vnet_mkepair)
@@ -418,6 +426,7 @@ stp_validation_head()
 stp_validation_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair_one=$(vnet_mkepair)
 	epair_two=$(vnet_mkepair)
@@ -461,6 +470,7 @@ gif_head()
 gif_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair=$(vnet_mkepair)
 
@@ -545,6 +555,7 @@ check_mtu()
 mtu_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	epair=$(vnet_mkepair)
 	gif=$(ifconfig gif create)
@@ -606,6 +617,7 @@ vlan_head()
 vlan_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	vid=1
 
@@ -673,6 +685,7 @@ many_bridge_members_head()
 many_bridge_members_body()
 {
 	vnet_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	ifcount=256
diff --git a/tests/sys/net/if_ovpn/if_ovpn.sh b/tests/sys/net/if_ovpn/if_ovpn.sh
index 22da82312dbc..77007c967333 100644
--- a/tests/sys/net/if_ovpn/if_ovpn.sh
+++ b/tests/sys/net/if_ovpn/if_ovpn.sh
@@ -602,6 +602,7 @@ multi_client_head()
 multi_client_body()
 {
 	ovpn_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	srv=$(vnet_mkepair)
@@ -814,6 +815,7 @@ ra_head()
 ra_body()
 {
 	ovpn_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	srv=$(vnet_mkepair)
diff --git a/tests/sys/netinet/carp.sh b/tests/sys/netinet/carp.sh
index e10e24747c2d..39cfad14907c 100755
--- a/tests/sys/netinet/carp.sh
+++ b/tests/sys/netinet/carp.sh
@@ -71,6 +71,7 @@ basic_v4_head()
 basic_v4_body()
 {
 	carp_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	epair_one=$(vnet_mkepair)
@@ -115,6 +116,7 @@ vrrp_v4_head()
 vrrp_v4_body()
 {
 	carp_init
+	vnet_init_bridge
 
 	j=vrrp_basic_v4
 
@@ -161,6 +163,7 @@ unicast_v4_head()
 unicast_v4_body()
 {
 	carp_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	epair_one=$(vnet_mkepair)
@@ -218,6 +221,7 @@ basic_v6_head()
 basic_v6_body()
 {
 	carp_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	epair_one=$(vnet_mkepair)
@@ -265,6 +269,7 @@ vrrp_v6_head()
 vrrp_v6_body()
 {
 	carp_init
+	vnet_init_bridge
 
 	j=carp_basic_v6
 
@@ -314,6 +319,7 @@ unicast_v6_head()
 unicast_v6_body()
 {
 	carp_init
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	epair_one=$(vnet_mkepair)
@@ -375,6 +381,7 @@ unicast_ll_v6_head()
 unicast_ll_v6_body()
 {
 	carp_init
+	vnet_init_bridge
 
 	j=carp_uni_ll_v6
 
@@ -485,6 +492,7 @@ nd6_ns_source_mac_head()
 nd6_ns_source_mac_body()
 {
         carp_init
+        vnet_init_bridge
 
         bridge=$(vnet_mkbridge)
         epair_one=$(vnet_mkepair)
diff --git a/tests/sys/netpfil/common/rdr.sh b/tests/sys/netpfil/common/rdr.sh
index 7d6297870e6c..0d6f27694c8c 100644
--- a/tests/sys/netpfil/common/rdr.sh
+++ b/tests/sys/netpfil/common/rdr.sh
@@ -83,6 +83,7 @@ local_redirect_body()
 	firewall=$1
 	firewall_init $firewall
 	nat_init $firewall
+	vnet_init_bridge
 
 	bridge=$(vnet_mkbridge)
 	ifconfig ${bridge} 192.0.2.1/24 up
diff --git a/tests/sys/netpfil/pf/altq.sh b/tests/sys/netpfil/pf/altq.sh
index 57a9edf11366..a902c7caaf4f 100644
--- a/tests/sys/netpfil/pf/altq.sh
+++ b/tests/sys/netpfil/pf/altq.sh
@@ -156,9 +156,7 @@ codel_bridge_body()
 {
 	altq_init
 	is_altq_supported codel
-	if ! kldstat -q -m if_bridge; then
-		atf_skip "This test requires if_bridge"
-	fi
+	vnet_init_bridge
 
 	epair=$(vnet_mkepair)
 	ifconfig ${epair}a 192.0.2.1/24 up
diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh
index 87dfcf748d3c..b97b06c5f9a2 100644
--- a/tests/sys/netpfil/pf/pfsync.sh
+++ b/tests/sys/netpfil/pf/pfsync.sh
@@ -335,6 +335,7 @@ pbr_common_body()
 		atf_skip "This test requires carp"
 	fi
 	pfsynct_init
+	vnet_init_bridge
 
 	bridge0=$(vnet_mkbridge)
 	bridge1=$(vnet_mkbridge)
diff --git a/tests/sys/netpfil/pf/sctp.sh b/tests/sys/netpfil/pf/sctp.sh
index 66225e132d1c..c6dba1719d00 100644
--- a/tests/sys/netpfil/pf/sctp.sh
+++ b/tests/sys/netpfil/pf/sctp.sh
@@ -504,6 +504,7 @@ pfsync_body()
 
 	sctp_init
 	pfsynct_init
+	vnet_init_bridge
 	if ! kldstat -q -m carp
 	then
 		atf_skip "This test requires carp"
diff --git a/tests/sys/netpfil/pf/tcp.sh b/tests/sys/netpfil/pf/tcp.sh
index 84536480b44e..f1bffdba2bfa 100644
--- a/tests/sys/netpfil/pf/tcp.sh
+++ b/tests/sys/netpfil/pf/tcp.sh
@@ -39,6 +39,7 @@ rst_head()
 rst_body()
 {
 	pft_init
+	vnet_init_bridge
 
 	epair_srv=$(vnet_mkepair)
 	epair_cl=$(vnet_mkepair)

From nobody Tue Jun  4 22:25:29 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv4t90W51z5MmM4;
	Tue, 04 Jun 2024 22:25:37 +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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv4t84Stkz43lG;
	Tue,  4 Jun 2024 22:25:36 +0000 (UTC)
	(envelope-from kostikbel@gmail.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: from tom.home (kib@localhost [127.0.0.1] (may be forged))
	by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 454MPTIP045768;
	Wed, 5 Jun 2024 01:25:32 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 454MPTIP045768
Received: (from kostik@localhost)
	by tom.home (8.18.1/8.18.1/Submit) id 454MPTx4045766;
	Wed, 5 Jun 2024 01:25:29 +0300 (EEST)
	(envelope-from kostikbel@gmail.com)
X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f
Date: Wed, 5 Jun 2024 01:25:29 +0300
From: Konstantin Belousov <kostikbel@gmail.com>
To: Stefan =?utf-8?B?RcOfZXI=?= <se@freebsd.org>
Cc: Jessica Clarke <jrtc27@freebsd.org>,
        "src-committers@freebsd.org" <src-committers@freebsd.org>,
        "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>,
        "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
Subject: Re: git: 077f757d72e5 - main - newfs_msdos: align data area to VM
 page boundary by default
Message-ID: <Zl-UWbgDf-tnY6WF@kib.kiev.ua>
References: <202406021227.452CRx8I007470@gitrepo.freebsd.org>
 <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>
 <adf5a6cd-e57b-44eb-ae7b-a0233ae6fd4b@FreeBSD.org>
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <adf5a6cd-e57b-44eb-ae7b-a0233ae6fd4b@FreeBSD.org>
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=4.0.1
X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on tom.home
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]
X-Rspamd-Queue-Id: 4Vv4t84Stkz43lG

On Tue, Jun 04, 2024 at 08:39:16AM +0200, Stefan Eßer wrote:
> Am 03.06.24 um 19:25 schrieb Jessica Clarke:
> > On 2 Jun 2024, at 13:27, Stefan Eßer <se@FreeBSD.org> wrote:
> > > 
> > > The branch main has been updated by se:
> > > 
> > > URL: https://cgit.FreeBSD.org/src/commit/?id=077f757d72e561eb84193d8e58f63e96e69b8096
> > > 
> > > commit 077f757d72e561eb84193d8e58f63e96e69b8096
> > > Author:     Stefan Eßer <se@FreeBSD.org>
> > > AuthorDate: 2024-06-02 12:07:52 +0000
> > > Commit:     Stefan Eßer <se@FreeBSD.org>
> > > CommitDate: 2024-06-02 12:07:52 +0000
> > > 
> > >     newfs_msdos: align data area to VM page boundary by default
> [...]
> > 
> > Hi,
> > This has completely broken[1] all of the Linux and macOS cross-build CI
> > jobs (which pass -DWITH_DISK_IMAGE_TOOLS_BOOTSTRAP). Please either fix
> > this promptly or back it out until you can do so.
> > 
> > Jess
> > 
> > [1] See https://github.com/freebsd/freebsd-src/actions/runs/9338256762
> 
> Thank you for the report and sorry for the breakage.
> 
> This should be fixed in commit 41ee91c64f47faaa by skipping the
> alignment of the data area, if PAGE_SIZE is not defined.
> 
> An alternative approach would have been to define PAGE_SIZE to a
> sane default value of 4096 (as used on most current architectures
> by default), if not set in the build environment.
> 
> If there is consensus that this would be more appropriate (since
> it matches what the man page says), I'd revert the latest commit
> and instead of it commit the following change:
I believe this is a better approach.
It does not unexpectedly hide some code.

> 
> index 1bca560a59e1..c4f18a28ec39 100644
> --- a/sbin/newfs_msdos/mkfs_msdos.c
> +++ b/sbin/newfs_msdos/mkfs_msdos.c
> @@ -55,6 +55,10 @@
> 
>  #include "mkfs_msdos.h"
> 
> +#ifndef        PAGE_SIZE
> +#define        PAGE_SIZE 4096
> +#endif
> +
>  #define        MAXU16    0xffff        /* maximum unsigned 16-bit quantity */
>  #define        BPN       4             /* bits per nibble */
>  #define        NPB       2             /* nibbles per byte */
> 
> Regards, STefan

From nobody Tue Jun  4 23:02:49 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv5j80Fkpz5MsZf;
	Tue, 04 Jun 2024 23:02:52 +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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv5j74fWMz49Bk;
	Tue,  4 Jun 2024 23:02:51 +0000 (UTC)
	(envelope-from jhb@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717542171;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=93BQRk5Gps423jPmFG8YcOunAbqSxCtDPTnT1sOvQ34=;
	b=evnhdDqlwaT7zUrxAf9N+YmlyNXpHvC1JRD74btmVrEI0ntuOmaf/FhdnqVB4QOgQWv8EP
	y3cRsTZWD/+GCAPMDrxh4HRgGV46+FVGiIsFMaFD18a1fLhWvkCDs9PWMl6ILadBYHfEcY
	mOhCXzch8Vj5sgJWpDKsAuieR1UNA//1hVyg10BT24Kvbge2jppDGovjouHe9vYk4Khtmy
	o/u/3EnsTqHO/9MwLlqva6qYFuRc1MKo6e4eKc50mpnOjEW7dT6ytxM3H+43BnqkhN0lq+
	adFTfpnR6ZbwGVYYfJTIbjfkyO7SbkUr1TGvDbjo3AnBehcROp31aUV8zNbYeQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717542171; a=rsa-sha256; cv=none;
	b=hDEM6vNs9nNQUFZYDIgO4s8LlYczSDNRCzaDTcoAfUeO9Z8vpX2bfXsGojqxt6rLU5E+XD
	2pYfk3s4pabBbTbpw14VILIDAFjoehgW+5gOr3as46AOPv8S6ekX8ZRZAcnc+g03I0z5U3
	Doq6exVFqh+q+mI6ut1/4ZQS2UBvePB7f5MM13tXbV91Hn+62A68cThHOtDBTeGtwzqYJV
	NSTH6OL1XbQBd0ouKxjwXmPchy+EPs1zX8k7nd+hKUeDMI1adgq1YKocXxCUB5HO75lN2h
	jP3IsT0uvwopVKpXmqy86haIDIhfIddHqgFrx0ssg5I3QvpwzJDGGHTSJVQqaw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717542171;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=93BQRk5Gps423jPmFG8YcOunAbqSxCtDPTnT1sOvQ34=;
	b=LkGRVfrL9aztvC7z+K9KRn+mGaT00GYO2qEG8aUjW2vfCKpThrajAjFJ6KBYSUIHGrn5/J
	WLkaAUsTbkiBEdQtusJwe47ljvhKfL/h0rVT3APwIipmQQ++r7JOtOaQ6oH3pFow5rcthL
	vjTYqV/bmy1HASWC+oWJBGnlLCM7QmT8vjAzhBylClYOw/WnNxZovxIn/n5KT55M4ca8nV
	mpk+txjSkSP7T9+ZmepnFaBruI0NzWkRKq+sXaRLMngm/O/rFr/W5fhTzyuO8VTXItYXeT
	VKo6I+bI/3EcnvL7ZUuTTzDDyWOSmAsLRXg5mvErZ20/6cCTVy/p2NrEDvXjtQ==
Received: from [IPV6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04] (unknown [IPv6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: jhb)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4Vv5j71FnjzNsc;
	Tue,  4 Jun 2024 23:02:51 +0000 (UTC)
	(envelope-from jhb@FreeBSD.org)
Message-ID: <1ade77c1-f15a-4e20-a8ea-29ac3a86e85e@FreeBSD.org>
Date: Tue, 4 Jun 2024 16:02:49 -0700
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: git: 1c45a62a2f66 - main - qlnxe: Fix multiple locking issues
Content-Language: en-US
To: Kevin Bowling <kbowling@FreeBSD.org>, src-committers@FreeBSD.org,
 dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
References: <202405280643.44S6hBkh054482@gitrepo.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
In-Reply-To: <202405280643.44S6hBkh054482@gitrepo.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 5/28/24 2:43 AM, Kevin Bowling wrote:
> The branch main has been updated by kbowling:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=1c45a62a2f667b45ec10a92ad58ff5a34e68b569
> 
> commit 1c45a62a2f667b45ec10a92ad58ff5a34e68b569
> Author:     Keith Reynolds <keith.reynolds@hpe.com>
> AuthorDate: 2024-05-28 06:41:05 +0000
> Commit:     Kevin Bowling <kbowling@FreeBSD.org>
> CommitDate: 2024-05-28 06:41:05 +0000
> 
>      qlnxe: Fix multiple locking issues
>      
>      Multiple issues are reported with WITNESS and code inspection of the
>      locking and lock initialization.
>      
>      PR:             278084
>      MFC after:      1 week
> ---
>   sys/dev/qlnx/qlnxe/bcm_osal.h  |  8 +++----
>   sys/dev/qlnx/qlnxe/ecore.h     |  1 +
>   sys/dev/qlnx/qlnxe/ecore_mcp.c | 48 +++++++++++++++++++++---------------------
>   sys/dev/qlnx/qlnxe/ecore_mcp.h |  6 +++---
>   sys/dev/qlnx/qlnxe/qlnx_def.h  |  2 +-
>   sys/dev/qlnx/qlnxe/qlnx_os.c   |  9 ++++----
>   sys/dev/qlnx/qlnxe/qlnx_os.h   |  4 ++--
>   7 files changed, 40 insertions(+), 38 deletions(-)
> 
> diff --git a/sys/dev/qlnx/qlnxe/bcm_osal.h b/sys/dev/qlnx/qlnxe/bcm_osal.h
> index 5d940d3272d6..c820532c9e0a 100644
> --- a/sys/dev/qlnx/qlnxe/bcm_osal.h
> +++ b/sys/dev/qlnx/qlnxe/bcm_osal.h
> @@ -72,7 +72,7 @@ extern void qlnx_dma_free_coherent(void *ecore_dev, void *v_addr,
>                           bus_addr_t phys, uint32_t size);
>   
>   extern void qlnx_link_update(void *p_hwfn);
> -extern void qlnx_barrier(void *p_hwfn);
> +extern void qlnx_barrier(void *p_dev);
>   
>   extern void *qlnx_zalloc(uint32_t size);
>   
> @@ -213,14 +213,14 @@ typedef struct osal_list_t
>   #define OSAL_SPIN_LOCK_ALLOC(p_hwfn, mutex)
>   #define OSAL_SPIN_LOCK_DEALLOC(mutex) mtx_destroy(mutex)
>   #define OSAL_SPIN_LOCK_INIT(lock) {\
> -		mtx_init(lock, __func__, MTX_NETWORK_LOCK, MTX_SPIN); \
> +		mtx_init(lock, __func__, "OSAL spin lock", MTX_SPIN); \
>   	}
>   

Do you really need MTX_SPIN here?  Device drivers rarely need spin locks.
The equivalent to a Linux spin lock in drivers is generally a MTX_DEF
mutex.

-- 
John Baldwin


From nobody Tue Jun  4 23:07:53 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv5py5hYvz5MtDK;
	Tue, 04 Jun 2024 23:07:54 +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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv5py4xv5z4CYV;
	Tue,  4 Jun 2024 23:07:54 +0000 (UTC)
	(envelope-from jhb@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717542474;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=UVp3/Jfk0sre1PFv2zjUiceUztzSDfjlyCipASe1/10=;
	b=Ufd7V0kbhKnutR9rx9Nlwe/tCJtmckBB6dPX0iEJEldy6sY7dJyIvOp89YIVMoQfsZqX/V
	hx2N6+Lce2+B+B5ujNWczu1KJmoIghdsyWnJWLb+YDSChdAZ3zxDzADfMielSFezUXwkQQ
	gpBvP5ee72WQUCZMY3rnozxhz4rRcbhP0zRYms3RNMlplJtY+e8cJondEKbyD9sNj/eekS
	PfrBSuiPyYbFJUD+WHGnzvMt9fx9jhpd/Oia2b9xFgLwQaaOepkgP+7spPP5iKC5TzoiKS
	R9U3lA5EKUODgJucFhm2dzooFMMj19Dr10k39RY994ypyToBhiFyy6tP+Z6PMQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717542474; a=rsa-sha256; cv=none;
	b=TqoGaNNR3Et7ddcaRQh1VQnjWCMaVNoxQyK9qhFOd1DYqpMCPAbFkdyRV+oXgEr7yxVJyS
	P7mcUlJ2F7r2OfS58ge155/t1ouxObWyFkLfeIunDuHro8Hi1K7X9D9eFhdSPfjXaT3a3O
	48Rbx7WwTETovth8v+LfAQ4VOE36BBvfDqTB4T8YqKg4tnppuy5gL7SalWokc6rcx52p6a
	9qxbxJoRhIWVrCnmqj7Rno1hp2wTw/vfhvGA3orgcXkhNe1Zs5REq3TPfpT8q3KUsMdihH
	HGaH5AiifAydDceTvdffi8hI9jWlKFdLUDrWrNUB4ARTtExx8QdtS+ATQrHWDw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717542474;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=UVp3/Jfk0sre1PFv2zjUiceUztzSDfjlyCipASe1/10=;
	b=pFDrqrKg9CBV0mOLelfnlL1LOIiLVd1seMewz3iNw2cyI9aGN1XRfxHtSZSbdHFLNjWudf
	P8y6nwAO10D4yMKldShQv5aazy/1RdaJE/6BBOSCc3OF/v3ac4/Xncy9/Oxks+WUV4hwZm
	iSEQ01hHtvCScFuqKEr5qUxqe9+y4Y0boKtdunK6B/pn27R4AvWPgCf0CaQ6i6pTmb59Oe
	+DUZ3Vph77qj4X79kYr53n/v//AU663/Q+1nX6rigojFQIY45oGByCjYIM1vGs5GFFh45d
	DItZbLm1PoRGKECO4HRsZ+1a4X+xuuSohzPyNvxQVAIGKhfuaVLfqtaMjumExA==
Received: from [IPV6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04] (unknown [IPv6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: jhb)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4Vv5py1PvdzP4q;
	Tue,  4 Jun 2024 23:07:54 +0000 (UTC)
	(envelope-from jhb@FreeBSD.org)
Message-ID: <e447211e-6d51-4060-8f6c-b017bb1c9ce1@FreeBSD.org>
Date: Tue, 4 Jun 2024 16:07:53 -0700
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: git: dcb65c5a94d4 - main - csh: Remove hardlink /.cshrc
Content-Language: en-US
To: Emmanuel Vadot <manu@FreeBSD.org>, src-committers@FreeBSD.org,
 dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
References: <202405290757.44T7vbf4021395@gitrepo.freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
In-Reply-To: <202405290757.44T7vbf4021395@gitrepo.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 5/29/24 3:57 AM, Emmanuel Vadot wrote:
> The branch main has been updated by manu:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=dcb65c5a94d4c622b1d486847dc20488f59974e7
> 
> commit dcb65c5a94d4c622b1d486847dc20488f59974e7
> Author:     Emmanuel Vadot <manu@FreeBSD.org>
> AuthorDate: 2024-05-27 13:12:18 +0000
> Commit:     Emmanuel Vadot <manu@FreeBSD.org>
> CommitDate: 2024-05-29 07:56:58 +0000
> 
>      csh: Remove hardlink /.cshrc
>      
>      Remove this historical artifact.
>      csh will try to use /.csrch if the user has no home directory defined which
>      is rather unlikely (To be exact if the concatenation of $HOME and "/.cshrc"
>      fail which is the same thing).
>      
>      Also, with this change pkg will happily handle 3way merge for /root/.cshrc
>      
>      Differential Revision:  https://reviews.freebsd.org/D45382
>      Reviewed by:            emaste, imp
>      Sponsored by:           Beckhoff Automation GmbH & Co. KG

FWIW, this happens anytime you use /bin/csh as root's shell and boot into
single user mode.  Similar to /.profile being used for single user mode if
root's shell is /bin/sh.  Given we've changed the default shell for root,
then it's fine to do this change, but that probably should have been noted
in the commit log (in part to serve as a reminder so we don't remove the
links for sh).

-- 
John Baldwin


From nobody Tue Jun  4 23:11:53 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv5vZ60Bsz5Mt80;
	Tue, 04 Jun 2024 23:11:54 +0000 (UTC)
	(envelope-from lexi@le-fay.org)
Received: from fuchsia.eden.le-Fay.ORG (fuchsia.eden.le-fay.org [IPv6:2001:8b0:aab5:107::11])
	by mx1.freebsd.org (Postfix) with ESMTP id 4Vv5vZ3xJDz4D8b;
	Tue,  4 Jun 2024 23:11:54 +0000 (UTC)
	(envelope-from lexi@le-fay.org)
Authentication-Results: mx1.freebsd.org;
	none
Received: from iris.eden.le-Fay.ORG (iris.eden.le-fay.org [IPv6:fd12:8247:3:1::7])
	by fuchsia.eden.le-Fay.ORG (Postfix) with ESMTP id 21FC3277D4;
	Tue, 04 Jun 2024 23:11:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=le-fay.org; s=fuchsia;
	t=1717542714; bh=TK+B5AZFYmcc8wMtPTmQvbyoLos1wefowczw4CTBO84=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=wP9hoPfQWgT01HeoIy1VWVsOCiXYLQyyDh+hRJGbcFP8VhdLMR1ClHY2BEUFpCTIf
	 LXvEGinzE/hwb6R4D6kWCMI9Rh8yuBnmp0RI6wrIuoO7BJ4HuXQfxaA13KNZ6P0rPZ
	 o3FnqG1oURfgUvvWvUUDGZZ6cn9Qm42Eq0SoonBE=
Received: from daphne.eden.le-fay.org (daphne.eden.le-fay.org [IPv6:2001:8b0:aab5:106:3::17])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384)
	(No client certificate requested)
	by iris.eden.le-Fay.ORG (Postfix) with ESMTPSA id 8E4EC2C0418;
	Wed, 05 Jun 2024 00:11:54 +0100 (BST)
Date: Wed, 5 Jun 2024 00:11:53 +0100
From: Lexi Winter <lexi@le-fay.org>
To: John Baldwin <jhb@freebsd.org>
Cc: Emmanuel Vadot <manu@freebsd.org>, src-committers@freebsd.org,
	dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject: Re: git: dcb65c5a94d4 - main - csh: Remove hardlink /.cshrc
Message-ID: <Zl-fOXTFMDj2cbHg@daphne.eden.le-fay.org>
References: <202405290757.44T7vbf4021395@gitrepo.freebsd.org>
 <e447211e-6d51-4060-8f6c-b017bb1c9ce1@FreeBSD.org>
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
In-Reply-To: <e447211e-6d51-4060-8f6c-b017bb1c9ce1@FreeBSD.org>
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:20712, ipnet:2001:8b0::/32, country:GB]
X-Rspamd-Queue-Id: 4Vv5vZ3xJDz4D8b

John Baldwin:
> >      csh: Remove hardlink /.cshrc
>=20
> FWIW, this happens anytime you use /bin/csh as root's shell and boot into
> single user mode.

if csh reads /.cshrc rather than /root/.cshrc, this feels like a bug in
csh which should be fixed.

is it relying on $HOME rather than using getpwuid() to find its home
directory?

From nobody Tue Jun  4 23:19:33 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv64P5rlqz5MvRb;
	Tue, 04 Jun 2024 23:19:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv64P4bRNz4Dqv;
	Tue,  4 Jun 2024 23:19:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717543173;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=8aclMkdv4jJrckCkKKY9C2t6MO3QZQiCr01TPmP19Rs=;
	b=DWsHJg+cJKAu/G+HLeR3ISWyUFSJ6Acs71RX321YPe5P6Sn28DT617GAiweeFf8uTtqMif
	xnFjwqyf57Hhlm6R6dDUFLn6cyZmGGqAPu6TxnaZschI0rauT4/1sL8ObG55LcH9X0R+hR
	c8sqRN2KCvXMmvy/GT5xXBet8DQlpEWrGlA20o4OUHtGxj/PIYlCJdidiGed5bS4O/kibz
	3+ohUogQLE9A1L6A5uC1NwsnQPoZOwnFUokKRkoSdCBlUzbj9zCADzyca/3TpInpxgVhJx
	V3WSCxPyuYoTcR6AJjvy6DLG3Qe79O04zl6oSkXNYH/9WJ68IM5JMXPkjwOQVA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717543173; a=rsa-sha256; cv=none;
	b=Me9Z1IW9EWUWGgEPFXsbNEY7GH4nCKqNieyScYBo5w+9LGs4Cr6M35OW+NYxMe9PV6zHk+
	ZAqDVNI6jy2wrIDGGBFqELNFvX/cCY3c24loBavGJc5fL+zzUQZ409kQXFp1XcFFQ+wiHk
	VGS2K+jvj6g2LKRLxn3QyNBTdB4a7ekqHRBP/Kr8M8C4qvI/OAZJcuuFaO3IF64BiQ0CSt
	ce6cEKj3nlRXth99EdGRbvzxeQs/j1cKUBl9bidAbTBxBtF+O/fpTeKIE+XmIXDOCVhFTR
	888CQ1zHhstHzaWQJ0vfZ9A4qx2F6otzLKFX3EVCBdlhnUycoS7/N8q0ZDKLZg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717543173;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=8aclMkdv4jJrckCkKKY9C2t6MO3QZQiCr01TPmP19Rs=;
	b=Js4hdR4z9Gbll7m+kCgYebExtpN3LFbVQLt3LFlSabtobY6b1xj7G1UPimD0c8nDEm4GRP
	agY/Nn0lw4BiSd8u/1PD0e4pntdQTkn4eckqE8hFnwE7d0JjnYNpRd0Go2cT9Vqze24CVz
	ARA+8LXqmORfv3NKNNFToIOdqaP9WOQ7E2PUEqOGweklNqaOU1Mdc9b7YCteR7lSOB71wW
	G0oj8XySqYsgfUDDaK8Q8vw4oFg2L6Cnb9TYH/xuloyTSXNqZlOgkRYOpqIit+EfEeu2bO
	stwcHqvoaMjAPahJFfGqp6p0fTS2PkxJJeV4ONM0Ns6LeWvaq+/0ovatyrvTdQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv64P4ByYzds4;
	Tue,  4 Jun 2024 23:19:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454NJXvo096531;
	Tue, 4 Jun 2024 23:19:33 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454NJXRj096528;
	Tue, 4 Jun 2024 23:19:33 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 23:19:33 GMT
Message-Id: <202406042319.454NJXRj096528@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: 191e6a604938 - main - physmem: zero entire array
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 191e6a6049385a47db42595c32de63d7dd119ae5
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=191e6a6049385a47db42595c32de63d7dd119ae5

commit 191e6a6049385a47db42595c32de63d7dd119ae5
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-06-04 23:17:13 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 23:17:13 +0000

    physmem: zero entire array
    
    As a convenience to callers, who might allocate the array on the stack.
    An empty/zero-valued range indicates the end of the physmap entries.
    
    Remove the now-redundant calls to bzero() at the call site.
    
    Reviewed by:    andrew
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D45318
---
 sys/arm64/arm64/pmap.c  | 1 -
 sys/kern/subr_physmem.c | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index b6bc113ba8a4..03d0a1cc6676 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -1437,7 +1437,6 @@ pmap_bootstrap_san1(vm_offset_t va, int scale)
 	 * Rebuild physmap one more time, we may have excluded more regions from
 	 * allocation since pmap_bootstrap().
 	 */
-	bzero(physmap, sizeof(physmap));
 	physmap_idx = physmem_avail(physmap, nitems(physmap));
 	physmap_idx /= 2;
 
diff --git a/sys/kern/subr_physmem.c b/sys/kern/subr_physmem.c
index fda47d4ef697..a45c36aef2d7 100644
--- a/sys/kern/subr_physmem.c
+++ b/sys/kern/subr_physmem.c
@@ -189,6 +189,8 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail,
 	const struct region *exp, *hwp;
 	uint64_t availsz;
 
+	bzero(avail, maxavail * sizeof(vm_paddr_t));
+
 	totalmem = 0;
 	availmem = 0;
 	availsz = 0;
@@ -587,7 +589,6 @@ ram_attach(device_t dev)
 	rid = 0;
 
 	/* Get the avail list. */
-	bzero(avail_list, sizeof(avail_list));
 	regions_to_avail(avail_list, EXFLAG_NOALLOC | EXFLAG_NODUMP,
 	    PHYS_AVAIL_COUNT, 0, NULL, NULL);
 

From nobody Tue Jun  4 23:19:34 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv64Q6l3Vz5MvPB;
	Tue, 04 Jun 2024 23:19:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv64Q59V0z4F6k;
	Tue,  4 Jun 2024 23:19:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717543174;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=A9XsId/jZ3uxCyyYTorIMkXKezLKeVBlObLcvZzrxOE=;
	b=S2sIYFpb3ubTBMJFD1QT4QK8wcEiZZvztGFxqLtZMaC0g/CGi+Bj0N9rxUnsH50EzchMUn
	QrWIsvntMiLeTu+ZyAbWRerrHyUjyGUMm9CWnURlsZg+iGzMK2daei7SuNbUOZ8WSp79hL
	c2Rga+d8pG9E7Ft+whsdo7UQUgeM7WxD+gZqjqLXSxr65R86T6KsBrK1MQQywtyhQKMDN0
	O4yflnI7R3LEQC898MGBxkbCDdiJauRUgIGiv0+cnYyUghNvQBc6BNUxePlZsdwrObS8/o
	CWGS8pNswVMAMMpqdGUaGx/oCQf/R2pFSzTlbWX4h2t9zibtsesfsxRywh+I+w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717543174; a=rsa-sha256; cv=none;
	b=wmJQih62wQVZcABdC5z8qxLfiIrnalTDeFXjsP6HDLC+cfoe2iVt2xOvXMKKfKuyncQx2b
	xi/DzGeDj3YLOslwwU8/FVzuqwRamLeJlYixlfIA6lQ6OZcqVg1pSmxJzFWP2loRYSjwwt
	cyn3wDSGUIYcYcUV6kaC3RMYCT0IOXDQZ/TVc3OdDG5NH3sN8r+cYxwIHmkhK8auTUFBC4
	Z7QuwX6dyZW8zsEXgss3qTJy0NndYWMmjwZipi407ImDS4WwtDGopx6b3s2zokSdGo8Zyr
	MyzHhvn6wInHhopmo1Dk1KwWFqlWPWaz5tkhd+fKKPQW9osUpR0bxGb8KUwXzw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717543174;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=A9XsId/jZ3uxCyyYTorIMkXKezLKeVBlObLcvZzrxOE=;
	b=SgfCDvXHXrYDF2TPsr0C3qejAKkmvfBJZrRUFUyMjgjwYWJv6xMzxf/dF5gv3vcMlNrk8c
	GZ9jPK97YNJWF4v1SkPfNn2yQuOkoS8BxLnWEHgT3SO8dCzlo3z9LSKiGLY9fRqHL90FAv
	p7GyunM7nKI59Ddm9ATfM72GBdCK9YAhxvUgrQQJgTY68D6rxvSSkHGPJwMuswyQxQjch3
	wvobgI7iU7EE/1w9EytFTnQifZvhAZ2v/R8amKix+N4BtW0Hh2c4tz/PdOZ10cXEHZRXNl
	FO0dI0/BcsTDOQWc29OUt6AbxHx83N7GBm5fs9kgigWQ2i/dUq/x4OxMI62opA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv64Q4mqnzf5x;
	Tue,  4 Jun 2024 23:19:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454NJY1i096570;
	Tue, 4 Jun 2024 23:19:34 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454NJYdo096567;
	Tue, 4 Jun 2024 23:19:34 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 23:19:34 GMT
Message-Id: <202406042319.454NJYdo096567@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: 5df74441b35f - main - devmap: eliminate unused arguments
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 5df74441b35f2303ecdc7b79f9d331f5e77a07db
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=5df74441b35f2303ecdc7b79f9d331f5e77a07db

commit 5df74441b35f2303ecdc7b79f9d331f5e77a07db
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-06-04 23:17:47 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 23:17:47 +0000

    devmap: eliminate unused arguments
    
    The optional 'table' pointer is a legacy part of the interface, which
    has been replaced by devmap_register_table()/devmap_add_entry(). The few
    in-tree callers have already adapted to this, so it can be removed.
    
    The 'l1pt' argument is already entirely unused within the function.
    
    Reviewed by:    andrew, markj
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D45319
---
 sys/arm/arm/machdep.c     |  2 +-
 sys/arm64/arm64/machdep.c |  2 +-
 sys/kern/subr_devmap.c    | 17 ++++-------------
 sys/riscv/riscv/machdep.c |  2 +-
 sys/sys/devmap.h          |  7 +++----
 5 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index c36953c513be..f54113e3d0ca 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -551,7 +551,7 @@ initarm(struct arm_boot_params *abp)
 
 	/* Establish static device mappings. */
 	err_devmap = platform_devmap_init();
-	devmap_bootstrap(0, NULL);
+	devmap_bootstrap();
 	vm_max_kernel_address = platform_lastaddr();
 
 	/*
diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c
index 517f4e7c2e23..e7d46ff70531 100644
--- a/sys/arm64/arm64/machdep.c
+++ b/sys/arm64/arm64/machdep.c
@@ -996,7 +996,7 @@ initarm(struct arm64_bootparams *abp)
 
 	physmem_init_kernel_globals();
 
-	devmap_bootstrap(0, NULL);
+	devmap_bootstrap();
 
 	valid = bus_probe();
 
diff --git a/sys/kern/subr_devmap.c b/sys/kern/subr_devmap.c
index 441ffeb1270a..3ab20a2a4d43 100644
--- a/sys/kern/subr_devmap.c
+++ b/sys/kern/subr_devmap.c
@@ -165,28 +165,19 @@ devmap_register_table(const struct devmap_entry *table)
 /*
  * Map all of the static regions in the devmap table, and remember the devmap
  * table so the mapdev, ptov, and vtop functions can do lookups later.
- *
- * If a non-NULL table pointer is given it is used unconditionally, otherwise
- * the previously-registered table is used.  This smooths transition from legacy
- * code that fills in a local table then calls this function passing that table,
- * and newer code that uses devmap_register_table() in platform-specific
- * code, then lets the common platform-specific init function call this function
- * with a NULL pointer.
  */
 void
-devmap_bootstrap(vm_offset_t l1pt, const struct devmap_entry *table)
+devmap_bootstrap(void)
 {
 	const struct devmap_entry *pd;
 
 	devmap_bootstrap_done = true;
 
 	/*
-	 * If given a table pointer, use it.  Otherwise, if a table was
-	 * previously registered, use it.  Otherwise, no work to do.
+	 * If a table was previously registered, use it.  Otherwise, no work to
+	 * do.
 	 */
-	if (table != NULL)
-		devmap_table = table;
-	else if (devmap_table == NULL)
+	if (devmap_table == NULL)
 		return;
 
 	for (pd = devmap_table; pd->pd_size != 0; ++pd) {
diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c
index 4e3564b11c9e..f44056f56212 100644
--- a/sys/riscv/riscv/machdep.c
+++ b/sys/riscv/riscv/machdep.c
@@ -568,7 +568,7 @@ initriscv(struct riscv_bootparams *rvbp)
 	physmem_init_kernel_globals();
 
 	/* Establish static device mappings */
-	devmap_bootstrap(0, NULL);
+	devmap_bootstrap();
 
 	cninit();
 
diff --git a/sys/sys/devmap.h b/sys/sys/devmap.h
index 786608e0ce30..914bec31af4c 100644
--- a/sys/sys/devmap.h
+++ b/sys/sys/devmap.h
@@ -71,11 +71,10 @@ void devmap_register_table(const struct devmap_entry * _table);
  * Establish mappings for all the entries in the table.  This is called
  * automatically from the common platform-specific init function in
  * <ARCH>/machdep.c, and also from the custom platform-specific init routines
- * in older code.  If the table pointer is NULL, this will use the table
- * installed previously by devmap_register_table().
+ * in older code.  This function only has an effect when a table was installed
+ * previously by devmap_register_table().
  */
-void devmap_bootstrap(vm_offset_t _l1pt,
-    const struct devmap_entry *_table);
+void devmap_bootstrap(void);
 
 /*
  * Translate between virtual and physical addresses within a region that is

From nobody Tue Jun  4 23:19:35 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv64R74frz5MvPF;
	Tue, 04 Jun 2024 23:19:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv64R6Pp5z4F8q;
	Tue,  4 Jun 2024 23:19:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717543175;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=r6nxv/Q+rXiKl3tjhsa5/26M/UfaLM31ASb3L7N88r8=;
	b=goH3FY03HE4pk7on7mrMooh3HnqhEhN8rIki74yvaB9e8dvx0yBpHBUALoL/mRRXTrRl7S
	P/+D4954K67gbGdVtKbdgyMRawS1/IFY7e4xTrUppb80cA6Gr+SIbu57PUeC2gTI6mNhDs
	vTK8LXcB1KPwSb/MqhAW//2d93nU+qpSpPoxhRtMqh+U2Cdi6vT3sE23IIu89jivoHPXrS
	uXGPTbpmFmhuOJNrs2DdViUTEFoDJvcVb3c/fCzdolVfJkGQpWn3KChUBHlqJFA9QQJDU6
	SlU/v2veFESjA6A0ilHtNZldPnwpKqOWyXNu7TdORl/ROfZgF1cDraBP01ihTg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717543175; a=rsa-sha256; cv=none;
	b=A6ADBvtlu+lQWQU1/ISMMlyEMdaXZJT4BhoQutgaWa7fGjRDMeAQw7k2EdXDmp12fEnPY1
	HNT9LzD+cKZyUDw9qAIsr9Am63sJ9afT/hBMFlR0DeMILCXOvPHsmJSVz2cXWTT9UK18wc
	YK7cDFMOVbcFRO50yj/xkRx0cmfPDV8gBKt03SWUz5eDlT7cGX2JMCRknrJHscTuphCdFN
	7aKdDS54mfcMFHFKOC8KjQ8jXV505V/0JhRGqTezwbIKPLxOWWRaBb7v8W5w9zVXNn4QZn
	2O/dOYP0woqxClaCkkYJ0j1eID8IC0SEpqaPNlz2tdExoEZ//NE52/FyGiKsuQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717543175;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=r6nxv/Q+rXiKl3tjhsa5/26M/UfaLM31ASb3L7N88r8=;
	b=A1NSuDoQaWZqDEMLjse8Zz2VSR1C1oSoRBlTiNAzDYX8Ccz/Jqug9PScp3AHWUchYiSSZl
	Ebct9eSwN8gHrEB0OFEJXOS2fZCFSD6uGobn6frg8yJSmWeECgVe/DcQEY0y+2uNGep6Z7
	iCw1W585AX5o67MvRgUSmbxnhEptF+GdxAU/MWOAT1iojyrOK7hcXaBYHz0XfdQyRkjojm
	0NaRsg+/4Wj7oxqd0K6tC6dx+dWZtXTJbsSWFrgHmfPKMbf+ld0pMg+mDUGUoxJ5wydfiA
	V91twYmx/NJoN6zDYJaLGDWLEWChhjRKjDcglixX7VKhByBpJ8qq1fAFkDm2+A==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv64R60vyzdxb;
	Tue,  4 Jun 2024 23:19:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454NJZap096624;
	Tue, 4 Jun 2024 23:19:35 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454NJZ8j096621;
	Tue, 4 Jun 2024 23:19:35 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 23:19:35 GMT
Message-Id: <202406042319.454NJZ8j096621@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: 191bf63da255 - main - riscv: Move sigcode out of
  locore.S
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 191bf63da25589f9364f99390ff81432227bb475
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=191bf63da25589f9364f99390ff81432227bb475

commit 191bf63da25589f9364f99390ff81432227bb475
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-06-04 23:18:05 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 23:18:05 +0000

    riscv: Move sigcode out of locore.S
    
    It really doesn't fit here anymore as locore is all about early startup
    code. Thus, move it to its own file.
    
    Reviewed by:    br
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D45320
---
 sys/conf/files.riscv       |  1 +
 sys/riscv/riscv/locore.S   | 25 ----------------
 sys/riscv/riscv/sigtramp.S | 71 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 25 deletions(-)

diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv
index 49c8ddd0c516..90e2826ce55d 100644
--- a/sys/conf/files.riscv
+++ b/sys/conf/files.riscv
@@ -58,6 +58,7 @@ riscv/riscv/pmap.c		standard
 riscv/riscv/ptrace_machdep.c	standard
 riscv/riscv/riscv_console.c	optional	rcons
 riscv/riscv/riscv_syscon.c	optional	syscon riscv_syscon fdt
+riscv/riscv/sigtramp.S		standard
 riscv/riscv/sbi.c		standard
 riscv/riscv/sbi_ipi.c		optional	smp
 riscv/riscv/stack_machdep.c	optional	ddb | stack
diff --git a/sys/riscv/riscv/locore.S b/sys/riscv/riscv/locore.S
index 25e9b4d6d7c4..5a7e15ba443b 100644
--- a/sys/riscv/riscv/locore.S
+++ b/sys/riscv/riscv/locore.S
@@ -34,7 +34,6 @@
 
 #include "assym.inc"
 
-#include <sys/syscall.h>
 #include <machine/asm.h>
 #include <machine/param.h>
 #include <machine/trap.h>
@@ -290,30 +289,6 @@ initstack:
 	.space  (PAGE_SIZE * KSTACK_PAGES)
 initstack_end:
 
-ENTRY(sigcode)
-	mv	a0, sp
-	addi	a0, a0, SF_UC
-
-1:
-	li	t0, SYS_sigreturn
-	ecall
-
-	/* sigreturn failed, exit */
-	li	t0, SYS_exit
-	ecall
-
-	j	1b
-END(sigcode)
-	/* This may be copied to the stack, keep it 16-byte aligned */
-	.align	3
-esigcode:
-
-	.data
-	.align	3
-	.global	szsigcode
-szsigcode:
-	.quad	esigcode - sigcode
-
 	.align	12
 pagetable_l1:
 	.space	PAGE_SIZE
diff --git a/sys/riscv/riscv/sigtramp.S b/sys/riscv/riscv/sigtramp.S
new file mode 100644
index 000000000000..7e45d22fb2ef
--- /dev/null
+++ b/sys/riscv/riscv/sigtramp.S
@@ -0,0 +1,71 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Portions of this software were developed by the University of Cambridge
+ * Computer Laboratory as part of the CTSRD Project, with support from the
+ * UK Higher Education Innovation Fund (HEIF).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "assym.inc"
+
+#include <sys/syscall.h>
+
+#include <machine/asm.h>
+
+/*
+ * This code is copied to the user's stack for returning from signal handlers
+ * (see sendsig() and sigreturn()). We have to compute the address of the
+ * sigcontext struct for the sigreturn call.
+ */
+ENTRY(sigcode)
+	mv	a0, sp
+	addi	a0, a0, SF_UC
+
+1:
+	li	t0, SYS_sigreturn
+	ecall
+
+	/* sigreturn failed, exit */
+	li	t0, SYS_exit
+	ecall
+
+	j	1b
+END(sigcode)
+
+	/* This may be copied to the stack, keep it 16-byte aligned */
+	.align	3
+esigcode:
+
+	.data
+	.align	3
+	.global	szsigcode
+szsigcode:
+	.quad	esigcode - sigcode

From nobody Tue Jun  4 23:19:36 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv64T0sNJz5MvMj;
	Tue, 04 Jun 2024 23:19:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv64T02sgz4F01;
	Tue,  4 Jun 2024 23:19:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717543177;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Wkjn52duBzA9d3p3+MqOtzpD5CH63g3MQqgdYAfGJHk=;
	b=KOCsiBoDMqrxKDfpdZcXf8+OwzWKRfPJABuPbf6U1Ze+OH+EpxHeiEYgtfJTpt8S5UjzUJ
	feomD/Jj0mGGSzxzHq3fw2m0DCdrGNTvBfvnTqTnFdonlInx6Vz7R0V9sf02QDFDdicB/4
	7URQRzfOicYtVpATJf60rlHYDP9VIl/j6RkeKraa/HlMne8XhWMHxBfTQQdiwxoHjReL2s
	qB+vvWDkUrmxhArq2r8QysGAasaCJoo0/vwsis22zZUSBkKkvnR23MJKhIRAh7FsZDENup
	GYg84/5blMJ/idGXJ8YXxroUakHBRpZLJ+BwngQFMVeXE2sFZa5FKe7CuaYo6w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717543177; a=rsa-sha256; cv=none;
	b=JS9XoTGbYhg5uQFpEe7p3QzdXfkU7hBNWNxakSnieKZZSfCOW4B35XUE5bCBbIGdaAK3P0
	gsFNEM12ShWNOwsdnKgH0ZMkgKVOzqbXz7aMfI9AEm3VoF2OVeAeBvo3aWHLw2MGBw38zO
	K9YUAmLsnDDu0vOINVLG/d/CfMfllfs6my6uMsAXtnxqDJi7JCE19ryQb+mZE3hPJJrE30
	HiI0IYOUVRMtR61X3gkiC3JvIFyICl4IO16yyWcPBrolwxCokAge2IS7mOmNlR+gckgR+b
	udNN6NvXHgkVxxok7FEclkbGKavzYYTLFFmaUcAffQzuCiqLCnhoiTxrOY2N+g==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717543177;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Wkjn52duBzA9d3p3+MqOtzpD5CH63g3MQqgdYAfGJHk=;
	b=XI4ONtRNp/52wL7O/Iod89Uu/nhWbOXWZZPT6EYP6mtQBl0U6G51u5A4sjTfLDyq4SqqaX
	1bNLH4shltnLVKCDbRv2hSWuLlmJ2vwdaYDmCpjvyke9sc4MdPRxDvM+9VpPIy0p84WWPI
	/i0EalP88AZcWVBAXVnj3chd8szK23fCBzpUnYoBb7lqz9c1HlIh5KJ9Q8DDeEsXCeY0MN
	Z+9h8WC21chCI6BC6YlLxw3DPYOE6fHjYh1YbiDs3yGX04GjnbKWcQgGslEEUbiwg4BAii
	gi2w1EvYnPPvBaGnke/tIidnRKJege0AOuvC5rdApQTHW8GoWENB3KjjKxg0Rw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv64S6kgbzdZF;
	Tue,  4 Jun 2024 23:19:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454NJaAt096666;
	Tue, 4 Jun 2024 23:19:36 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454NJawI096663;
	Tue, 4 Jun 2024 23:19:36 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 23:19:36 GMT
Message-Id: <202406042319.454NJawI096663@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mitchell Horne <mhorne@FreeBSD.org>
Subject: git: 65a33120c3d5 - main - riscv: fix vm.pmap.kernel_maps
  with Sv48
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: mhorne
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 65a33120c3d5c4bd815de1c463fac0cd3ce7d368
Auto-Submitted: auto-generated

The branch main has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=65a33120c3d5c4bd815de1c463fac0cd3ce7d368

commit 65a33120c3d5c4bd815de1c463fac0cd3ce7d368
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2024-06-04 23:18:54 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2024-06-04 23:18:54 +0000

    riscv: fix vm.pmap.kernel_maps with Sv48
    
    With 4-level paging enabled, the layout of KVA is identical, but we need
    to step through an extra level to find the L1 table.
    
    Reviewed by:    markj
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D45473
---
 sys/riscv/riscv/pmap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index e8504bcb0f59..0bdf3be8ea39 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -5017,7 +5017,7 @@ sysctl_kmaps(SYSCTL_HANDLER_ARGS)
 {
 	struct pmap_kernel_map_range range;
 	struct sbuf sbuf, *sb;
-	pd_entry_t l1e, *l2, l2e;
+	pd_entry_t *l1, l1e, *l2, l2e;
 	pt_entry_t *l3, l3e;
 	vm_offset_t sva;
 	vm_paddr_t pa;
@@ -5044,7 +5044,8 @@ sysctl_kmaps(SYSCTL_HANDLER_ARGS)
 		else if (i == pmap_l1_index(VM_MIN_KERNEL_ADDRESS))
 			sbuf_printf(sb, "\nKernel map:\n");
 
-		l1e = kernel_pmap->pm_top[i];
+		l1 = pmap_l1(kernel_pmap, sva);
+		l1e = pmap_load(l1);
 		if ((l1e & PTE_V) == 0) {
 			sysctl_kmaps_dump(sb, &range, sva);
 			sva += L1_SIZE;

From nobody Tue Jun  4 23:52:15 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv6p75v4Zz5N07r;
	Tue, 04 Jun 2024 23:52:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv6p71QwBz4K8R;
	Tue,  4 Jun 2024 23:52:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717545135;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=+mi29rZzINty6FUmV6hUH/rzbPkjPE+XCCGD5emOfCI=;
	b=anAzfiAS3ihf4AWTIv5D1emrG1h6aZlUw1XWeNdeGKz2ETFYoLegp5xtheZu/pxzM4O9Lm
	uJiTjeKP2nc+ruqWNUGkb94u75RyiMHi6xoUkpvV4gb3Lyzi0IiVWeBVJriSY3U757Yizu
	L03PJkkWNuuSmapnGufwTk8qA4ThDgsE2zH9QMAIdYmExt/1eBF56+ZoLVTb0gR9UpZCY1
	4LEc3+pKxWmxzVAYXVAivazBmiLCIgP0HL5goe50KLP5ZUNBi8FhOJwKONydX7QDtWib4v
	KJKQplc36H+A/Qci8t5A0N+mSTtG0InkYtfXT0Wy0pOGtat0eWpkF2NlpluOCA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717545135; a=rsa-sha256; cv=none;
	b=r4pbT/YL8I6wM9O2jg/VlW2nZCAQYKfjX2t81XXcd3fZNe3f4Qiny0iqrgaREmzgyviGb9
	jRCsbnDSOJi54C7nr8G9/MA8rQ4zjHV3CxM0hbrZo8IzHFiI+wWrCDOIpfoWTxTSY2scay
	PMtbKtdqTyAEkSk8lKCHYWY0X0YdRg5KlT4nKB6JZpVGsIApo/T7/e3O5qiZrNs8fWbIxX
	u6o/jNbuOXb+QVDwUhhpX77TiinN1/g16rOB8EbinsXfeAz+7Q5GxOO0iaiyIMgcC/ZY05
	Kfy8gAfHnL+0fUqgaYA3tf1mHwXffg1Ua8enHCbT7RKfPTUR+jRTWQPkq567gA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717545135;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=+mi29rZzINty6FUmV6hUH/rzbPkjPE+XCCGD5emOfCI=;
	b=AxiALfY6gO37fIC973yPo3CFx4BINP8QKhs9npins+1H9s5F/w9zzP321Nh3gPiUdxzbJG
	qwqR3DrL4lXlULUncNSPaQn7MnEDdtX4D45k+WJ3PaeK0+LZb59z5F2U4Nmm5eSiIbWEpq
	yytqZsqhH2ybB5t24Q7LlQ4tRqAfnNZR1avqZiSqTh56Qc5b6ACkp+6mLG0vSzoAWOIigl
	VGGyvtxAnt+RkT20ogK2l4xvqUTFzIlpAaseG4XF7N4ZIJPYmZlBURUGbAqmNpjE8BR3bj
	y62zLt9K3tLDGhW9W1mY57T5hs5zpr0KbWCQF3Wfxdpov4C+yzNML00fhk7VOw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv6p712QFzffH;
	Tue,  4 Jun 2024 23:52:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454NqFQt061331;
	Tue, 4 Jun 2024 23:52:15 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454NqFVj061328;
	Tue, 4 Jun 2024 23:52:15 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 23:52:15 GMT
Message-Id: <202406042352.454NqFVj061328@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: 871b33ad65ba - main - pci: Consistently use pci_vf_*
  for suballocated VF memory resources
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 871b33ad65baf07c92cce120a4fc1978c2ed7b3b
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=871b33ad65baf07c92cce120a4fc1978c2ed7b3b

commit 871b33ad65baf07c92cce120a4fc1978c2ed7b3b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-04 23:51:37 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-04 23:51:37 +0000

    pci: Consistently use pci_vf_* for suballocated VF memory resources
    
    Some of the bus resource methods were passing these up to the parent
    which triggered rman mismatch assertions in INVARIANTS kernels.
    
    Reported by:    kp
    Reviewed by:    imp
    Tested by:      kp (earlier version)
    Differential Revision:  https://reviews.freebsd.org/D45406
---
 sys/dev/pci/pci.c         | 118 ++++++++++++++++++++++++++++++++++--
 sys/dev/pci/pci_iov.c     | 151 ++++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/pci/pci_private.h |  19 ++++++
 3 files changed, 284 insertions(+), 4 deletions(-)

diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 2cb8b4ce9fcc..2093d6a8b5ef 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -164,10 +164,18 @@ static device_method_t pci_methods[] = {
 	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
 	DEVMETHOD(bus_delete_resource,	pci_delete_resource),
 	DEVMETHOD(bus_alloc_resource,	pci_alloc_resource),
+#ifdef PCI_IOV
+	DEVMETHOD(bus_adjust_resource,	pci_adjust_resource),
+#else
 	DEVMETHOD(bus_adjust_resource,	bus_generic_adjust_resource),
+#endif
 	DEVMETHOD(bus_release_resource,	pci_release_resource),
 	DEVMETHOD(bus_activate_resource, pci_activate_resource),
 	DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
+#ifdef PCI_IOV
+	DEVMETHOD(bus_map_resource,	pci_map_resource),
+	DEVMETHOD(bus_unmap_resource,	pci_unmap_resource),
+#endif
 	DEVMETHOD(bus_child_deleted,	pci_child_deleted),
 	DEVMETHOD(bus_child_detached,	pci_child_detached),
 	DEVMETHOD(bus_child_pnpinfo,	pci_child_pnpinfo_method),
@@ -5687,14 +5695,30 @@ pci_activate_resource(device_t dev, device_t child, struct resource *r)
 	struct pci_devinfo *dinfo;
 	int error, rid, type;
 
-	error = bus_generic_activate_resource(dev, child, r);
+	dinfo = device_get_ivars(child);
+#ifdef PCI_IOV
+	if (dinfo->cfg.flags & PCICFG_VF) {
+		switch (rman_get_type(r)) {
+		/* VFs can't have I/O BARs. */
+		case SYS_RES_IOPORT:
+			error = EINVAL;
+			break;
+		case SYS_RES_MEMORY:
+			error = pci_vf_activate_mem_resource(dev, child, r);
+			break;
+		default:
+			error = bus_generic_activate_resource(dev, child, r);
+			break;
+		}
+	} else
+#endif
+		error = bus_generic_activate_resource(dev, child, r);
 	if (error)
 		return (error);
 
 	/* Enable decoding in the command register when activating BARs. */
 	if (device_get_parent(child) == dev) {
 		/* Device ROMs need their decoding explicitly enabled. */
-		dinfo = device_get_ivars(child);
 		rid = rman_get_rid(r);
 		type = rman_get_type(r);
 		if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
@@ -5716,13 +5740,29 @@ pci_deactivate_resource(device_t dev, device_t child, struct resource *r)
 	struct pci_devinfo *dinfo;
 	int error, rid, type;
 
-	error = bus_generic_deactivate_resource(dev, child, r);
+	dinfo = device_get_ivars(child);
+#ifdef PCI_IOV
+	if (dinfo->cfg.flags & PCICFG_VF) {
+		switch (rman_get_type(r)) {
+		/* VFs can't have I/O BARs. */
+		case SYS_RES_IOPORT:
+			error = EINVAL;
+			break;
+		case SYS_RES_MEMORY:
+			error = pci_vf_deactivate_mem_resource(dev, child, r);
+			break;
+		default:
+			error = bus_generic_deactivate_resource(dev, child, r);
+			break;
+		}
+	} else
+#endif
+		error = bus_generic_deactivate_resource(dev, child, r);
 	if (error)
 		return (error);
 
 	/* Disable decoding for device ROMs. */
 	if (device_get_parent(child) == dev) {
-		dinfo = device_get_ivars(child);
 		rid = rman_get_rid(r);
 		type = rman_get_type(r);
 		if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
@@ -5732,6 +5772,76 @@ pci_deactivate_resource(device_t dev, device_t child, struct resource *r)
 	return (0);
 }
 
+#ifdef PCI_IOV
+int
+pci_adjust_resource(device_t dev, device_t child, struct resource *r,
+    rman_res_t start, rman_res_t end)
+{
+	struct pci_devinfo *dinfo;
+
+	dinfo = device_get_ivars(child);
+	if (dinfo->cfg.flags & PCICFG_VF) {
+		switch (rman_get_type(r)) {
+		/* VFs can't have I/O BARs. */
+		case SYS_RES_IOPORT:
+			return (EINVAL);
+		case SYS_RES_MEMORY:
+			return (pci_vf_adjust_mem_resource(dev, child, r,
+			    start, end));
+		}
+
+		/* Fall through for other types of resource allocations. */
+	}
+
+	return (bus_generic_adjust_resource(dev, child, r, start, end));
+}
+
+int
+pci_map_resource(device_t dev, device_t child, struct resource *r,
+    struct resource_map_request *argsp, struct resource_map *map)
+{
+	struct pci_devinfo *dinfo;
+
+	dinfo = device_get_ivars(child);
+	if (dinfo->cfg.flags & PCICFG_VF) {
+		switch (rman_get_type(r)) {
+		/* VFs can't have I/O BARs. */
+		case SYS_RES_IOPORT:
+			return (EINVAL);
+		case SYS_RES_MEMORY:
+			return (pci_vf_map_mem_resource(dev, child, r, argsp,
+			    map));
+		}
+
+		/* Fall through for other types of resource allocations. */
+	}
+
+	return (bus_generic_map_resource(dev, child, r, argsp, map));
+}
+
+int
+pci_unmap_resource(device_t dev, device_t child, struct resource *r,
+    struct resource_map *map)
+{
+	struct pci_devinfo *dinfo;
+
+	dinfo = device_get_ivars(child);
+	if (dinfo->cfg.flags & PCICFG_VF) {
+		switch (rman_get_type(r)) {
+		/* VFs can't have I/O BARs. */
+		case SYS_RES_IOPORT:
+			return (EINVAL);
+		case SYS_RES_MEMORY:
+			return (pci_vf_unmap_mem_resource(dev, child, r, map));
+		}
+
+		/* Fall through for other types of resource allocations. */
+	}
+
+	return (bus_generic_unmap_resource(dev, child, r, map));
+}
+#endif
+
 void
 pci_child_deleted(device_t dev, device_t child)
 {
diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c
index c8e139f043c9..1f1138b2d336 100644
--- a/sys/dev/pci/pci_iov.c
+++ b/sys/dev/pci/pci_iov.c
@@ -1070,6 +1070,12 @@ pci_vf_release_mem_resource(device_t dev, device_t child, struct resource *r)
 
 	dinfo = device_get_ivars(child);
 
+	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
+	    ("%s: invalid resource %p", __func__, r));
+	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
+	    ("%s: rman %p doesn't match for resource %p", __func__,
+	    &dinfo->cfg.iov->rman, r));
+
 	if (rman_get_flags(r) & RF_ACTIVE) {
 		error = bus_deactivate_resource(child, r);
 		if (error != 0)
@@ -1086,3 +1092,148 @@ pci_vf_release_mem_resource(device_t dev, device_t child, struct resource *r)
 
 	return (rman_release_resource(r));
 }
+
+int
+pci_vf_activate_mem_resource(device_t dev, device_t child, struct resource *r)
+{
+#ifdef INVARIANTS
+	struct pci_devinfo *dinfo = device_get_ivars(child);
+#endif
+	struct resource_map map;
+	int error;
+
+	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
+	    ("%s: invalid resource %p", __func__, r));
+	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
+	    ("%s: rman %p doesn't match for resource %p", __func__,
+	    &dinfo->cfg.iov->rman, r));
+
+	error = rman_activate_resource(r);
+	if (error != 0)
+		return (error);
+
+	if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
+		error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map);
+		if (error != 0) {
+			rman_deactivate_resource(r);
+			return (error);
+		}
+
+		rman_set_mapping(r, &map);
+	}
+	return (0);
+}
+
+int
+pci_vf_deactivate_mem_resource(device_t dev, device_t child, struct resource *r)
+{
+#ifdef INVARIANTS
+	struct pci_devinfo *dinfo = device_get_ivars(child);
+#endif
+	struct resource_map map;
+	int error;
+
+	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
+	    ("%s: invalid resource %p", __func__, r));
+	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
+	    ("%s: rman %p doesn't match for resource %p", __func__,
+	    &dinfo->cfg.iov->rman, r));
+
+	error = rman_deactivate_resource(r);
+	if (error != 0)
+		return (error);
+
+	if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
+		rman_get_mapping(r, &map);
+		BUS_UNMAP_RESOURCE(dev, child, r, &map);
+	}
+	return (0);
+}
+
+int
+pci_vf_adjust_mem_resource(device_t dev, device_t child, struct resource *r,
+    rman_res_t start, rman_res_t end)
+{
+#ifdef INVARIANTS
+	struct pci_devinfo *dinfo = device_get_ivars(child);
+#endif
+
+	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
+	    ("%s: invalid resource %p", __func__, r));
+	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
+	    ("%s: rman %p doesn't match for resource %p", __func__,
+	    &dinfo->cfg.iov->rman, r));
+
+	return (rman_adjust_resource(r, start, end));
+}
+
+static struct resource *
+pci_vf_find_parent_resource(struct pcicfg_iov *iov, struct resource *r)
+{
+	struct resource *pres;
+
+	for (u_int i = 0; i <= PCIR_MAX_BAR_0; i++) {
+		pres = iov->iov_bar[i].res;
+		if (pres != NULL) {
+			if (rman_get_start(pres) <= rman_get_start(r) &&
+			    rman_get_end(pres) >= rman_get_end(r))
+				return (pres);
+		}
+	}
+	return (NULL);
+}
+
+int
+pci_vf_map_mem_resource(device_t dev, device_t child, struct resource *r,
+    struct resource_map_request *argsp, struct resource_map *map)
+{
+	struct pci_devinfo *dinfo = device_get_ivars(child);
+	struct pcicfg_iov *iov = dinfo->cfg.iov;
+	struct resource_map_request args;
+	struct resource *pres;
+	rman_res_t length, start;
+	int error;
+
+	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
+	    ("%s: invalid resource %p", __func__, r));
+	KASSERT(rman_is_region_manager(r, &iov->rman),
+	    ("%s: rman %p doesn't match for resource %p", __func__,
+	    &dinfo->cfg.iov->rman, r));
+
+	/* Resources must be active to be mapped. */
+	if (!(rman_get_flags(r) & RF_ACTIVE))
+		return (ENXIO);
+
+	resource_init_map_request(&args);
+	error = resource_validate_map_request(r, argsp, &args, &start, &length);
+	if (error)
+		return (error);
+
+	pres = pci_vf_find_parent_resource(dinfo->cfg.iov, r);
+	if (pres == NULL)
+		return (ENOENT);
+
+	args.offset = start - rman_get_start(pres);
+	args.length = length;
+	return (bus_map_resource(iov->iov_pf, pres, &args, map));
+}
+
+int
+pci_vf_unmap_mem_resource(device_t dev, device_t child, struct resource *r,
+    struct resource_map *map)
+{
+	struct pci_devinfo *dinfo = device_get_ivars(child);
+	struct pcicfg_iov *iov = dinfo->cfg.iov;
+	struct resource *pres;
+
+	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
+	    ("%s: invalid resource %p", __func__, r));
+	KASSERT(rman_is_region_manager(r, &iov->rman),
+	    ("%s: rman %p doesn't match for resource %p", __func__,
+	    &dinfo->cfg.iov->rman, r));
+
+	pres = pci_vf_find_parent_resource(iov, r);
+	if (pres == NULL)
+		return (ENOENT);
+	return (bus_unmap_resource(iov->iov_pf, pres, map));
+}
diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h
index f97a4df5471b..6dc7e3c505d1 100644
--- a/sys/dev/pci/pci_private.h
+++ b/sys/dev/pci/pci_private.h
@@ -65,9 +65,16 @@ bus_get_dma_tag_t	pci_get_dma_tag;
 bus_get_resource_list_t	pci_get_resource_list;
 bus_delete_resource_t	pci_delete_resource;
 bus_alloc_resource_t	pci_alloc_resource;
+#ifdef PCI_IOV
+bus_adjust_resource_t	pci_adjust_resource;
+#endif
 bus_release_resource_t	pci_release_resource;
 bus_activate_resource_t	pci_activate_resource;
 bus_deactivate_resource_t pci_deactivate_resource;
+#ifdef PCI_IOV
+bus_map_resource_t	pci_map_resource;
+bus_unmap_resource_t	pci_unmap_resource;
+#endif
 bus_child_deleted_t	pci_child_deleted;
 bus_child_detached_t	pci_child_detached;
 bus_child_pnpinfo_t	pci_child_pnpinfo_method;
@@ -158,4 +165,16 @@ struct resource *pci_vf_alloc_mem_resource(device_t dev, device_t child,
 		    rman_res_t count, u_int flags);
 int		pci_vf_release_mem_resource(device_t dev, device_t child,
 		    struct resource *r);
+int		pci_vf_activate_mem_resource(device_t dev, device_t child,
+		    struct resource *r);
+int		pci_vf_deactivate_mem_resource(device_t dev, device_t child,
+		    struct resource *r);
+int		pci_vf_adjust_mem_resource(device_t dev, device_t child,
+		    struct resource *r, rman_res_t start, rman_res_t end);
+int		pci_vf_map_mem_resource(device_t dev, device_t child,
+		    struct resource *r, struct resource_map_request *argsp,
+		    struct resource_map *map);
+int		pci_vf_unmap_mem_resource(device_t dev, device_t child,
+		    struct resource *r, struct resource_map *map);
+
 #endif /* _PCI_PRIVATE_H_ */

From nobody Tue Jun  4 23:52:13 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv6p650RBz5N0D7;
	Tue, 04 Jun 2024 23:52:14 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv6p60sMhz4KNc;
	Tue,  4 Jun 2024 23:52:14 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717545134;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Nx1tPeYI7IIsXUeCrc0XjYjT+sOqVtY68S9wHpL4PGM=;
	b=GN2qtHyzEvRa/n2rxyd0hBxo/AKvpi+suS/jQ9c5tLCnqfYks9moYBiY/iMpV7JKbV3MeX
	W2+nRjbxZfoxLSWXOCYqTIu2BQhfnI2vFonfRXOI12VkOw38SdkQ5FI7X6EuFoDdp1JOw3
	GLidipx79I8GC5Se5MaBJEC+AdJ3AiqCowgf81gMgg/gsWOAMqdEMXbGLE//rPtJNxZnAu
	XPhDK5K9YSL46vYsKgQx260MvejhMe9FYONkTR5EY8jW7SXdatPP3I5XquBhTq5BZvmpxR
	ryYNL0W39JzQhlWywivConqIW5ek28sPxZ9CKcyMpUOFlkepXJqbhlAV69EK/g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717545134; a=rsa-sha256; cv=none;
	b=gW/qCDFZ8258mcnD+4MwhjHi19GZ4vMnSYGkgCd3snbnUhHF4s2iel6L3LlJqSX9K39OYZ
	w7HqUP+8/LtZ5jMsYsWwgZ0yphg792fWlGiS2W2tKFes5R5wxG5uEiZZS4ZJthKrMuT+vH
	gBr0klM2ICd/wAnu+1yIMC6seQ0apIY9H7otSqhahZLc2McA2wYfKmyCtGevet1VLwPiyt
	KRMdsUddoInGW+4AFcLJbaNuYbbun16ZtcFvfSA5MECPDN9CLmHpZYPng7VRbZ041BRfaV
	jgHM4WKVpaHgRpy0g82uoa7YDczyp+TOxPS1UtOpbBQmFjprHhaDTd7OlaQzww==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717545134;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Nx1tPeYI7IIsXUeCrc0XjYjT+sOqVtY68S9wHpL4PGM=;
	b=xSysNpDfsl24yC9Bh9okOqtb+OcRok/qL9Rzl9BxJ930i28KGhhSE5qsy9Jimq4iYNhd0D
	07l4My3MZ3v+k56Qew+zVGTFr38aaCY5yZJcECPd09haJnJ4kpZZ4ggwAFwwfE2f6FYqz0
	pySv1Sw47mXkjUnR95U6oh79VIrBx7RqaNfEXEQm4y63cPFDkOabVz3p9kOtzfTE4I4/Sf
	CX3pDOVXexRI/aKQwWmMQzEweJ9RHzlUn/9xLbYIO10cITgSNk4zn+1VkEydAj/KCA/BBR
	+Q2jw6cT91UHtmiBOwTODNPobAu/4lp65vZSYU/AkuqpBgUSgi2egK/yCo5EdQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv6p607nqzfqS;
	Tue,  4 Jun 2024 23:52:14 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 454NqDln061277;
	Tue, 4 Jun 2024 23:52:13 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 454NqDjx061274;
	Tue, 4 Jun 2024 23:52:13 GMT
	(envelope-from git)
Date: Tue, 4 Jun 2024 23:52:13 GMT
Message-Id: <202406042352.454NqDjx061274@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: 98056127ddfa - main - acpi/pci/vmd: Fix a nit with
  nested resource mapping requests
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 98056127ddfa36720bcf46edc09843c867784bcb
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=98056127ddfa36720bcf46edc09843c867784bcb

commit 98056127ddfa36720bcf46edc09843c867784bcb
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-04 23:50:56 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-04 23:51:14 +0000

    acpi/pci/vmd: Fix a nit with nested resource mapping requests
    
    Some bus drivers use rmans to suballocate resources to child devices.
    When the driver for a child device requests a mapping for a
    suballocated resource, the bus driver translates this into a mapping
    request for a suitable subrange of the original resource the bus
    driver allocated from its parent.  This nested mapping request should
    look like any other resource mapping request being made by the bus
    device (i.e. as if the bus device had called bus_map_resource() or
    bus_alloc_resource() with RF_ACTIVE).
    
    I had slightly flubbed this last bit though since the direct use of
    bus_generic_map/unmap_resource passed up the original child device
    (second argument to the underlying kobj interface).  While this is
    currently harmless, it is not strictly correct as the resource being
    mapped is owned by the bus device, not the child and can break for
    other bus drivers in the future.
    
    Instead, use bus_map/unmap_resource for the nested request where the
    requesting device is now the bus device that owns the parent resource.
    
    Reviewed by:    imp
    Fixes:          0e1246e33461 acpi: Cleanup handling of suballocated resources
    Fixes:          b377ff8110e3 pcib: Refine handling of resources allocated from bridge windows
    Fixes:          d79b6b8ec267 pci_host_generic: Don't rewrite resource start address for translation
    Fixes:          d714e73f7895 vmd: Use bus_generic_rman_* for PCI bus and memory resources
    Differential Revision:  https://reviews.freebsd.org/D45433
---
 sys/dev/acpica/acpi.c          | 17 ++++++++++-------
 sys/dev/pci/pci_host_generic.c | 16 ++++++++--------
 sys/dev/pci/pci_pci.c          | 16 +++++++++-------
 sys/dev/vmd/vmd.c              |  9 +++++----
 4 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index ad1af9373fb7..24d7027f165d 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1651,19 +1651,22 @@ acpi_map_resource(device_t bus, device_t child, struct resource *r,
 
 	args.offset = start - rman_get_start(sysres);
 	args.length = length;
-	return (bus_generic_map_resource(bus, child, sysres, &args, map));
+	return (bus_map_resource(bus, sysres, &args, map));
 }
 
 static int
 acpi_unmap_resource(device_t bus, device_t child, struct resource *r,
     struct resource_map *map)
 {
-	if (acpi_is_resource_managed(bus, r)) {
-		r = acpi_managed_resource(bus, r);
-		if (r == NULL)
-			return (ENOENT);
-	}
-	return (bus_generic_unmap_resource(bus, child, r, map));
+	struct resource *sysres;
+
+	if (!acpi_is_resource_managed(bus, r))
+		return (bus_generic_unmap_resource(bus, child, r, map));
+
+	sysres = acpi_managed_resource(bus, r);
+	if (sysres == NULL)
+		return (ENOENT);
+	return (bus_unmap_resource(bus, sysres, map));
 }
 
 /* Allocate an IO port or memory resource, given its GAS. */
diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index 82ed51460621..d97a7597df25 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -646,7 +646,7 @@ generic_pcie_map_resource(device_t dev, device_t child, struct resource *r,
 
 	args.offset = start - range->pci_base;
 	args.length = length;
-	return (bus_generic_map_resource(dev, child, range->res, &args, map));
+	return (bus_map_resource(dev, range->res, &args, map));
 }
 
 static int
@@ -664,16 +664,16 @@ generic_pcie_unmap_resource(device_t dev, device_t child, struct resource *r,
 #endif
 	case SYS_RES_IOPORT:
 	case SYS_RES_MEMORY:
-		range = generic_pcie_containing_range(dev, type,
-		    rman_get_start(r), rman_get_end(r));
-		if (range == NULL || range->res == NULL)
-			return (ENOENT);
-		r = range->res;
 		break;
 	default:
-		break;
+		return (bus_generic_unmap_resource(dev, child, r, argsp, map));
 	}
-	return (bus_generic_unmap_resource(dev, child, r, map));
+
+	range = generic_pcie_containing_range(dev, type, rman_get_start(r),
+	    rman_get_end(r));
+	if (range == NULL || range->res == NULL)
+		return (ENOENT);
+	return (bus_unmap_resource(dev, range->res, map));
 }
 
 static bus_dma_tag_t
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
index 35062d67050e..40b22c9802c4 100644
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -2549,7 +2549,7 @@ pcib_map_resource(device_t dev, device_t child, struct resource *r,
 
 	args.offset = start - rman_get_start(pres);
 	args.length = length;
-	return (bus_generic_map_resource(dev, child, pres, &args, map));
+	return (bus_map_resource(dev, pres, &args, map));
 }
 
 static int
@@ -2558,14 +2558,16 @@ pcib_unmap_resource(device_t dev, device_t child, struct resource *r,
 {
 	struct pcib_softc *sc = device_get_softc(dev);
 	struct pcib_window *w;
+	struct resource *pres;
 
 	w = pcib_get_resource_window(sc, r);
-	if (w != NULL) {
-		r = pcib_find_parent_resource(w, r);
-		if (r == NULL)
-			return (ENOENT);
-	}
-	return (bus_generic_unmap_resource(dev, child, r, map));
+	if (w == NULL)
+		return (bus_generic_unmap_resource(dev, child, r, map));
+
+	pres = pcib_find_parent_resource(w, r);
+	if (pres == NULL)
+		return (ENOENT);
+	return (bus_unmap_resource(dev, pres, map));
 }
 #else
 /*
diff --git a/sys/dev/vmd/vmd.c b/sys/dev/vmd/vmd.c
index b52787fc45d3..d15a545d8d47 100644
--- a/sys/dev/vmd/vmd.c
+++ b/sys/dev/vmd/vmd.c
@@ -543,7 +543,7 @@ vmd_map_resource(device_t dev, device_t child, struct resource *r,
 
 	args.offset = start - rman_get_start(pres);
 	args.length = length;
-	return (bus_generic_map_resource(dev, child, pres, &args, map));
+	return (bus_map_resource(dev, pres, &args, map));
 }
 
 static int
@@ -551,11 +551,12 @@ vmd_unmap_resource(device_t dev, device_t child, struct resource *r,
     struct resource_map *map)
 {
 	struct vmd_softc *sc = device_get_softc(dev);
+	struct resource *pres;
 
-	r = vmd_find_parent_resource(sc, r);
-	if (r == NULL)
+	pres = vmd_find_parent_resource(sc, r);
+	if (pres == NULL)
 		return (ENOENT);
-	return (bus_generic_unmap_resource(dev, child, r, map));
+	return (bus_unmap_resource(dev, pres, map));
 }
 
 static int

From nobody Wed Jun  5 00:00:24 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv6zn6hxvz5N1Pt
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Wed, 05 Jun 2024 00:00:37 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv6zn4pYBz4KyY
	for <dev-commits-src-main@freebsd.org>; Wed,  5 Jun 2024 00:00:37 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-35dc0472b7eso5440906f8f.2
        for <dev-commits-src-main@freebsd.org>; Tue, 04 Jun 2024 17:00:37 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717545636; x=1718150436;
        h=to:references:message-id:content-transfer-encoding:cc:date
         :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=msowybomCip97HXh1HQAj4N0q1rr/2IVDSoqc8I8yvs=;
        b=rBxl4jmX6Q/YKMgXs6GHxoDhDUK/f3HvIWbmtw8Z5kf1sVKDyxHunZSZpn1vxqqGKG
         pew00EJa0tvbrvMSO3h274z2kJKrax0L9caVC7pKsv3WioIq6wE9t0zW4ETehJ/AjBEB
         qONsFboOr6o4XnTx7T5pAEe6nY0Ls2g3x3w/VL0Kr6Bz3uvfgfP4JLn4St3v0g42DU2L
         MRmAWNK81NFrc+Bv88TSTFlQKH9VmJBm9rsAnkS06c1F/7Eo1vwM5nZP8etqig/Z3w2Y
         cjKpOxaE7d8+sXNNjes6h8F11YjPUJMLvxQc6sO6IMUaNkhsR/Kp+N1i5fXeV9lZkMZt
         CTQA==
X-Forwarded-Encrypted: i=1; AJvYcCX4ZmLNtW+LrKJy4vlzANXs5BMa/9cboqIy1hOE67oZ2UgxWEriYAVMmsIjyGIS9BUnJ0fcBqr9JZy9tjpytBu70NgQyF3NPZngB/Ag28kH5g==
X-Gm-Message-State: AOJu0Yx8Tx534Q0OhYsmJDRHdyuK1t6ONwgdd+gTYprEviho5K8YyaGe
	hREQXEaMPM/y5Sp4qg5neYTCgKRQSbIfRTKQXrkeIKtcIZyvjMFhyhmI76QJBjc=
X-Google-Smtp-Source: AGHT+IG1uR/5iuTvleKCiKhVUJ0QLxGlCu00hiu0CsLKE7LHtPueuzbJ3mUd+JZCzRzG19YRb+jtEQ==
X-Received: by 2002:adf:e602:0:b0:357:1931:f1e with SMTP id ffacd0b85a97d-35e8ef857d4mr637151f8f.65.1717545635601;
        Tue, 04 Jun 2024 17:00:35 -0700 (PDT)
Received: from smtpclient.apple ([131.111.5.201])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd04ca48dsm12847679f8f.29.2024.06.04.17.00.35
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 04 Jun 2024 17:00:35 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
Subject: Re: git: 871b33ad65ba - main - pci: Consistently use pci_vf_* for
 suballocated VF memory resources
From: Jessica Clarke <jrtc27@freebsd.org>
In-Reply-To: <202406042352.454NqFVj061328@gitrepo.freebsd.org>
Date: Wed, 5 Jun 2024 01:00:24 +0100
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <587A0604-BF30-4A90-9B04-FC56C53BBF2A@freebsd.org>
References: <202406042352.454NqFVj061328@gitrepo.freebsd.org>
To: John Baldwin <jhb@FreeBSD.org>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]
X-Rspamd-Queue-Id: 4Vv6zn4pYBz4KyY

On 5 Jun 2024, at 00:52, John Baldwin <jhb@FreeBSD.org> wrote:
>=20
> The branch main has been updated by jhb:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D871b33ad65baf07c92cce120a4fc1978=
c2ed7b3b
>=20
> commit 871b33ad65baf07c92cce120a4fc1978c2ed7b3b
> Author:     John Baldwin <jhb@FreeBSD.org>
> AuthorDate: 2024-06-04 23:51:37 +0000
> Commit:     John Baldwin <jhb@FreeBSD.org>
> CommitDate: 2024-06-04 23:51:37 +0000
>=20
>    pci: Consistently use pci_vf_* for suballocated VF memory resources
>=20
>    Some of the bus resource methods were passing these up to the =
parent
>    which triggered rman mismatch assertions in INVARIANTS kernels.
>=20
>    Reported by:    kp
>    Reviewed by:    imp
>    Tested by:      kp (earlier version)
>    Differential Revision:  https://reviews.freebsd.org/D45406
> ---
> sys/dev/pci/pci.c         | 118 ++++++++++++++++++++++++++++++++++--
> sys/dev/pci/pci_iov.c     | 151 =
++++++++++++++++++++++++++++++++++++++++++++++
> sys/dev/pci/pci_private.h |  19 ++++++
> 3 files changed, 284 insertions(+), 4 deletions(-)
>=20
> diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
> index 2cb8b4ce9fcc..2093d6a8b5ef 100644
> --- a/sys/dev/pci/pci.c
> +++ b/sys/dev/pci/pci.c
> @@ -164,10 +164,18 @@ static device_method_t pci_methods[] =3D {
> DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
> DEVMETHOD(bus_delete_resource, pci_delete_resource),
> DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
> +#ifdef PCI_IOV
> + DEVMETHOD(bus_adjust_resource, pci_adjust_resource),
> +#else
> DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
> +#endif
> DEVMETHOD(bus_release_resource, pci_release_resource),
> DEVMETHOD(bus_activate_resource, pci_activate_resource),
> DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
> +#ifdef PCI_IOV
> + DEVMETHOD(bus_map_resource, pci_map_resource),
> + DEVMETHOD(bus_unmap_resource, pci_unmap_resource),
> +#endif
> DEVMETHOD(bus_child_deleted, pci_child_deleted),
> DEVMETHOD(bus_child_detached, pci_child_detached),
> DEVMETHOD(bus_child_pnpinfo, pci_child_pnpinfo_method),

Would it make sense to instead #ifdef parts of the body of
pci_adjust_resource rather than switching which function you=E2=80=99re =
using
in the first place? I feel that is generally easier to understand, as
there=E2=80=99s less conditionality, and it=E2=80=99s more easily =
extensible if any
other special cases come along.

Jess


From nobody Wed Jun  5 01:48:53 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv9Nj6JQjz5NGkF;
	Wed, 05 Jun 2024 01:48:53 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv9Nj5jXGz4XvS;
	Wed,  5 Jun 2024 01:48:53 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717552133;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ygjKEz5anYAp3EAgXF/w3m4j+qy3/uw6lXkQ+zmqCD0=;
	b=nNJRndfp0Urpzk7f8JxQ4uS61wC4OXXff8EN7Utv0IhIKHTePAumlhZpN4Wu1EasnTtGWf
	pgsv6T9xsqN0yoaLep/6xdxc3oCdu6tFXVfSu3ZLuKGZ8qyZch0HEsMehW7X+TsaG/3t3/
	nng34VzluT+yp0N0wxi+0+2u3AgZNISv9CQ531WypRsBX6rCz9tTvUHA5piHc5k/l5Gf6j
	6ITMzOECb8s2sayqgHsSzVj0z0BTek5h8so2M2lFzVFjuyYz4K7sHJFos18KtaZ9U4hLRj
	00JyPdkPlKQEVq38yNZG5xjh8aYWGlLPo5Ly1aisJPejZN1gFeJnRu4ZIIjgnQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717552133; a=rsa-sha256; cv=none;
	b=U5t25xYngeYxX5q09ptDUIynrme+dCSNY5QWjME8neGT+GlTXZM9vq37y2Wm2Ehuancy/H
	YhX/AT2FrzwotaNwGqp+NM6x9vYujemoshL4C22qR4NiXfYsUQJrf2mqP2DNOujkQW/24Q
	22l5CZHqoZlfD8J4SdnU5TN+IY2zIC4HqmSDjCotD5PTJB/yc18ePzlYteSiBIxDwi5PBS
	1DAVUWaf7Gt6BnjPa5HzKwM6HwWWbXKq5LnamYWue/UyvngkmttU3K+bb5lYCqiGk7+OI2
	tQjOO0zsmgiPJ7FKoYYB64x1c9i3XmJ88oPLopmIn8GgrKj0IRb6Jco9Jonbkg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717552133;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ygjKEz5anYAp3EAgXF/w3m4j+qy3/uw6lXkQ+zmqCD0=;
	b=W4SVkJywn0vpE3fhdbvD8erpQBtxg2RNk9ZDLxxMO8XptZOVb9y8WdvQHm46liz5LFK2e/
	K/H31rPkYUav6CZvCXFXPPJR2hKYR4dsJArcMIyd5SpHvRRyzjIYc9/dYb0yY2PhmqugjJ
	5ejOlRfOZm68RU1YGejuVjL096ufZYiHy8yKu6lRJbl81QdC3z2C8JgOBLeu7+ffHYA2fi
	egqqSW+TuCGaKIw674inq7QNWOQGo9+u9e4qA1EWDz28A7EWAYDBR0aw4Yq604fZhx5j4D
	uROZdIpOSHgzgvqCOug8qNTEsjQYz0IDGD8g0TbUriLUYxS1LnkxJUJZkhEGhQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv9Nj5FbkzjGv;
	Wed,  5 Jun 2024 01:48:53 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4551mrIu048350;
	Wed, 5 Jun 2024 01:48:53 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4551mrBV048347;
	Wed, 5 Jun 2024 01:48:53 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 01:48:53 GMT
Message-Id: <202406050148.4551mrBV048347@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Rick Macklem <rmacklem@FreeBSD.org>
Subject: git: e2c9fad2e0ae - main - nfsd: Fix delegation handled
  for atomic upgrade
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rmacklem
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: e2c9fad2e0ae3f7049831bf7f2be1a3573363cdc
Auto-Submitted: auto-generated

The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=e2c9fad2e0ae3f7049831bf7f2be1a3573363cdc

commit e2c9fad2e0ae3f7049831bf7f2be1a3573363cdc
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2024-06-05 01:46:41 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2024-06-05 01:46:41 +0000

    nfsd: Fix delegation handled for atomic upgrade
    
    For NFSv4.1/4.2, an atomic upgrade of a delegation from a
    read delegation to a write delegation is allowed and can
    result in signoficantly improved performance.
    
    This patch adds support for this atomic upgrade, plus fixes
    a couple of other delegation related bugs.  Since there were
    three cases where delegations were being issued, the patch
    factors this out into a separate function called
    nfsrv_issuedelegations().
    
    This patch should only affect the NFSv4.1/4.2 behaviour
    when delegations are enabled, which is not the default.
    
    MFC after:      1 month
---
 sys/fs/nfsserver/nfs_nfsdserv.c  |   7 +
 sys/fs/nfsserver/nfs_nfsdstate.c | 297 ++++++++++++++++++---------------------
 2 files changed, 141 insertions(+), 163 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index 0c8bda6dc6a6..47e3a20390f4 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -3244,6 +3244,13 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram,
 				NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 				*tl++ = txdr_unsigned(NFSV4OPEN_RESOURCE);
 				*tl = newnfs_false;
+			} else if ((rflags &
+			    NFSV4OPEN_WDNOTSUPPDOWNGRADE) != 0) {
+				NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
+				*tl = txdr_unsigned(NFSV4OPEN_NOTSUPPDOWNGRADE);
+			} else if ((rflags & NFSV4OPEN_WDNOTSUPPUPGRADE) != 0) {
+				NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
+				*tl = txdr_unsigned(NFSV4OPEN_NOTSUPPUPGRADE);
 			} else {
 				NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
 				*tl = txdr_unsigned(NFSV4OPEN_NOTWANTED);
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index c73840277022..ce3f3481f04a 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -240,6 +240,11 @@ static int nfsrv_createdsfile(vnode_t vp, fhandle_t *fhp, struct pnfsdsfile *pf,
 static struct nfsdevice *nfsrv_findmirroredds(struct nfsmount *nmp);
 static int nfsrv_checkmachcred(int op, struct nfsrv_descript *nd,
     struct nfsclient *clp);
+static void nfsrv_issuedelegation(struct vnode *vp, struct nfsclient *clp,
+    struct nfsrv_descript *nd, int delegate, int writedeleg, int readonly,
+    u_quad_t filerev, uint64_t rdonly, struct nfsstate **new_delegp,
+    struct nfsstate *new_stp, struct nfslockfile *lfp, uint32_t *rflagsp,
+    nfsv4stateid_t *delegstateidp);
 
 /*
  * Scan the client list for a match and either return the current one,
@@ -442,7 +447,8 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
 		/*
 		 * If the verifier has changed, the client has rebooted
 		 * and a new client id is issued. The old state info
-		 * can be thrown away once the SETCLIENTID_CONFIRM occurs.
+		 * can be thrown away once the SetClientID_Confirm or
+		 * Create_Session that confirms the clientid occurs.
 		 */
 		LIST_REMOVE(clp, lc_hash);
 
@@ -2648,6 +2654,8 @@ tryagain:
 	 *    considered a conflict since the client with a read delegation
 	 *    could have done an Open with ReadAccess and WriteDeny
 	 *    locally and then not have checked for the WriteDeny.)
+	 *    The exception is a NFSv4.1/4.2 client that has requested
+	 *    an atomic upgrade to a write delegation.
 	 * Don't check for a Reclaim, since that will be dealt with
 	 * by nfsrv_openctrl().
 	 */
@@ -2657,9 +2665,10 @@ tryagain:
 	    while (stp != LIST_END(&lfp->lf_deleg)) {
 		nstp = LIST_NEXT(stp, ls_file);
 		if ((readonly && stp->ls_clp != clp &&
-		       (stp->ls_flags & NFSLCK_DELEGWRITE)) ||
+		     (stp->ls_flags & NFSLCK_DELEGWRITE) != 0) ||
 		    (!readonly && (stp->ls_clp != clp ||
-		         (stp->ls_flags & NFSLCK_DELEGREAD)))) {
+		     ((stp->ls_flags & NFSLCK_DELEGREAD) != 0 &&
+		      (new_stp->ls_flags & NFSLCK_WANTWDELEG) == 0)))) {
 			ret = nfsrv_delegconflict(stp, &haslock, p, vp);
 			if (ret) {
 			    /*
@@ -2944,6 +2953,8 @@ tryagain:
 	 *    considered a conflict since the client with a read delegation
 	 *    could have done an Open with ReadAccess and WriteDeny
 	 *    locally and then not have checked for the WriteDeny.)
+	 *    The exception is a NFSv4.1/4.2 client that has requested
+	 *    an atomic upgrade to a write delegation.
 	 */
 	if (!(new_stp->ls_flags & (NFSLCK_DELEGPREV | NFSLCK_DELEGCUR))) {
 	    stp = LIST_FIRST(&lfp->lf_deleg);
@@ -2951,12 +2962,15 @@ tryagain:
 		nstp = LIST_NEXT(stp, ls_file);
 		if (stp->ls_clp != clp && (stp->ls_flags & NFSLCK_DELEGREAD))
 			writedeleg = 0;
-		else
+		else if (stp->ls_clp != clp ||
+		    (stp->ls_flags & NFSLCK_DELEGWRITE) != 0 ||
+		    (new_stp->ls_flags & NFSLCK_WANTWDELEG) == 0)
 			delegate = 0;
 		if ((readonly && stp->ls_clp != clp &&
-		       (stp->ls_flags & NFSLCK_DELEGWRITE)) ||
+		     (stp->ls_flags & NFSLCK_DELEGWRITE) != 0) ||
 		    (!readonly && (stp->ls_clp != clp ||
-		         (stp->ls_flags & NFSLCK_DELEGREAD)))) {
+		     ((stp->ls_flags & NFSLCK_DELEGREAD) != 0 &&
+		      (new_stp->ls_flags & NFSLCK_WANTWDELEG) == 0)))) {
 		    if (new_stp->ls_flags & NFSLCK_RECLAIM) {
 			delegate = 2;
 		    } else {
@@ -3204,47 +3218,9 @@ tryagain:
 		    /*
 		     * This is where we can choose to issue a delegation.
 		     */
-		    if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0)
-			*rflagsp |= NFSV4OPEN_WDNOTWANTED;
-		    else if (nfsrv_issuedelegs == 0)
-			*rflagsp |= NFSV4OPEN_WDSUPPFTYPE;
-		    else if (NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt))
-			*rflagsp |= NFSV4OPEN_WDRESOURCE;
-		    else if (delegate == 0 || writedeleg == 0 ||
-			NFSVNO_EXRDONLY(exp) || (readonly != 0 &&
-			nfsrv_writedelegifpos == 0) ||
-			!NFSVNO_DELEGOK(vp) ||
-			(new_stp->ls_flags & NFSLCK_WANTRDELEG) != 0 ||
-			(clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) !=
-			 LCL_CALLBACKSON)
-			*rflagsp |= NFSV4OPEN_WDCONTENTION;
-		    else {
-			new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1;
-			new_deleg->ls_stateid.other[0] = delegstateidp->other[0]
-			    = clp->lc_clientid.lval[0];
-			new_deleg->ls_stateid.other[1] = delegstateidp->other[1]
-			    = clp->lc_clientid.lval[1];
-			new_deleg->ls_stateid.other[2] = delegstateidp->other[2]
-			    = nfsrv_nextstateindex(clp);
-			new_deleg->ls_flags = (NFSLCK_DELEGWRITE |
-			    NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
-			*rflagsp |= NFSV4OPEN_WRITEDELEGATE;
-			new_deleg->ls_uid = new_stp->ls_uid;
-			new_deleg->ls_lfp = lfp;
-			new_deleg->ls_clp = clp;
-			new_deleg->ls_filerev = filerev;
-			new_deleg->ls_compref = nd->nd_compref;
-			new_deleg->ls_lastrecall = 0;
-			nfsrv_writedelegcnt++;
-			LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file);
-			LIST_INSERT_HEAD(NFSSTATEHASH(clp,
-			    new_deleg->ls_stateid), new_deleg, ls_hash);
-			LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
-			new_deleg = NULL;
-			NFSD_VNET(nfsstatsv1_p)->srvdelegates++;
-			nfsrv_openpluslock++;
-			nfsrv_delegatecnt++;
-		    }
+		    nfsrv_issuedelegation(vp, clp, nd, delegate, writedeleg,
+			readonly, filerev, NFSVNO_EXRDONLY(exp), &new_deleg,
+			new_stp, lfp, rflagsp, delegstateidp);
 		} else {
 		    new_open->ls_stateid.seqid = 1;
 		    new_open->ls_stateid.other[0] = clp->lc_clientid.lval[0];
@@ -3269,52 +3245,9 @@ tryagain:
 		    /*
 		     * This is where we can choose to issue a delegation.
 		     */
-		    if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0)
-			*rflagsp |= NFSV4OPEN_WDNOTWANTED;
-		    else if (nfsrv_issuedelegs == 0)
-			*rflagsp |= NFSV4OPEN_WDSUPPFTYPE;
-		    else if (NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt))
-			*rflagsp |= NFSV4OPEN_WDRESOURCE;
-		    else if (delegate == 0 || (writedeleg == 0 &&
-			readonly == 0) || !NFSVNO_DELEGOK(vp) ||
-			(clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) !=
-			 LCL_CALLBACKSON)
-			*rflagsp |= NFSV4OPEN_WDCONTENTION;
-		    else {
-			new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1;
-			new_deleg->ls_stateid.other[0] = delegstateidp->other[0]
-			    = clp->lc_clientid.lval[0];
-			new_deleg->ls_stateid.other[1] = delegstateidp->other[1]
-			    = clp->lc_clientid.lval[1];
-			new_deleg->ls_stateid.other[2] = delegstateidp->other[2]
-			    = nfsrv_nextstateindex(clp);
-			if (writedeleg && !NFSVNO_EXRDONLY(exp) &&
-			    (nfsrv_writedelegifpos || !readonly) &&
-			    (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0) {
-			    new_deleg->ls_flags = (NFSLCK_DELEGWRITE |
-				NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
-			    *rflagsp |= NFSV4OPEN_WRITEDELEGATE;
-			    nfsrv_writedelegcnt++;
-			} else {
-			    new_deleg->ls_flags = (NFSLCK_DELEGREAD |
-				NFSLCK_READACCESS);
-			    *rflagsp |= NFSV4OPEN_READDELEGATE;
-			}
-			new_deleg->ls_uid = new_stp->ls_uid;
-			new_deleg->ls_lfp = lfp;
-			new_deleg->ls_clp = clp;
-			new_deleg->ls_filerev = filerev;
-			new_deleg->ls_compref = nd->nd_compref;
-			new_deleg->ls_lastrecall = 0;
-			LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file);
-			LIST_INSERT_HEAD(NFSSTATEHASH(clp,
-			    new_deleg->ls_stateid), new_deleg, ls_hash);
-			LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
-			new_deleg = NULL;
-			NFSD_VNET(nfsstatsv1_p)->srvdelegates++;
-			nfsrv_openpluslock++;
-			nfsrv_delegatecnt++;
-		    }
+		    nfsrv_issuedelegation(vp, clp, nd, delegate, writedeleg,
+			readonly, filerev, NFSVNO_EXRDONLY(exp), &new_deleg,
+			new_stp, lfp, rflagsp, delegstateidp);
 		}
 	} else {
 		/*
@@ -3337,78 +3270,28 @@ tryagain:
 		if (new_stp->ls_flags & NFSLCK_RECLAIM) {
 			new_stp->ls_flags = 0;
 		} else if ((nd->nd_flag & ND_NFSV41) != 0) {
-			/* NFSv4.1 never needs confirmation. */
-			new_stp->ls_flags = 0;
+		    /*
+		     * This is where we can choose to issue a delegation.
+		     */
+		    nfsrv_issuedelegation(vp, clp, nd, delegate, writedeleg,
+			readonly, filerev, NFSVNO_EXRDONLY(exp), &new_deleg,
+			new_stp, lfp, rflagsp, delegstateidp);
+		    /* NFSv4.1 never needs confirmation. */
+		    new_stp->ls_flags = 0;
 
-			/*
-			 * This is where we can choose to issue a delegation.
-			 */
-			if (delegate && nfsrv_issuedelegs &&
-			    (writedeleg || readonly) &&
-			    (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) ==
-			     LCL_CALLBACKSON &&
-			    !NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt) &&
-			    NFSVNO_DELEGOK(vp) &&
-			    ((nd->nd_flag & ND_NFSV41) == 0 ||
-			     (new_stp->ls_flags & NFSLCK_WANTNODELEG) == 0)) {
-				new_deleg->ls_stateid.seqid =
-				    delegstateidp->seqid = 1;
-				new_deleg->ls_stateid.other[0] =
-				    delegstateidp->other[0]
-				    = clp->lc_clientid.lval[0];
-				new_deleg->ls_stateid.other[1] =
-				    delegstateidp->other[1]
-				    = clp->lc_clientid.lval[1];
-				new_deleg->ls_stateid.other[2] =
-				    delegstateidp->other[2]
-				    = nfsrv_nextstateindex(clp);
-				if (writedeleg && !NFSVNO_EXRDONLY(exp) &&
-				    (nfsrv_writedelegifpos || !readonly) &&
-				    ((nd->nd_flag & ND_NFSV41) == 0 ||
-				     (new_stp->ls_flags & NFSLCK_WANTRDELEG) ==
-				     0)) {
-					new_deleg->ls_flags =
-					    (NFSLCK_DELEGWRITE |
-					     NFSLCK_READACCESS |
-					     NFSLCK_WRITEACCESS);
-					*rflagsp |= NFSV4OPEN_WRITEDELEGATE;
-					nfsrv_writedelegcnt++;
-				} else {
-					new_deleg->ls_flags =
-					    (NFSLCK_DELEGREAD |
-					     NFSLCK_READACCESS);
-					*rflagsp |= NFSV4OPEN_READDELEGATE;
-				}
-				new_deleg->ls_uid = new_stp->ls_uid;
-				new_deleg->ls_lfp = lfp;
-				new_deleg->ls_clp = clp;
-				new_deleg->ls_filerev = filerev;
-				new_deleg->ls_compref = nd->nd_compref;
-				new_deleg->ls_lastrecall = 0;
-				LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg,
-				    ls_file);
-				LIST_INSERT_HEAD(NFSSTATEHASH(clp,
-				    new_deleg->ls_stateid), new_deleg, ls_hash);
-				LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg,
-				    ls_list);
-				new_deleg = NULL;
-				NFSD_VNET(nfsstatsv1_p)->srvdelegates++;
-				nfsrv_openpluslock++;
-				nfsrv_delegatecnt++;
-			}
-			/*
-			 * Since NFSv4.1 never does an OpenConfirm, the first
-			 * open state will be acquired here.
-			 */
-			if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) {
-				clp->lc_flags |= LCL_STAMPEDSTABLE;
-				len = clp->lc_idlen;
-				NFSBCOPY(clp->lc_id, clidp, len);
-				gotstate = 1;
-			}
+		    /*
+		     * Since NFSv4.1 never does an OpenConfirm, the first
+		     * open state will be acquired here.
+		     */
+		    if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) {
+			clp->lc_flags |= LCL_STAMPEDSTABLE;
+			len = clp->lc_idlen;
+			NFSBCOPY(clp->lc_id, clidp, len);
+			gotstate = 1;
+		    }
 		} else {
-			*rflagsp |= NFSV4OPEN_RESULTCONFIRM;
-			new_stp->ls_flags = NFSLCK_NEEDSCONFIRM;
+		    *rflagsp |= NFSV4OPEN_RESULTCONFIRM;
+		    new_stp->ls_flags = NFSLCK_NEEDSCONFIRM;
 		}
 		nfsrvd_refcache(new_stp->ls_op);
 		new_stp->ls_noopens = 0;
@@ -5179,6 +5062,11 @@ nfsrv_markreclaim(struct nfsclient *clp)
 	 * Now, just set the flag.
 	 */
 	sp->nst_flag |= NFSNST_RECLAIMED;
+
+	/*
+	 * Free up any old delegations.
+	 */
+	nfsrv_freedeleglist(&clp->lc_olddeleg);
 }
 
 /*
@@ -8943,3 +8831,86 @@ nfsrv_checkmachcred(int op, struct nfsrv_descript *nd, struct nfsclient *clp)
 		return (0);
 	return (NFSERR_AUTHERR | AUTH_TOOWEAK);
 }
+
+/*
+ * Issue a delegation and, optionally set rflagsp for why not.
+ */
+static void
+nfsrv_issuedelegation(struct vnode *vp, struct nfsclient *clp,
+    struct nfsrv_descript *nd, int delegate, int writedeleg, int readonly,
+    u_quad_t filerev, uint64_t rdonly, struct nfsstate **new_delegp,
+    struct nfsstate *new_stp, struct nfslockfile *lfp, uint32_t *rflagsp,
+    nfsv4stateid_t *delegstateidp)
+{
+	struct nfsstate *up_deleg, *new_deleg;
+
+	new_deleg = *new_delegp;
+	up_deleg = LIST_FIRST(&lfp->lf_deleg);
+	if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0)
+		*rflagsp |= NFSV4OPEN_WDNOTWANTED;
+	else if (nfsrv_issuedelegs == 0)
+		*rflagsp |= NFSV4OPEN_WDSUPPFTYPE;
+	else if (NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt))
+		*rflagsp |= NFSV4OPEN_WDRESOURCE;
+	else if (delegate == 0 || !NFSVNO_DELEGOK(vp) ||
+	    (writedeleg == 0 && (readonly == 0 ||
+	    (new_stp->ls_flags & NFSLCK_WANTWDELEG) != 0)) ||
+	    (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) !=
+	     LCL_CALLBACKSON) {
+		/* Is this a downgrade attempt? */
+		if (up_deleg != NULL && up_deleg->ls_clp == clp &&
+		    (up_deleg->ls_flags & NFSLCK_DELEGWRITE) != 0 &&
+		    (new_stp->ls_flags & NFSLCK_WANTRDELEG) != 0)
+			*rflagsp |= NFSV4OPEN_WDNOTSUPPDOWNGRADE;
+		else
+			*rflagsp |= NFSV4OPEN_WDCONTENTION;
+	} else if (up_deleg != NULL &&
+	    (up_deleg->ls_flags & NFSLCK_DELEGREAD) != 0 &&
+	    (new_stp->ls_flags & NFSLCK_WANTWDELEG) != 0) {
+		/* This is an atomic upgrade. */
+		up_deleg->ls_stateid.seqid++;
+		delegstateidp->seqid = up_deleg->ls_stateid.seqid;
+		delegstateidp->other[0] = up_deleg->ls_stateid.other[0];
+		delegstateidp->other[1] = up_deleg->ls_stateid.other[1];
+		delegstateidp->other[2] = up_deleg->ls_stateid.other[2];
+		up_deleg->ls_flags = (NFSLCK_DELEGWRITE |
+		    NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
+		*rflagsp |= NFSV4OPEN_WRITEDELEGATE;
+		nfsrv_writedelegcnt++;
+	} else {
+		new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1;
+		new_deleg->ls_stateid.other[0] = delegstateidp->other[0]
+		    = clp->lc_clientid.lval[0];
+		new_deleg->ls_stateid.other[1] = delegstateidp->other[1]
+		    = clp->lc_clientid.lval[1];
+		new_deleg->ls_stateid.other[2] = delegstateidp->other[2]
+		    = nfsrv_nextstateindex(clp);
+		if (writedeleg && !rdonly &&
+		    (nfsrv_writedelegifpos || !readonly) &&
+		    (new_stp->ls_flags & (NFSLCK_WANTRDELEG |
+		     NFSLCK_WANTWDELEG)) != NFSLCK_WANTRDELEG) {
+			new_deleg->ls_flags = (NFSLCK_DELEGWRITE |
+			    NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
+			*rflagsp |= NFSV4OPEN_WRITEDELEGATE;
+			nfsrv_writedelegcnt++;
+		} else {
+			new_deleg->ls_flags = (NFSLCK_DELEGREAD |
+			    NFSLCK_READACCESS);
+			*rflagsp |= NFSV4OPEN_READDELEGATE;
+		}
+		new_deleg->ls_uid = new_stp->ls_uid;
+		new_deleg->ls_lfp = lfp;
+		new_deleg->ls_clp = clp;
+		new_deleg->ls_filerev = filerev;
+		new_deleg->ls_compref = nd->nd_compref;
+		new_deleg->ls_lastrecall = 0;
+		LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file);
+		LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_deleg->ls_stateid),
+		    new_deleg, ls_hash);
+		LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
+		*new_delegp = NULL;
+		NFSD_VNET(nfsstatsv1_p)->srvdelegates++;
+		nfsrv_openpluslock++;
+		nfsrv_delegatecnt++;
+	}
+}

From nobody Wed Jun  5 01:57:22 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vv9ZV4dsjz5NHTg;
	Wed, 05 Jun 2024 01:57:22 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vv9ZV42gwz4Yk1;
	Wed,  5 Jun 2024 01:57:22 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717552642;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=78H4Z1iry4jNUUQxMgSGdH2U7qL/QmLXLxAqiJPLcGk=;
	b=Fl+8rjPnkwciADD1Wnfbbs3bAl78rDjkE/b5GiNzbOG6+6392nuq0T2SKRH/r30jNXcfds
	sm/rqVeHqu4EEa2HJqRg1EU5FksGOPjHcdCAL/SSyxhX3Wt03uuS0uS37GqkleX0tLDHpo
	QHPlq1YtvHts0K4uOGheo1JMSDGHon7KKTk2WrhFgQInVLcxvDmtFEss2cs5VOTlNFQYt+
	6f7NHoNn3rMJn6mngHQ/wJgDYd2GLywWjXZuHj6mIo5wqn6OBUH8vNdClBO+lZFolxaSt3
	e69GfDlFOFGm9WOJxPt/WHDRfviAJbigRAVudV8oBOHT7gceNmcsh1fHY6RKmQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717552642; a=rsa-sha256; cv=none;
	b=GhFeQFpfr8FWpCMYYGsu2ZxQsF+CnJkfxB5Wya/rB9dYspPW6XzoppMcpj206AX/mBZisD
	RMBwANsvGaTkgrD6s9cUvD9iqgTSsMNvJciLFvVkn3QyYeCRYy3YoXjXKQNOgxIM0chKp1
	K2MXWT5aIeyvi1CKEEjPFs1F22UeGbnCJmZSJvQMfHTMjcvnlA8VDvXurehrP23s6RgaFA
	ZTL2mcoaOib7MfF6wkzSZdTRgQbtxhAle+phxFh52LNgCrSwRUyaYxP+a5gm/ghLaA/ofY
	ZiKaq3baq5vYRFm4nubh5pmXc3v2iqb4rZgtjkcztldZtskQypmAD00k7t+UZA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717552642;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=78H4Z1iry4jNUUQxMgSGdH2U7qL/QmLXLxAqiJPLcGk=;
	b=TW1A7iMAS9ioVXsrDe157Fos9EKtVbGKV2nurrx5cj+6zADxVP4Z+iVp5rKMGQe3BjYNlO
	F46fSHC/fBTZ94cRW3w/Wg7i0jKoWcQXuSKRBgbraR1UV2iwYhlqs0n34oolpHTN4u1OpK
	EmriaAN8nNpNJ3fzMZlQG0OF+OibHio/u2DNgRmtQuoq7ijCEraXVsUEyfzQ99NIFag0Ay
	8S0BA/DZBWBS3rx6vIupvAOmGQBSUyK5nqiz3CvnOuqBvg+WsiK5bbhZPLr2/3rC7eCqRw
	hy/HOt/2EaVakNGhzFu1scLAKulYGTWSh8JrWuRg8qim51KMsM+sSvJxbhTktQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vv9ZV3ZBtzk4m;
	Wed,  5 Jun 2024 01:57:22 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4551vMgG064460;
	Wed, 5 Jun 2024 01:57:22 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4551vMW0064457;
	Wed, 5 Jun 2024 01:57:22 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 01:57:22 GMT
Message-Id: <202406050157.4551vMW0064457@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Rick Macklem <rmacklem@FreeBSD.org>
Subject: git: dbe7ff254e6c - main - nfsd: Update a file missed by
  commit e2c9fad2e0ae
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rmacklem
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: dbe7ff254e6c87a851a75caa7250b8fbcab90c9f
Auto-Submitted: auto-generated

The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=dbe7ff254e6c87a851a75caa7250b8fbcab90c9f

commit dbe7ff254e6c87a851a75caa7250b8fbcab90c9f
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2024-06-05 01:54:15 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2024-06-05 01:54:15 +0000

    nfsd: Update a file missed by commit e2c9fad2e0ae
    
    MFC after:      1 month
---
 sys/fs/nfs/nfsproto.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h
index cef886755d5a..ca9c732b6a43 100644
--- a/sys/fs/nfs/nfsproto.h
+++ b/sys/fs/nfs/nfsproto.h
@@ -619,6 +619,8 @@
 #define	NFSV4OPEN_WDCONTENTION		0x00100000
 #define	NFSV4OPEN_WDNOTWANTED		0x00200000
 #define	NFSV4OPEN_WDSUPPFTYPE		0x00400000
+#define	NFSV4OPEN_WDNOTSUPPDOWNGRADE	0x00800000
+#define	NFSV4OPEN_WDNOTSUPPUPGRADE	0x01000000
 
 /*
  * NFS V4 File Handle types

From nobody Wed Jun  5 02:41:03 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvBXv5GHTz5NNst;
	Wed, 05 Jun 2024 02:41:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvBXv4hWmz4dJk;
	Wed,  5 Jun 2024 02:41:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717555263;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=RPS10YUGnNamBsMBKulp+pZGXyg/if3s+VhoKQWDn3g=;
	b=y0v/5trgMily7cJprt8+/e51LfEDhz22QoiSKL0uvIw3KTz8CWLMDN+sPXGv0EN4oYpX3a
	JDA7XzSYIF+6AykM7wrZc+sZ41DPPHsl1UGO8Ewt7J85NQ+qPMpktRbEpHcj/lXRTQpWfO
	QphdgNsAI9fp5b7W+IIoAaA5lRI/7DdYgSJ+45GfGzaGebQ8HT3ol8IBbXj3m9XX8GiU9d
	nx0KVZK0brLPcCD4Ql1cwdQI2Wl5wn2Y9FuPLZW3OQpp/RZTROxGfgRI0EyQRwVee2Rv4o
	L1DHwUI8XzoUd8xHMJdyfJhmanEswxvm6YsD7uw83D/uXY1z4ADmISFbAEAwUQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717555263; a=rsa-sha256; cv=none;
	b=GoUI7Lm9YEMi9EHaSu7YHojjfcupyS2LW+fIL2mpaZcLDWQR/EC7hJYxB3q+bvqEH/i18i
	5ISD0N0pyftjAYSnjDMLPzdGS/hKoPkmLHPToni/Jd+hL5fwgaTmAACsayxmOSO8T7l19s
	u7qFRz1e5KW+eNGRNFOCQajx+fyoltz9qcXPrkmioiYLUOhJOtjkfdclEsjZkQFQKTHhWP
	BcJTckeehY+4swPcXDvkNtGlXiWNCn7p8Xw2Nly2vi9C/0eSZuVi15CNT33onzWq6aIRde
	kMRNhWisrkNepMgEHOaNGHDWLXoUtjFzyRChDheuXBhARNr3RyUOQ8dk7VBpdQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717555263;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=RPS10YUGnNamBsMBKulp+pZGXyg/if3s+VhoKQWDn3g=;
	b=vW0g+C6zYuvU3cKLFOGItM4rZ3fjWqnt6sODFR8oJsQUGs9hy98eV6YS+vEJSLeoqjbl7Z
	yq45/rhWbhpNgLd0AiNKmr5Nqb6JIoSFloKzmWSYfOFqfAwJHRH5iKMmVX7RIPCMfAqqma
	pVzlJ1evHSurAIvdsN6LDtc5nTxFDjk7AlNxiVDeE/zsBalal43G4TSktKo2X9uRkr6u9d
	afvsiSX5TCzwG6JhloGyWHlN7cJmhLCA9RyzN2H9dcTIw0PeFmZlt7JCLuJNZZxrXUvtnI
	APBA+DkjZYjFbiLQthLJ9zLpm0hUG35nSw+N5ymgStHsGD3IVW5ak0dPD7VqJQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvBXv4HRJzkJy;
	Wed,  5 Jun 2024 02:41:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4552f3MD042491;
	Wed, 5 Jun 2024 02:41:03 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4552f399042488;
	Wed, 5 Jun 2024 02:41:03 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 02:41:03 GMT
Message-Id: <202406050241.4552f399042488@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Enji Cooper <ngie@FreeBSD.org>
Subject: git: 77c04f3eb12a - main - radlib: fix a memory leak in
  `is_valid_request`
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ngie
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 77c04f3eb12a560eb61252c817e4147bc0178e43
Auto-Submitted: auto-generated

The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=77c04f3eb12a560eb61252c817e4147bc0178e43

commit 77c04f3eb12a560eb61252c817e4147bc0178e43
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2024-06-04 20:01:55 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2024-06-05 02:40:55 +0000

    radlib: fix a memory leak in `is_valid_request`
    
    Call `HMAC_CTX_free` if returning early from `is_valid_request` when
    processing `Message-Authenticator` tags.
    
    Reported by:    Coverity
    MFC after:      1 week
    Fixes: 8d5c7813061d ("libradius: Fix input validation bugs")
    Differential Revision:  https://reviews.freebsd.org/D45488
---
 lib/libradius/radlib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/libradius/radlib.c b/lib/libradius/radlib.c
index c7d18227021e..f45eb923774b 100644
--- a/lib/libradius/radlib.c
+++ b/lib/libradius/radlib.c
@@ -320,8 +320,10 @@ is_valid_request(struct rad_handle *h)
 	hctx = HMAC_CTX_new();
 	while (pos < len - 2) {
 		alen = h->in[pos + 1];
-		if (alen < 2)
+		if (alen < 2) {
+			HMAC_CTX_free(hctx);
 			return (0);
+		}
 		if (h->in[pos] == RAD_MESSAGE_AUTHENTIC) {
 			if (len - pos < MD5_DIGEST_LENGTH + 2) {
 				HMAC_CTX_free(hctx);

From nobody Wed Jun  5 03:16:41 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvCL25bk1z5LGl4;
	Wed, 05 Jun 2024 03:16:42 +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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvCL24g40z4jcg;
	Wed,  5 Jun 2024 03:16:42 +0000 (UTC)
	(envelope-from jhb@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717557402;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=zfNWfpVzmA6XKd0QpMLm6jyfM66J41fA+2AjHnHF4z4=;
	b=b0CWo/2g8aEKT5YK+hmJx5MU3V4MMKmkpNFRP8WUi85Sy3Z6vZdNFFWTtoY5+JusYTomgY
	k/aAOyBZndGJVtJ+hZHX9tiFMBxiMNi/q7f/a1VO6nOgMZ5fDo/tUKmqij92odGMAPsHsG
	GC2d6r4h+Byu395RaIYYtv7r9t43DiQXy4ZS3Hpw7C565zdochO1IGdwQbY3F8n1XGb7gX
	vlTNAkiYXM8cmheSTQVBzMJ6y+j8LDRCWzAoG7y4E4JAs4vwUd6y7CcOwaefu8X9+twMd+
	ac4ow9abTGu1zrjDRKLELijCx8SUKXPgXpG0iaYf6+zM6z/1nR72unvcwSrXcw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717557402; a=rsa-sha256; cv=none;
	b=N3aKS+NphrRVC4obJcKoypyRjrkjZ1fjPD5XrviqCHYVhH9n8pgsaOn7Q9ok/QuwEFoag7
	EFxJfFPjoNbkElVnW5RQ1qDR3OvqoIJlYQyOs7i4hgrZuKHQRJH5Ova8QmoAlPShiuVWTm
	AdeUtonPd4lzJ6gPn+CtNkVlHsJPr/pOZ+YdK76MEepyVcFctN3DYN8NEK0fdjNs66H3Da
	5/7ZYALPaC+3sXpF84SAOLCdO20o/msqoa+OAZ/vLSbdmRDP8EJCaV0MYU5gZeJAx57o0P
	Es+/EzpJCkc2Qt6Wlrmif62+bi2PbqAxv2+YC+xlWr8INZcCNCHhUfo8qKMW7Q==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717557402;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=zfNWfpVzmA6XKd0QpMLm6jyfM66J41fA+2AjHnHF4z4=;
	b=czrQHWhwRE5aMV5FUAOFdFWPJLbsz0c+IYUtYaVXlvZfW5y4h+I8GS31Ys2skiuOn4w5qg
	xzIj0G5CkQ+7NJ/BhCK5UbgSzo3HVFuo2lL7NxvJDzDYilrCydx5U9IKP535NGJ/o1M8nY
	rhCsA3g/AHWt6NXjjJ1yIjzKktm83V/3WFnkUj9hC1YwnI3+yn/ZuxJxsnGu4N/p9A0z3+
	in+R8Er+eJNOfqZHS3ON46NgSWAqS4TWeHS2oDDcmgvhQlTOAMFDA12zblr3AqLvrurzt2
	D7QccmP6h402WKW8r9YZN+HkPBYfMByrJx2wVNM+dW1C4k83hL18TSPeuruWTw==
Received: from [IPV6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04] (unknown [IPv6:2601:644:937f:4c50:e0fb:ab3b:bf07:f04])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: jhb)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4VvCL211lJzTRD;
	Wed,  5 Jun 2024 03:16:42 +0000 (UTC)
	(envelope-from jhb@FreeBSD.org)
Message-ID: <b3bc9e03-fde3-4453-8f88-a3f146358f37@FreeBSD.org>
Date: Tue, 4 Jun 2024 20:16:41 -0700
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: git: 871b33ad65ba - main - pci: Consistently use pci_vf_* for
 suballocated VF memory resources
Content-Language: en-US
To: Jessica Clarke <jrtc27@freebsd.org>
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
References: <202406042352.454NqFVj061328@gitrepo.freebsd.org>
 <587A0604-BF30-4A90-9B04-FC56C53BBF2A@freebsd.org>
From: John Baldwin <jhb@FreeBSD.org>
In-Reply-To: <587A0604-BF30-4A90-9B04-FC56C53BBF2A@freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

On 6/4/24 8:00 PM, Jessica Clarke wrote:
> On 5 Jun 2024, at 00:52, John Baldwin <jhb@FreeBSD.org> wrote:
>>
>> The branch main has been updated by jhb:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=871b33ad65baf07c92cce120a4fc1978c2ed7b3b
>>
>> commit 871b33ad65baf07c92cce120a4fc1978c2ed7b3b
>> Author:     John Baldwin <jhb@FreeBSD.org>
>> AuthorDate: 2024-06-04 23:51:37 +0000
>> Commit:     John Baldwin <jhb@FreeBSD.org>
>> CommitDate: 2024-06-04 23:51:37 +0000
>>
>>     pci: Consistently use pci_vf_* for suballocated VF memory resources
>>
>>     Some of the bus resource methods were passing these up to the parent
>>     which triggered rman mismatch assertions in INVARIANTS kernels.
>>
>>     Reported by:    kp
>>     Reviewed by:    imp
>>     Tested by:      kp (earlier version)
>>     Differential Revision:  https://reviews.freebsd.org/D45406
>> ---
>> sys/dev/pci/pci.c         | 118 ++++++++++++++++++++++++++++++++++--
>> sys/dev/pci/pci_iov.c     | 151 ++++++++++++++++++++++++++++++++++++++++++++++
>> sys/dev/pci/pci_private.h |  19 ++++++
>> 3 files changed, 284 insertions(+), 4 deletions(-)
>>
>> diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
>> index 2cb8b4ce9fcc..2093d6a8b5ef 100644
>> --- a/sys/dev/pci/pci.c
>> +++ b/sys/dev/pci/pci.c
>> @@ -164,10 +164,18 @@ static device_method_t pci_methods[] = {
>> DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
>> DEVMETHOD(bus_delete_resource, pci_delete_resource),
>> DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
>> +#ifdef PCI_IOV
>> + DEVMETHOD(bus_adjust_resource, pci_adjust_resource),
>> +#else
>> DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
>> +#endif
>> DEVMETHOD(bus_release_resource, pci_release_resource),
>> DEVMETHOD(bus_activate_resource, pci_activate_resource),
>> DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
>> +#ifdef PCI_IOV
>> + DEVMETHOD(bus_map_resource, pci_map_resource),
>> + DEVMETHOD(bus_unmap_resource, pci_unmap_resource),
>> +#endif
>> DEVMETHOD(bus_child_deleted, pci_child_deleted),
>> DEVMETHOD(bus_child_detached, pci_child_detached),
>> DEVMETHOD(bus_child_pnpinfo, pci_child_pnpinfo_method),
> 
> Would it make sense to instead #ifdef parts of the body of
> pci_adjust_resource rather than switching which function you’re using
> in the first place? I feel that is generally easier to understand, as
> there’s less conditionality, and it’s more easily extensible if any
> other special cases come along.

Hmm, I could do that I guess.  These aren't hot paths so the
extra jump to a tail call in the #ifndef case isn't that bad, and it
probably is a bit more readable.

In related news, you should really land your patches to enable
NEW_PCIB and PCI_RES_BUS by default (and remove the !NEW_PCIB
code). :)

-- 
John Baldwin


From nobody Wed Jun  5 03:47:33 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvD1h4mCFz5LM1B;
	Wed, 05 Jun 2024 03:47:36 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33])
	(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 4VvD1h2Jcvz4ls9;
	Wed,  5 Jun 2024 03:47:36 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142])
	by cmsmtp with ESMTPS
	id EUiqsfVf1drxEEhcdsRfVg; Wed, 05 Jun 2024 03:47:35 +0000
Received: from spqr.komquats.com ([70.66.152.170])
	by cmsmtp with ESMTPSA
	id EhcbsaH3VpsbgEhccs4m9C; Wed, 05 Jun 2024 03:47:35 +0000
X-Auth-User: cschuber
X-Authority-Analysis: v=2.4 cv=Ff+Ux4+6 c=1 sm=1 tr=0 ts=665fdfd7
 a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17
 a=kj9zAlcOel0A:10 a=T1WGqf2p2xoA:10 a=6I5d2MoRAAAA:8 a=NEAV23lmAAAA:8
 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=wdsnJiFg1Du-F9pQc58A:9
 a=eq4buCtkfyZjRIxb:21 a=3ZKOabzyN94A:10 a=CjuIK1q_8ugA:10 a=RVmHIydaz68A:10
 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22
Received: from slippy.cwsent.com (slippy [10.1.1.91])
	by spqr.komquats.com (Postfix) with ESMTP id 66313CC;
	Tue, 04 Jun 2024 20:47:33 -0700 (PDT)
Received: by slippy.cwsent.com (Postfix, from userid 1000)
	id 42321112; Tue, 04 Jun 2024 20:47:33 -0700 (PDT)
X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev
Reply-to: Cy Schubert <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: John Baldwin <jhb@FreeBSD.org>
cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
    dev-commits-src-main@FreeBSD.org
Subject: Re: git: 871b33ad65ba - main - pci: Consistently use pci_vf_* for suballocated VF memory resources
In-reply-to: <202406042352.454NqFVj061328@gitrepo.freebsd.org>
References: <202406042352.454NqFVj061328@gitrepo.freebsd.org>
Comments: In-reply-to John Baldwin <jhb@FreeBSD.org>
   message dated "Tue, 04 Jun 2024 23:52:15 +0000."
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Tue, 04 Jun 2024 20:47:33 -0700
Message-Id: <20240605034733.42321112@slippy.cwsent.com>
X-CMAE-Envelope: MS4xfHD0oTFPesCaUTj1hxBnW3GtW/mNsbdqj1mr9hsgiR6UZnINlM9m7lMotFbyRdOv10poTD0ApZuk4WRmE4I9q00kfXM4lpPDAmPCxJy1EmZuxI+tMtJ1
 /7f4xKWkmhRb3M1LqxezD1/ICgXMM0Xfdv4GFgQfEc1AF5R8dVrG8Wwb2njbxHTBm1B5D45LNaBadTZTbTgNbSy5Aa5ETUmmgVx9XhFRvK4By1gyqDh2GXCA
 Pe4p6UktR/0VB12E49KPW427dRUKJwJG4Wq4SUCrZfAS8iqgSuynHN2wGqT+6XrLydMBUn8mVNArGKo3JmjtF3aRYJPanPwDDumY5VpqBuw=
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]
X-Rspamd-Queue-Id: 4VvD1h2Jcvz4ls9

In message <202406042352.454NqFVj061328@gitrepo.freebsd.org>, John Baldwin writ
es:
> The branch main has been updated by jhb:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=871b33ad65baf07c92cce120a4fc1978
> c2ed7b3b
>
> commit 871b33ad65baf07c92cce120a4fc1978c2ed7b3b
> Author:     John Baldwin <jhb@FreeBSD.org>
> AuthorDate: 2024-06-04 23:51:37 +0000
> Commit:     John Baldwin <jhb@FreeBSD.org>
> CommitDate: 2024-06-04 23:51:37 +0000
>
>     pci: Consistently use pci_vf_* for suballocated VF memory resources
>     
>     Some of the bus resource methods were passing these up to the parent
>     which triggered rman mismatch assertions in INVARIANTS kernels.
>     
>     Reported by:    kp
>     Reviewed by:    imp
>     Tested by:      kp (earlier version)
>     Differential Revision:  https://reviews.freebsd.org/D45406
> ---
>  sys/dev/pci/pci.c         | 118 ++++++++++++++++++++++++++++++++++--
>  sys/dev/pci/pci_iov.c     | 151 ++++++++++++++++++++++++++++++++++++++++++++
> ++
>  sys/dev/pci/pci_private.h |  19 ++++++
>  3 files changed, 284 insertions(+), 4 deletions(-)
>
> diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
> index 2cb8b4ce9fcc..2093d6a8b5ef 100644
> --- a/sys/dev/pci/pci.c
> +++ b/sys/dev/pci/pci.c
> @@ -164,10 +164,18 @@ static device_method_t pci_methods[] = {
>  	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
>  	DEVMETHOD(bus_delete_resource,	pci_delete_resource),
>  	DEVMETHOD(bus_alloc_resource,	pci_alloc_resource),
> +#ifdef PCI_IOV
> +	DEVMETHOD(bus_adjust_resource,	pci_adjust_resource),
> +#else
>  	DEVMETHOD(bus_adjust_resource,	bus_generic_adjust_resource),
> +#endif
>  	DEVMETHOD(bus_release_resource,	pci_release_resource),
>  	DEVMETHOD(bus_activate_resource, pci_activate_resource),
>  	DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
> +#ifdef PCI_IOV
> +	DEVMETHOD(bus_map_resource,	pci_map_resource),
> +	DEVMETHOD(bus_unmap_resource,	pci_unmap_resource),
> +#endif
>  	DEVMETHOD(bus_child_deleted,	pci_child_deleted),
>  	DEVMETHOD(bus_child_detached,	pci_child_detached),
>  	DEVMETHOD(bus_child_pnpinfo,	pci_child_pnpinfo_method),
> @@ -5687,14 +5695,30 @@ pci_activate_resource(device_t dev, device_t child, s
> truct resource *r)
>  	struct pci_devinfo *dinfo;
>  	int error, rid, type;
>  
> -	error = bus_generic_activate_resource(dev, child, r);
> +	dinfo = device_get_ivars(child);
> +#ifdef PCI_IOV
> +	if (dinfo->cfg.flags & PCICFG_VF) {
> +		switch (rman_get_type(r)) {
> +		/* VFs can't have I/O BARs. */
> +		case SYS_RES_IOPORT:
> +			error = EINVAL;
> +			break;
> +		case SYS_RES_MEMORY:
> +			error = pci_vf_activate_mem_resource(dev, child, r);
> +			break;
> +		default:
> +			error = bus_generic_activate_resource(dev, child, r);
> +			break;
> +		}
> +	} else
> +#endif
> +		error = bus_generic_activate_resource(dev, child, r);
>  	if (error)
>  		return (error);
>  
>  	/* Enable decoding in the command register when activating BARs. */
>  	if (device_get_parent(child) == dev) {
>  		/* Device ROMs need their decoding explicitly enabled. */
> -		dinfo = device_get_ivars(child);
>  		rid = rman_get_rid(r);
>  		type = rman_get_type(r);
>  		if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
> @@ -5716,13 +5740,29 @@ pci_deactivate_resource(device_t dev, device_t child,
>  struct resource *r)
>  	struct pci_devinfo *dinfo;
>  	int error, rid, type;
>  
> -	error = bus_generic_deactivate_resource(dev, child, r);
> +	dinfo = device_get_ivars(child);
> +#ifdef PCI_IOV
> +	if (dinfo->cfg.flags & PCICFG_VF) {
> +		switch (rman_get_type(r)) {
> +		/* VFs can't have I/O BARs. */
> +		case SYS_RES_IOPORT:
> +			error = EINVAL;
> +			break;
> +		case SYS_RES_MEMORY:
> +			error = pci_vf_deactivate_mem_resource(dev, child, r);
> +			break;
> +		default:
> +			error = bus_generic_deactivate_resource(dev, child, r);
> +			break;
> +		}
> +	} else
> +#endif
> +		error = bus_generic_deactivate_resource(dev, child, r);
>  	if (error)
>  		return (error);
>  
>  	/* Disable decoding for device ROMs. */
>  	if (device_get_parent(child) == dev) {
> -		dinfo = device_get_ivars(child);
>  		rid = rman_get_rid(r);
>  		type = rman_get_type(r);
>  		if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
> @@ -5732,6 +5772,76 @@ pci_deactivate_resource(device_t dev, device_t child, 
> struct resource *r)
>  	return (0);
>  }
>  
> +#ifdef PCI_IOV
> +int
> +pci_adjust_resource(device_t dev, device_t child, struct resource *r,
> +    rman_res_t start, rman_res_t end)
> +{
> +	struct pci_devinfo *dinfo;
> +
> +	dinfo = device_get_ivars(child);
> +	if (dinfo->cfg.flags & PCICFG_VF) {
> +		switch (rman_get_type(r)) {
> +		/* VFs can't have I/O BARs. */
> +		case SYS_RES_IOPORT:
> +			return (EINVAL);
> +		case SYS_RES_MEMORY:
> +			return (pci_vf_adjust_mem_resource(dev, child, r,
> +			    start, end));
> +		}
> +
> +		/* Fall through for other types of resource allocations. */
> +	}
> +
> +	return (bus_generic_adjust_resource(dev, child, r, start, end));
> +}
> +
> +int
> +pci_map_resource(device_t dev, device_t child, struct resource *r,
> +    struct resource_map_request *argsp, struct resource_map *map)
> +{
> +	struct pci_devinfo *dinfo;
> +
> +	dinfo = device_get_ivars(child);
> +	if (dinfo->cfg.flags & PCICFG_VF) {
> +		switch (rman_get_type(r)) {
> +		/* VFs can't have I/O BARs. */
> +		case SYS_RES_IOPORT:
> +			return (EINVAL);
> +		case SYS_RES_MEMORY:
> +			return (pci_vf_map_mem_resource(dev, child, r, argsp,
> +			    map));
> +		}
> +
> +		/* Fall through for other types of resource allocations. */
> +	}
> +
> +	return (bus_generic_map_resource(dev, child, r, argsp, map));
> +}
> +
> +int
> +pci_unmap_resource(device_t dev, device_t child, struct resource *r,
> +    struct resource_map *map)
> +{
> +	struct pci_devinfo *dinfo;
> +
> +	dinfo = device_get_ivars(child);
> +	if (dinfo->cfg.flags & PCICFG_VF) {
> +		switch (rman_get_type(r)) {
> +		/* VFs can't have I/O BARs. */
> +		case SYS_RES_IOPORT:
> +			return (EINVAL);
> +		case SYS_RES_MEMORY:
> +			return (pci_vf_unmap_mem_resource(dev, child, r, map));
> +		}
> +
> +		/* Fall through for other types of resource allocations. */
> +	}
> +
> +	return (bus_generic_unmap_resource(dev, child, r, map));
> +}
> +#endif
> +
>  void
>  pci_child_deleted(device_t dev, device_t child)
>  {
> diff --git a/sys/dev/pci/pci_iov.c b/sys/dev/pci/pci_iov.c
> index c8e139f043c9..1f1138b2d336 100644
> --- a/sys/dev/pci/pci_iov.c
> +++ b/sys/dev/pci/pci_iov.c
> @@ -1070,6 +1070,12 @@ pci_vf_release_mem_resource(device_t dev, device_t chi
> ld, struct resource *r)
>  
>  	dinfo = device_get_ivars(child);
>  
> +	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
> +	    ("%s: invalid resource %p", __func__, r));
> +	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
> +	    ("%s: rman %p doesn't match for resource %p", __func__,
> +	    &dinfo->cfg.iov->rman, r));
> +
>  	if (rman_get_flags(r) & RF_ACTIVE) {
>  		error = bus_deactivate_resource(child, r);
>  		if (error != 0)
> @@ -1086,3 +1092,148 @@ pci_vf_release_mem_resource(device_t dev, device_t ch
> ild, struct resource *r)
>  
>  	return (rman_release_resource(r));
>  }
> +
> +int
> +pci_vf_activate_mem_resource(device_t dev, device_t child, struct resource *
> r)
> +{
> +#ifdef INVARIANTS
> +	struct pci_devinfo *dinfo = device_get_ivars(child);
> +#endif
> +	struct resource_map map;
> +	int error;
> +
> +	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
> +	    ("%s: invalid resource %p", __func__, r));
> +	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
> +	    ("%s: rman %p doesn't match for resource %p", __func__,
> +	    &dinfo->cfg.iov->rman, r));
> +
> +	error = rman_activate_resource(r);
> +	if (error != 0)
> +		return (error);
> +
> +	if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
> +		error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map);
> +		if (error != 0) {
> +			rman_deactivate_resource(r);
> +			return (error);
> +		}
> +
> +		rman_set_mapping(r, &map);
> +	}
> +	return (0);
> +}
> +
> +int
> +pci_vf_deactivate_mem_resource(device_t dev, device_t child, struct resource
>  *r)
> +{
> +#ifdef INVARIANTS
> +	struct pci_devinfo *dinfo = device_get_ivars(child);
> +#endif
> +	struct resource_map map;
> +	int error;
> +
> +	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
> +	    ("%s: invalid resource %p", __func__, r));
> +	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
> +	    ("%s: rman %p doesn't match for resource %p", __func__,
> +	    &dinfo->cfg.iov->rman, r));
> +
> +	error = rman_deactivate_resource(r);
> +	if (error != 0)
> +		return (error);
> +
> +	if ((rman_get_flags(r) & RF_UNMAPPED) == 0) {
> +		rman_get_mapping(r, &map);
> +		BUS_UNMAP_RESOURCE(dev, child, r, &map);
> +	}
> +	return (0);
> +}
> +
> +int
> +pci_vf_adjust_mem_resource(device_t dev, device_t child, struct resource *r,
> +    rman_res_t start, rman_res_t end)
> +{
> +#ifdef INVARIANTS
> +	struct pci_devinfo *dinfo = device_get_ivars(child);
> +#endif
> +
> +	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
> +	    ("%s: invalid resource %p", __func__, r));
> +	KASSERT(rman_is_region_manager(r, &dinfo->cfg.iov->rman),
> +	    ("%s: rman %p doesn't match for resource %p", __func__,
> +	    &dinfo->cfg.iov->rman, r));
> +
> +	return (rman_adjust_resource(r, start, end));
> +}
> +
> +static struct resource *
> +pci_vf_find_parent_resource(struct pcicfg_iov *iov, struct resource *r)
> +{
> +	struct resource *pres;
> +
> +	for (u_int i = 0; i <= PCIR_MAX_BAR_0; i++) {
> +		pres = iov->iov_bar[i].res;
> +		if (pres != NULL) {
> +			if (rman_get_start(pres) <= rman_get_start(r) &&
> +			    rman_get_end(pres) >= rman_get_end(r))
> +				return (pres);
> +		}
> +	}
> +	return (NULL);
> +}
> +
> +int
> +pci_vf_map_mem_resource(device_t dev, device_t child, struct resource *r,
> +    struct resource_map_request *argsp, struct resource_map *map)
> +{
> +	struct pci_devinfo *dinfo = device_get_ivars(child);
> +	struct pcicfg_iov *iov = dinfo->cfg.iov;
> +	struct resource_map_request args;
> +	struct resource *pres;
> +	rman_res_t length, start;
> +	int error;
> +
> +	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
> +	    ("%s: invalid resource %p", __func__, r));
> +	KASSERT(rman_is_region_manager(r, &iov->rman),
> +	    ("%s: rman %p doesn't match for resource %p", __func__,
> +	    &dinfo->cfg.iov->rman, r));
> +
> +	/* Resources must be active to be mapped. */
> +	if (!(rman_get_flags(r) & RF_ACTIVE))
> +		return (ENXIO);
> +
> +	resource_init_map_request(&args);
> +	error = resource_validate_map_request(r, argsp, &args, &start, &length)
> ;
> +	if (error)
> +		return (error);
> +
> +	pres = pci_vf_find_parent_resource(dinfo->cfg.iov, r);
> +	if (pres == NULL)
> +		return (ENOENT);
> +
> +	args.offset = start - rman_get_start(pres);
> +	args.length = length;
> +	return (bus_map_resource(iov->iov_pf, pres, &args, map));
> +}
> +
> +int
> +pci_vf_unmap_mem_resource(device_t dev, device_t child, struct resource *r,
> +    struct resource_map *map)
> +{
> +	struct pci_devinfo *dinfo = device_get_ivars(child);
> +	struct pcicfg_iov *iov = dinfo->cfg.iov;
> +	struct resource *pres;
> +
> +	KASSERT(rman_get_type(r) == SYS_RES_MEMORY,
> +	    ("%s: invalid resource %p", __func__, r));
> +	KASSERT(rman_is_region_manager(r, &iov->rman),
> +	    ("%s: rman %p doesn't match for resource %p", __func__,
> +	    &dinfo->cfg.iov->rman, r));
> +
> +	pres = pci_vf_find_parent_resource(iov, r);
> +	if (pres == NULL)
> +		return (ENOENT);
> +	return (bus_unmap_resource(iov->iov_pf, pres, map));
> +}
> diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h
> index f97a4df5471b..6dc7e3c505d1 100644
> --- a/sys/dev/pci/pci_private.h
> +++ b/sys/dev/pci/pci_private.h
> @@ -65,9 +65,16 @@ bus_get_dma_tag_t	pci_get_dma_tag;
>  bus_get_resource_list_t	pci_get_resource_list;
>  bus_delete_resource_t	pci_delete_resource;
>  bus_alloc_resource_t	pci_alloc_resource;
> +#ifdef PCI_IOV
> +bus_adjust_resource_t	pci_adjust_resource;
> +#endif
>  bus_release_resource_t	pci_release_resource;
>  bus_activate_resource_t	pci_activate_resource;
>  bus_deactivate_resource_t pci_deactivate_resource;
> +#ifdef PCI_IOV
> +bus_map_resource_t	pci_map_resource;
> +bus_unmap_resource_t	pci_unmap_resource;
> +#endif
>  bus_child_deleted_t	pci_child_deleted;
>  bus_child_detached_t	pci_child_detached;
>  bus_child_pnpinfo_t	pci_child_pnpinfo_method;
> @@ -158,4 +165,16 @@ struct resource *pci_vf_alloc_mem_resource(device_t dev,
>  device_t child,
>  		    rman_res_t count, u_int flags);
>  int		pci_vf_release_mem_resource(device_t dev, device_t child,
>  		    struct resource *r);
> +int		pci_vf_activate_mem_resource(device_t dev, device_t child,
> +		    struct resource *r);
> +int		pci_vf_deactivate_mem_resource(device_t dev, device_t child,
> +		    struct resource *r);
> +int		pci_vf_adjust_mem_resource(device_t dev, device_t child,
> +		    struct resource *r, rman_res_t start, rman_res_t end);
> +int		pci_vf_map_mem_resource(device_t dev, device_t child,
> +		    struct resource *r, struct resource_map_request *argsp,
> +		    struct resource_map *map);
> +int		pci_vf_unmap_mem_resource(device_t dev, device_t child,
> +		    struct resource *r, struct resource_map *map);
> +
>  #endif /* _PCI_PRIVATE_H_ */
>

This patch causes the following boot panic during ata(4) initialization. Reverting it avoids the regression.

1  FreeBSD
2  FreeBSD
3  FreeBSD
5  Drive 1

F6 PXE
Boot:  1 
/boot/config: 1:ad(1,a)/boot/loader -Dh

FreeBSD/x86 boot
Default: 1:ad(1,a)/boot/loader
boot: 
BIOS drive A: is fd0
BIOS drive C: is disk0
BIOS drive D: is disk1
BIOS drive E: is disk2
BIOS drive F: is disk3
BIOS 636kB/3143552kB available memory

FreeBSD/x86 bootstrap loader, Revision 1.1
(Thu May  2 14:28:53 PDT 2024 root@cwsys)
Loading /boot/defaults/loader.conf
Loading /boot/defaults/loader.conf
Loading /boot/device.hints
Loading /boot/loader.conf
\Loading /boot/loader.conf.local
|c/Loading kernel...
-\/boot/kernel/kernel text=0xf2ca8 |text=0x7af938 /-\|text=0x12386c data=0x180+0xe80 data=0x10a780+0x2f5880 /0x8+0x111150+0x8+0x13bfe2-
Loading configured modules...
\|/boot/kernel/if_sk.ko size 0xf8d8 at 0x144e000
/etc/hostid /size=0x25
/boot/kernel/dtraceall.ko size 0x35e0 at 0x145e000
loading required module 'profile'
-/boot/kernel/profile.ko size 0x4258 at 0x1462000
loading required module 'opensolaris'
\/boot/kernel/opensolaris.ko size 0x1e2a8 at 0x1467000
loading required module 'dtrace'
|/boot/kernel/dtrace.ko /size 0x5df08 at 0x1486000
loading required module 'systrace_freebsd32'
-/boot/kernel/systrace_freebsd32.ko size 0x19418 at 0x14e4000
loading required module 'systrace'
\/boot/kernel/systrace.ko size 0x19430 at 0x14fe000
loading required module 'sdt'
|/boot/kernel/sdt.ko size 0x3e68 at 0x1518000
loading required module 'kinst'
//boot/kernel/kinst.ko size 0x8538 at 0x151c000
loading required module 'fasttrap'
/boot/kernel/fasttrap.ko -size 0x5fdc8 at 0x1525000
loading required module 'fbt'
\/boot/kernel/fbt.ko size 0x5da0 at 0x1585000
loading required module 'dtnfscl'
/boot/kernel/dtnfscl.ko size 0x62a0 at 0x158b000
loading required module 'dtmalloc'
|/boot/kernel/dtmalloc.ko size 0x3518 at 0x1592000
//boot/kernel/kbdmux.ko size 0xb068 at 0x1596000
-/boot/kernel/sem.ko size 0x7868 at 0x15a2000
\/boot/kernel/if_nfe.ko size 0x10a60 at 0x15aa000
|/-\|/-\|/-\|/-\|/-\|can't find 'random'
//boot/kernel/amdtemp.ko size 0x7448 at 0x15bb000
loading required module 'amdsmn'
-/boot/kernel/amdsmn.ko size 0x3788 at 0x15c3000
\/boot/kernel/if_lagg.ko size 0x165b8 at 0x15c7000
loading required module 'if_infiniband'
|/boot/kernel/if_infiniband.ko size 0x3588 at 0x15de000
//boot/kernel/aibs.ko size 0x4178 at 0x15e2000
/boot/entropy size=0x1000
-/boot/kernel/geom_mirror.ko size 0x21338 at 0x15e8000
\/boot/kernel/zfs.ko |/size 0x5ea588 at 0x160a000
-/boot/kernel/cpufreq.ko \size 0x12f70 at 0x1bf5000

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel] in 10 seconds... Booting [/boot/kernel/kernel] in 9 seconds... Booting [/boot/kernel/kernel] in 8 seconds... Booting [/boot/kernel/kernel] in 7 seconds... Booting [/boot/kernel/kernel] in 6 seconds... Booting [/boot/kernel/kernel] in 5 seconds... Booting [/boot/kernel/kernel] in 4 seconds... Booting [/boot/kernel/kernel] in 3 seconds... Booting [/boot/kernel/kernel] in 2 seconds... Booting [/boot/kernel/kernel] in 1 second... Booting [/boot/kernel/kernel]...               
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
---<<BOOT>>---
Copyright (c) 1992-2024 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 15.0-CURRENT #112 komquats-n270594-871b33ad65ba: Tue Jun  4 18:09:04 PDT 2024
    root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64
FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
VT(vga): text 80x25
CPU: AMD Phenom(tm) II X4 945 Processor (3014.08-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x100f43  Family=0x10  Model=0x4  Stepping=3
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT>
  SVM: NP,NRIP,NAsids=64
  TSC: P-state invariant
real memory  = 8589934592 (8192 MB)
avail memory = 8266919936 (7883 MB)
Event timer "LAPIC" quality 100
ACPI APIC Table: <Nvidia ASUSACPI>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)
random: unblocking device.
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aEventBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aControlBlock: 16/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/PmTimerBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe0Block: 64/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe1Block: 128/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aEventBlock: 8, using default 32 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aControlBlock: 8, using default 16 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/PmTimerBlock: 8, using default 32 (20230628/tbfadt-850)
ioapic0: MADT APIC ID 4 != hw id 0
ioapic0 <Version 1.1> irqs 0-23
Launching APs: 3 2 1
random: entropy device external interface
kbd1 at kbdmux0
vtvga0: <VT VGA driver>
aesni0: No AES or SHA support.
acpi0: <Nvidia ASUSACPI>
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - \_PR_.CPU0 (20230628/dspkginit-605)
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
hpet0: <High Precision Event Timer> iomem 0xfefff000-0xfefff3ff irq 0,8 on acpi0
Timecounter "HPET" frequency 25000000 Hz quality 950
atrtc0: <AT realtime clock> port 0x70-0x73 on acpi0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pci0: <memory, RAM> at device 0.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
ohci0: <nVidia nForce MCP55 USB Controller> mem 0xfe02f000-0xfe02ffff irq 21 at device 2.0 on pci0
usbus0 on ohci0
usbus0: 12Mbps Full Speed USB v1.0
ehci0: <NVIDIA nForce MCP55 USB 2.0 controller> mem 0xfe02e000-0xfe02e0ff irq 22 at device 2.1 on pci0
usbus1: EHCI version 1.0
usbus1 on ehci0
usbus1: 480Mbps High Speed USB v2.0
atapci0: <nVidia nForce MCP55 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xfc00-0xfc0f at device 4.0 on pci0
ata0: <ATA channel> at channel 0 on atapci0


Fatal trap 12: page fault while in kernel mode
cpuid = 2; apic id = 02
fault virtual address	= 0x54
fault code		= supervisor read data, page not present
instruction pointer	= 0x20:0xffffffff804a76e2
stack pointer	        = 0x28:0xffffffff81f0b6d0
frame pointer	        = 0x28:0xffffffff81f0b700
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		= 0 (swapper)
rdi: fffff80004bf9000 rsi: fffff80004bf9000 rdx: fffff80004c2de00
rcx: fffff80004a99000  r8: fffff80004c2c020  r9: fffffe000ec57540
rax: 0000000000000000 rbx: fffff80004bf9000 rbp: ffffffff81f0b700
r10: fffff80004bc2000 r11: ffffffff81f0b9fc r12: 0000000000000001
r13: 0000000000000000 r14: fffff80004bf8600 r15: fffff80004c2de00
trap number		= 12
panic: page fault
cpuid = 2
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff81f0b3c0
vpanic() at vpanic+0x13f/frame 0xffffffff81f0b4f0
panic() at panic+0x43/frame 0xffffffff81f0b550
trap_fatal() at trap_fatal+0x40b/frame 0xffffffff81f0b5b0
trap_pfault() at trap_pfault+0x46/frame 0xffffffff81f0b600
calltrap() at calltrap+0x8/frame 0xffffffff81f0b600
--- trap 0xc, rip = 0xffffffff804a76e2, rsp = 0xffffffff81f0b6d0, rbp = 0xffffffff81f0b700 ---
pci_activate_resource() at pci_activate_resource+0x22/frame 0xffffffff81f0b700
bus_generic_rman_alloc_resource() at bus_generic_rman_alloc_resource+0xee/frame 0xffffffff81f0b740
nexus_alloc_resource() at nexus_alloc_resource+0x99/frame 0xffffffff81f0b7a0
acpi_alloc_resource() at acpi_alloc_resource+0x84/frame 0xffffffff81f0b860
acpi_pcib_acpi_alloc_resource() at acpi_pcib_acpi_alloc_resource+0x9d/frame 0xffffffff81f0b8d0
ata_pci_alloc_resource() at ata_pci_alloc_resource+0x2bd/frame 0xffffffff81f0b950
bus_alloc_resource() at bus_alloc_resource+0x98/frame 0xffffffff81f0b9b0
ata_attach() at ata_attach+0x322/frame 0xffffffff81f0ba80
device_attach() at device_attach+0x3ac/frame 0xffffffff81f0bad0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f0bb00
ata_pci_attach() at ata_pci_attach+0x2fd/frame 0xffffffff81f0bb30
device_attach() at device_attach+0x3ac/frame 0xffffffff81f0bb80
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f0bbb0
pci_attach() at pci_attach+0xc7/frame 0xffffffff81f0bbe0
acpi_pci_attach() at acpi_pci_attach+0x15/frame 0xffffffff81f0bc20
device_attach() at device_attach+0x3ac/frame 0xffffffff81f0bc70
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f0bca0
acpi_pcib_acpi_attach() at acpi_pcib_acpi_attach+0x424/frame 0xffffffff81f0bd00
device_attach() at device_attach+0x3ac/frame 0xffffffff81f0bd50
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f0bd80
acpi_probe_children() at acpi_probe_children+0x6f/frame 0xffffffff81f0bde0
acpi_attach() at acpi_attach+0x982/frame 0xffffffff81f0be70
device_attach() at device_attach+0x3ac/frame 0xffffffff81f0bec0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f0bef0
device_attach() at device_attach+0x3ac/frame 0xffffffff81f0bf40
bus_generic_new_pass() at bus_generic_new_pass+0x127/frame 0xffffffff81f0bf70
root_bus_configure() at root_bus_configure+0x26/frame 0xffffffff81f0bf90
configure() at configure+0x9/frame 0xffffffff81f0bfa0
mi_startup() at mi_startup+0x1c8/frame 0xffffffff81f0bff0
Uptime: 1s
Automatic reboot in 15 seconds - press a key on the console to abort
--> Press a key on the console to reboot,
--> or switch off the system now.
acpi0: reset failed - timeout
Rebooting...
cpu_reset: Restarting BSP
cpu_reset_proxy: Stopped CPU 2



-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0


From nobody Wed Jun  5 04:28:10 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvDwV5XQWz5LT68;
	Wed, 05 Jun 2024 04:28:10 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvDwV33ncz4s4F;
	Wed,  5 Jun 2024 04:28:10 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717561690;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=/OHW7sH2YzOyfMTmJDPG5qFhULFHlFDAd8Vw2Ee1BhU=;
	b=C+WifYpHBhWf0SDKH0Ot8k0rlzzpy1p9roYXzk6yp83U0isjfTcu8U1vbVmNq376GYpB09
	MqVQ3jtYs96gui8403P74Hl9rG9ypdX0kjy6/kkTDbMkCtcnbwMHaZSTok7q9fBPDCc78a
	etvKexUdZRvSpTyKExirloP4Os1IVaX/ia55cBUidWM3tFBlXHMKy36Ij7lMR6ICjOcyjK
	WyEJVk8ZkgFv3KxxhNPj1KKiw52U64X8qXfQiNfbV5exRTv9J18Nisb/v1hPCfcr61uoPh
	YliE0hqcDnZRTNk7+1Be5fZy80Y3c2QxxhDRDs+WpLxsOVdrbjoCepAyxkllxA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717561690; a=rsa-sha256; cv=none;
	b=XHrMWkhiK46Km4J3fngoiQH865GpD3KefpHJIbOEuPP3WLDqc6zorCzCI9kZD+3Ao+HvJ+
	x4gZTwI1sP0EZxx32QnCN06X0srnwKRaCkrd//aLirLwYYbgVmmT7uWp2XBYiQ41/8VXX8
	HkYSa3tUomUJ429CqLFj2CpOot/P0auD2SFEtIh5DT+APF23A8RNgsD9L2f4+UUqO4au3N
	JFFj2GLJJcKJmcIDs3ovRm1uw5fXoYkY6IcLJ+HxL47qVVM54qvciHfk95KvkSkYVBjYrj
	0tthX8I/sc0vFC10SFAuE5CJRcmZQrkGDe9JdVbfuUHkjlYo8qpbK7szwiHqXQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717561690;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=/OHW7sH2YzOyfMTmJDPG5qFhULFHlFDAd8Vw2Ee1BhU=;
	b=nzq+CvUqryK3PLQB14SjAYFESUE3pMJTI4diqvliUb9DdvzzrvF4Ht3EeJrQorMIIcMf/S
	XC7EXqNwLAEMD0LcH8d3yxk86or2NF/3+M4ln9oKt0AkuFH21Sx9wSlrDFoNGIizNgQcLY
	moQdEnz524PLMzqJsEc21PNeDICskNP6lOBBaKh8n3T1+5bZsrHmT8J9EbwqekGJKlfey8
	anJlYKBKjW+VQbg5kh81BWe8847ZQbukkTJci2hdCUz0dHmYdoUecSzGWj9gwr5hZW28ln
	6Se3lix6bP7Mkmyg5uV+cD4QS+mGMwFvKrKCb2Ah93UQIubDqh1p5cIEVdE6wA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvDwV2TrNznd6;
	Wed,  5 Jun 2024 04:28:10 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4554SAVr019895;
	Wed, 5 Jun 2024 04:28:10 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4554SALi019892;
	Wed, 5 Jun 2024 04:28:10 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 04:28:10 GMT
Message-Id: <202406050428.4554SALi019892@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Alan Cox <alc@FreeBSD.org>
Subject: git: 41dfea24eec2 - main - arm64 pmap: Enable L3C promotions
  by pmap_enter_quick()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: alc
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 41dfea24eec242e1e083e2a879483a7c05c7e2ff
Auto-Submitted: auto-generated

The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=41dfea24eec242e1e083e2a879483a7c05c7e2ff

commit 41dfea24eec242e1e083e2a879483a7c05c7e2ff
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2024-06-01 18:17:52 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2024-06-05 04:25:51 +0000

    arm64 pmap: Enable L3C promotions by pmap_enter_quick()
    
    More precisely, implement L3C (64KB/2MB, depending on base page size)
    promotion in pmap_enter_quick()'s helper function,
    pmap_enter_quick_locked().  At the same time, use the recently
    introduced flag VM_PROT_NO_PROMOTE from pmap_enter_object() to
    pmap_enter_quick_locked() to avoid L3C promotion attempts that will
    fail.
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D45445
---
 sys/arm64/arm64/pmap.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 03d0a1cc6676..8ac7b8f6a135 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -5883,9 +5883,19 @@ pmap_enter_object(pmap_t pmap, vm_offset_t start, vm_offset_t end,
 		    ((rv = pmap_enter_l3c_rx(pmap, va, m, &mpte, prot,
 		    &lock)) == KERN_SUCCESS || rv == KERN_NO_SPACE))
 			m = &m[L3C_ENTRIES - 1];
-		else
-			mpte = pmap_enter_quick_locked(pmap, va, m, prot, mpte,
-			    &lock);
+		else {
+			/*
+			 * In general, if a superpage mapping were possible,
+			 * it would have been created above.  That said, if
+			 * start and end are not superpage aligned, then
+			 * promotion might be possible at the ends of [start,
+			 * end).  However, in practice, those promotion
+			 * attempts are so unlikely to succeed that they are
+			 * not worth trying.
+			 */
+			mpte = pmap_enter_quick_locked(pmap, va, m, prot |
+			    VM_PROT_NO_PROMOTE, mpte, &lock);
+		}
 		m = TAILQ_NEXT(m, listq);
 	}
 	if (lock != NULL)
@@ -6048,12 +6058,19 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m,
 
 #if VM_NRESERVLEVEL > 0
 	/*
-	 * If both the PTP and the reservation are fully populated, then
-	 * attempt promotion.
+	 * First, attempt L3C promotion, if the virtual and physical addresses
+	 * are aligned with each other and an underlying reservation has the
+	 * neighboring L3 pages allocated.  The first condition is simply an
+	 * optimization that recognizes some eventual promotion failures early
+	 * at a lower run-time cost.  Then, attempt L2 promotion, if both the
+	 * PTP and the reservation are fully populated.
 	 */
 	if ((prot & VM_PROT_NO_PROMOTE) == 0 &&
-	    (mpte == NULL || mpte->ref_count == NL3PG) &&
+	    (va & L3C_OFFSET) == (pa & L3C_OFFSET) &&
 	    (m->flags & PG_FICTITIOUS) == 0 &&
+	    vm_reserv_is_populated(m, L3C_ENTRIES) &&
+	    pmap_promote_l3c(pmap, l3, va) &&
+	    (mpte == NULL || mpte->ref_count == NL3PG) &&
 	    vm_reserv_level_iffullpop(m) == 0) {
 		if (l2 == NULL)
 			l2 = pmap_pde(pmap, va, &lvl);

From nobody Wed Jun  5 05:16:38 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvG0V0CFxz5Lcjv;
	Wed, 05 Jun 2024 05:16:42 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32])
	(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 4VvG0T53T3z54ND;
	Wed,  5 Jun 2024 05:16:41 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183])
	by cmsmtp with ESMTPS
	id ERH0sVEkj2Ui5Ej0qsNE4D; Wed, 05 Jun 2024 05:16:40 +0000
Received: from spqr.komquats.com ([70.66.152.170])
	by cmsmtp with ESMTPSA
	id Ej0psvg5rByQrEj0qs239C; Wed, 05 Jun 2024 05:16:40 +0000
X-Auth-User: cschuber
X-Authority-Analysis: v=2.4 cv=UOF+Hzfy c=1 sm=1 tr=0 ts=665ff4b8
 a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17
 a=kj9zAlcOel0A:10 a=T1WGqf2p2xoA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8
 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=V4iLK-Bie_EAfCy7YhQA:9 a=CjuIK1q_8ugA:10
 a=SwEc6Cqz2_MA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22
 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22
Received: from slippy.cwsent.com (slippy [10.1.1.91])
	by spqr.komquats.com (Postfix) with ESMTP id F2F3F20E;
	Tue, 04 Jun 2024 22:16:38 -0700 (PDT)
Received: by slippy.cwsent.com (Postfix, from userid 1000)
	id A862E117; Tue, 04 Jun 2024 22:16:38 -0700 (PDT)
X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev
Reply-to: Cy Schubert <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Cy Schubert <Cy.Schubert@cschubert.com>
cc: John Baldwin <jhb@FreeBSD.org>, src-committers@FreeBSD.org,
    dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject: Re: git: 871b33ad65ba - main - pci: Consistently use pci_vf_* for 
 suballocated VF memory resources
In-reply-to: <20240605034733.42321112@slippy.cwsent.com>
References: <202406042352.454NqFVj061328@gitrepo.freebsd.org> 
 <20240605034733.42321112@slippy.cwsent.com>
Comments: In-reply-to Cy Schubert <Cy.Schubert@cschubert.com>
   message dated "Tue, 04 Jun 2024 20:47:33 -0700."
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Tue, 04 Jun 2024 22:16:38 -0700
Message-Id: <20240605051638.A862E117@slippy.cwsent.com>
X-CMAE-Envelope: MS4xfBKFqlAgTjdNXpu6gpWqh14LRUAfCJWgAxf5R1i7tdz3XWdIyxf7koryk9h9Mjb05ITYSrrAvhgEKXvIwUcLa9vIpjlOs58w2h8ByumotllR1CpvsJj5
 bbb9alKP0ML2L1mzMCkKy2fOlvK1HTTxffVQmd6hDVYDLkzWPOlHW4a7fiTP8w4/Sn/aY3xEEaXyEb3Phrc72lsvN8rQ2K6/xc0UW0gqd/NP4ybXfe6cflFJ
 iQq8qsEcDkzfk6WQgayj0nscURGbLsazmNKUsaybNEtUwJ5J/U451S26z8NeJtIxwlBrZ8Rx35Y1p+emPbEtJuvCp6bn90q1PVOGpj0idUA=
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]
X-Rspamd-Queue-Id: 4VvG0T53T3z54ND

In message <20240605034733.42321112@slippy.cwsent.com>, Cy Schubert writes:
> In message <202406042352.454NqFVj061328@gitrepo.freebsd.org>, John Baldwin wr
> it
> es:
> > The branch main has been updated by jhb:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=871b33ad65baf07c92cce120a4fc19
> 78
> > c2ed7b3b
> >
> > commit 871b33ad65baf07c92cce120a4fc1978c2ed7b3b
> > Author:     John Baldwin <jhb@FreeBSD.org>
> > AuthorDate: 2024-06-04 23:51:37 +0000
> > Commit:     John Baldwin <jhb@FreeBSD.org>
> > CommitDate: 2024-06-04 23:51:37 +0000
> >
> >     pci: Consistently use pci_vf_* for suballocated VF memory resources
> >     
> >     Some of the bus resource methods were passing these up to the parent
> >     which triggered rman mismatch assertions in INVARIANTS kernels.
> >     
> >     Reported by:    kp
> >     Reviewed by:    imp
> >     Tested by:      kp (earlier version)
> >     Differential Revision:  https://reviews.freebsd.org/D45406
> > ---
> >  sys/dev/pci/pci.c         | 118 ++++++++++++++++++++++++++++++++++--
> >  sys/dev/pci/pci_iov.c     | 151 ++++++++++++++++++++++++++++++++++++++++++
> ++
> > ++
[...]
> atapci0: <nVidia nForce MCP55 UDMA133 controller> port 0x1f0-0x1f7,0x3f6,0x17
> 0-0x177,0x376,0xfc00-0xfc0f at device 4.0 on pci0
> ata0: <ATA channel> at channel 0 on atapci0
>
>
> Fatal trap 12: page fault while in kernel mode
> cpuid = 2; apic id = 02
> fault virtual address	= 0x54
> fault code		= supervisor read data, page not present
> instruction pointer	= 0x20:0xffffffff804a76e2
> stack pointer	        = 0x28:0xffffffff81f0b6d0
> frame pointer	        = 0x28:0xffffffff81f0b700
> 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		= 0 (swapper)
> rdi: fffff80004bf9000 rsi: fffff80004bf9000 rdx: fffff80004c2de00
> rcx: fffff80004a99000  r8: fffff80004c2c020  r9: fffffe000ec57540
> rax: 0000000000000000 rbx: fffff80004bf9000 rbp: ffffffff81f0b700
> r10: fffff80004bc2000 r11: ffffffff81f0b9fc r12: 0000000000000001
> r13: 0000000000000000 r14: fffff80004bf8600 r15: fffff80004c2de00
> trap number		= 12
> panic: page fault
> cpuid = 2
> time = 1
> KDB: stack backtrace:
> db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff81f0b3c
> 0
> vpanic() at vpanic+0x13f/frame 0xffffffff81f0b4f0
> panic() at panic+0x43/frame 0xffffffff81f0b550
> trap_fatal() at trap_fatal+0x40b/frame 0xffffffff81f0b5b0
> trap_pfault() at trap_pfault+0x46/frame 0xffffffff81f0b600
> calltrap() at calltrap+0x8/frame 0xffffffff81f0b600
> --- trap 0xc, rip = 0xffffffff804a76e2, rsp = 0xffffffff81f0b6d0, rbp = 0xfff
> fffff81f0b700 ---
> pci_activate_resource() at pci_activate_resource+0x22/frame 0xffffffff81f0b70
> 0
> bus_generic_rman_alloc_resource() at bus_generic_rman_alloc_resource+0xee/fra
> me 0xffffffff81f0b740
> nexus_alloc_resource() at nexus_alloc_resource+0x99/frame 0xffffffff81f0b7a0
> acpi_alloc_resource() at acpi_alloc_resource+0x84/frame 0xffffffff81f0b860
[...]

Removing PCI-IOV from the kernel config also works around this.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0



From nobody Wed Jun  5 05:30:06 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvGJR1w8fz5LffM;
	Wed, 05 Jun 2024 05:30:31 +0000 (UTC)
	(envelope-from manu@bidouilliste.com)
Received: from mx.blih.net (mx.blih.net [212.83.155.74])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvGJP5dNGz55FK;
	Wed,  5 Jun 2024 05:30:29 +0000 (UTC)
	(envelope-from manu@bidouilliste.com)
Authentication-Results: mx1.freebsd.org;
	none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com;
	s=mx; t=1717565420;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=ZkehZEWR1Md/o5fcHj1ctcK0U45sOXRKwJnkNbOqVCE=;
	b=AFtPqZMTQ/J/hRxD3b5wpiNfTfGbcbVpYzqLhJaTLXtDMkD1TjEiqeQ6ohs5NvANkNu35v
	Z03LX9H2rRglJfYjOlZcY/4aYGnaWjbAF/ROFPLQeAV4cmjG8CUAtqPFsx6cO7muMkjyxW
	vWs1RElBqnxqewJYcxVPhEzIlrwFVN0=
Received: from skull.home.blih.net (lfbn-lyo-1-2174-135.w90-66.abo.wanadoo.fr [90.66.97.135])
	by mx.blih.net (OpenSMTPD) with ESMTPSA id e680eb03 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO);
	Wed, 5 Jun 2024 05:30:20 +0000 (UTC)
Date: Wed, 5 Jun 2024 07:30:06 +0200
From: Emmanuel Vadot <manu@bidouilliste.com>
To: John Baldwin <jhb@FreeBSD.org>
Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
 dev-commits-src-main@FreeBSD.org
Subject: Re: git: dcb65c5a94d4 - main - csh: Remove hardlink /.cshrc
Message-Id: <20240605073006.165e209edd1d6ce0c8520c9e@bidouilliste.com>
In-Reply-To: <e447211e-6d51-4060-8f6c-b017bb1c9ce1@FreeBSD.org>
References: <202405290757.44T7vbf4021395@gitrepo.freebsd.org>
	<e447211e-6d51-4060-8f6c-b017bb1c9ce1@FreeBSD.org>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd15.0)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]
X-Rspamd-Queue-Id: 4VvGJP5dNGz55FK


 Hi John,

On Tue, 4 Jun 2024 16:07:53 -0700
John Baldwin <jhb@FreeBSD.org> wrote:

> On 5/29/24 3:57 AM, Emmanuel Vadot wrote:
> > The branch main has been updated by manu:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=dcb65c5a94d4c622b1d486847dc20488f59974e7
> > 
> > commit dcb65c5a94d4c622b1d486847dc20488f59974e7
> > Author:     Emmanuel Vadot <manu@FreeBSD.org>
> > AuthorDate: 2024-05-27 13:12:18 +0000
> > Commit:     Emmanuel Vadot <manu@FreeBSD.org>
> > CommitDate: 2024-05-29 07:56:58 +0000
> > 
> >      csh: Remove hardlink /.cshrc
> >      
> >      Remove this historical artifact.
> >      csh will try to use /.csrch if the user has no home directory defined which
> >      is rather unlikely (To be exact if the concatenation of $HOME and "/.cshrc"
> >      fail which is the same thing).
> >      
> >      Also, with this change pkg will happily handle 3way merge for /root/.cshrc
> >      
> >      Differential Revision:  https://reviews.freebsd.org/D45382
> >      Reviewed by:            emaste, imp
> >      Sponsored by:           Beckhoff Automation GmbH & Co. KG
> 
> FWIW, this happens anytime you use /bin/csh as root's shell and boot into
> single user mode.  Similar to /.profile being used for single user mode if
> root's shell is /bin/sh.  Given we've changed the default shell for root,
> then it's fine to do this change, but that probably should have been noted
> in the commit log (in part to serve as a reminder so we don't remove the
> links for sh).

 I've thought about single user and csh and yes that's a case where csh
will try to use /.cshrc but root shell doesn't matter here as you need
to specify /bin/csh as the init prompt for single user mode, the
default is still /bin/sh no matter what.
 For /.profile, /bin/sh in single-user mode does have $HOME point
to /root so I think we can remove safely the /.profile hardlink. I
haven't looked at why /bin/csh doesn't have $HOME set but if someone
cares about using /bin/csh in single user mode (again nothing to do
with root shell) they probably wants to do something about setting
$HOME to /root/.

 Cheers,

-- 
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>

From nobody Wed Jun  5 05:38:09 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvGTV66sNz5LgGd
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Wed, 05 Jun 2024 05:38:22 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvGTV40gYz56FY
	for <dev-commits-src-main@freebsd.org>; Wed,  5 Jun 2024 05:38:22 +0000 (UTC)
	(envelope-from jrtc27@jrtc27.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-35dcd34a69bso4899197f8f.3
        for <dev-commits-src-main@freebsd.org>; Tue, 04 Jun 2024 22:38:22 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717565901; x=1718170701;
        h=to:references:message-id:content-transfer-encoding:cc:date
         :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=DUiys0J02TLtCJSGine00ghgPjfsdZAHtD8m+QlklmI=;
        b=T9RmYrnv9cvsBKdktijOCNRinGlpet0aqmx8J4G/8kw8Y7Yiri330sJidVJ8d8bfPR
         G/TxD6tMRyfjx5fKwsSkYAdXuXMJbGYfwHmhWC/4Iy+SMcrdLSTDhnwlEYLZrgSm4A30
         To8EO/SbJzUqYMA3kkNZ3YaHfahq+0lEeO6f5eeCDNHXfx6J5py4aEhCzmaVv+4uaj9/
         40OlK0bjr/F8qKQmXJZAQ4ZXvqzR6G3FH8u4o2h8ubtr2qgR8DaPnh1qct2NvbSbxAjB
         Z8bzhTf1N+tM6/57IDDESAGra8CRfkupo3Cu6Bm9GjDzZsEr7ybbQa3orekKwcsg6tm3
         UNVw==
X-Forwarded-Encrypted: i=1; AJvYcCVdW1G7EUcpl56LUQDIhvlKsDN3GpYvXIayPsbSfCj0rNJOXzYbrHIpGa67xAfNgi61d3u02RzhglSU6fUue9aS0E1Dk8WF//kpTjUCDXhUTA==
X-Gm-Message-State: AOJu0Yw2ZnwsWuZ/kzPdS3agVS1thOgtMwdz0eIbIEDuPD6j8kX1JA+x
	YeUPn/PIe5AzEdbUTpqsiOWnK9/ATssWeBxyxwOqALG0lJohKLrGpkAsuKjL3kw=
X-Google-Smtp-Source: AGHT+IEVKrsXwuL8spPePuWwcVRGNw5WR9cdAvYvr9edOuTckU3pk3MhhX2EqW8t/hkG+TeTx5CIhQ==
X-Received: by 2002:a5d:4a8f:0:b0:359:7891:48db with SMTP id ffacd0b85a97d-35e84057c95mr1014586f8f.10.1717565900777;
        Tue, 04 Jun 2024 22:38:20 -0700 (PDT)
Received: from smtpclient.apple ([131.111.5.201])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd04cc0b6sm13201412f8f.44.2024.06.04.22.38.20
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 04 Jun 2024 22:38:20 -0700 (PDT)
Content-Type: text/plain;
	charset=utf-8
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
Subject: Re: git: dcb65c5a94d4 - main - csh: Remove hardlink /.cshrc
From: Jessica Clarke <jrtc27@freebsd.org>
In-Reply-To: <20240605073006.165e209edd1d6ce0c8520c9e@bidouilliste.com>
Date: Wed, 5 Jun 2024 06:38:09 +0100
Cc: John Baldwin <jhb@FreeBSD.org>,
 "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <885F8DF1-69E2-4AC7-87E2-B63F1588DE17@freebsd.org>
References: <202405290757.44T7vbf4021395@gitrepo.freebsd.org>
 <e447211e-6d51-4060-8f6c-b017bb1c9ce1@FreeBSD.org>
 <20240605073006.165e209edd1d6ce0c8520c9e@bidouilliste.com>
To: Emmanuel Vadot <manu@bidouilliste.com>
X-Mailer: Apple Mail (2.3774.500.171.1.1)
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]
X-Rspamd-Queue-Id: 4VvGTV40gYz56FY

On 5 Jun 2024, at 06:30, Emmanuel Vadot <manu@bidouilliste.com> wrote:
>=20
>=20
> Hi John,
>=20
> On Tue, 4 Jun 2024 16:07:53 -0700
> John Baldwin <jhb@FreeBSD.org> wrote:
>=20
>> On 5/29/24 3:57 AM, Emmanuel Vadot wrote:
>>> The branch main has been updated by manu:
>>>=20
>>> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Ddcb65c5a94d4c622b1d486847dc20488=
f59974e7
>>>=20
>>> commit dcb65c5a94d4c622b1d486847dc20488f59974e7
>>> Author:     Emmanuel Vadot <manu@FreeBSD.org>
>>> AuthorDate: 2024-05-27 13:12:18 +0000
>>> Commit:     Emmanuel Vadot <manu@FreeBSD.org>
>>> CommitDate: 2024-05-29 07:56:58 +0000
>>>=20
>>>     csh: Remove hardlink /.cshrc
>>>=20
>>>     Remove this historical artifact.
>>>     csh will try to use /.csrch if the user has no home directory =
defined which
>>>     is rather unlikely (To be exact if the concatenation of $HOME =
and "/.cshrc"
>>>     fail which is the same thing).
>>>=20
>>>     Also, with this change pkg will happily handle 3way merge for =
/root/.cshrc
>>>=20
>>>     Differential Revision:  https://reviews.freebsd.org/D45382
>>>     Reviewed by:            emaste, imp
>>>     Sponsored by:           Beckhoff Automation GmbH & Co. KG
>>=20
>> FWIW, this happens anytime you use /bin/csh as root's shell and boot =
into
>> single user mode.  Similar to /.profile being used for single user =
mode if
>> root's shell is /bin/sh.  Given we've changed the default shell for =
root,
>> then it's fine to do this change, but that probably should have been =
noted
>> in the commit log (in part to serve as a reminder so we don't remove =
the
>> links for sh).
>=20
> I've thought about single user and csh and yes that's a case where csh
> will try to use /.cshrc but root shell doesn't matter here as you need
> to specify /bin/csh as the init prompt for single user mode, the
> default is still /bin/sh no matter what.
> For /.profile, /bin/sh in single-user mode does have $HOME point
> to /root so I think we can remove safely the /.profile hardlink. I
> haven't looked at why /bin/csh doesn't have $HOME set but if someone
> cares about using /bin/csh in single user mode (again nothing to do
> with root shell) they probably wants to do something about setting
> $HOME to /root/.

Are you sure it=E2=80=99s /root before .profile is sourced? root=E2=80=99s=
 .profile
sets and exports HOME itself, so echo $HOME will be misleading at a
single-user prompt for the environment at .profile source time.

Note that root=E2=80=99s .cshrc doesn=E2=80=99t do this, which is likely =
what you=E2=80=99re
seeing?

Jess


From nobody Wed Jun  5 05:45:34 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvGf23K5Xz5LxCs;
	Wed, 05 Jun 2024 05:45:46 +0000 (UTC)
	(envelope-from manu@bidouilliste.com)
Received: from mx.blih.net (mx.blih.net [212.83.155.74])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvGf14jWcz56vv;
	Wed,  5 Jun 2024 05:45:45 +0000 (UTC)
	(envelope-from manu@bidouilliste.com)
Authentication-Results: mx1.freebsd.org;
	none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com;
	s=mx; t=1717566344;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=SjZBckpdmpRvY8fzVcPMd+ooIsWIiaL/RvwefCBH0pE=;
	b=rQ0vvxlSI1f2l+2SM4If+LkFLlK1m5gAcpAHGWtVdi+QrZq/0l7xoIIFzwNFD/PE+q/3Uy
	U96XeXDj3T5nRogF82wmv0MyR38VOXMtk2X14QusUzRJjsVhnOs7ObsQYImfR6ADZ+nobG
	PM3N2a9PZGba277gM008NuDyv6iwtk8=
Received: from skull.home.blih.net (lfbn-lyo-1-2174-135.w90-66.abo.wanadoo.fr [90.66.97.135])
	by mx.blih.net (OpenSMTPD) with ESMTPSA id 5620865d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO);
	Wed, 5 Jun 2024 05:45:44 +0000 (UTC)
Date: Wed, 5 Jun 2024 07:45:34 +0200
From: Emmanuel Vadot <manu@bidouilliste.com>
To: Jessica Clarke <jrtc27@freebsd.org>
Cc: John Baldwin <jhb@FreeBSD.org>, "src-committers@freebsd.org"
 <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org"
 <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org"
 <dev-commits-src-main@FreeBSD.org>
Subject: Re: git: dcb65c5a94d4 - main - csh: Remove hardlink /.cshrc
Message-Id: <20240605074534.92c8334aa97628f7b8c58296@bidouilliste.com>
In-Reply-To: <885F8DF1-69E2-4AC7-87E2-B63F1588DE17@freebsd.org>
References: <202405290757.44T7vbf4021395@gitrepo.freebsd.org>
	<e447211e-6d51-4060-8f6c-b017bb1c9ce1@FreeBSD.org>
	<20240605073006.165e209edd1d6ce0c8520c9e@bidouilliste.com>
	<885F8DF1-69E2-4AC7-87E2-B63F1588DE17@freebsd.org>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd15.0)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]
X-Rspamd-Queue-Id: 4VvGf14jWcz56vv

On Wed, 5 Jun 2024 06:38:09 +0100
Jessica Clarke <jrtc27@freebsd.org> wrote:

> On 5 Jun 2024, at 06:30, Emmanuel Vadot <manu@bidouilliste.com> wrote:
> >=20
> >=20
> > Hi John,
> >=20
> > On Tue, 4 Jun 2024 16:07:53 -0700
> > John Baldwin <jhb@FreeBSD.org> wrote:
> >=20
> >> On 5/29/24 3:57 AM, Emmanuel Vadot wrote:
> >>> The branch main has been updated by manu:
> >>>=20
> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3Ddcb65c5a94d4c622b1d486=
847dc20488f59974e7
> >>>=20
> >>> commit dcb65c5a94d4c622b1d486847dc20488f59974e7
> >>> Author:     Emmanuel Vadot <manu@FreeBSD.org>
> >>> AuthorDate: 2024-05-27 13:12:18 +0000
> >>> Commit:     Emmanuel Vadot <manu@FreeBSD.org>
> >>> CommitDate: 2024-05-29 07:56:58 +0000
> >>>=20
> >>>     csh: Remove hardlink /.cshrc
> >>>=20
> >>>     Remove this historical artifact.
> >>>     csh will try to use /.csrch if the user has no home directory def=
ined which
> >>>     is rather unlikely (To be exact if the concatenation of $HOME and=
 "/.cshrc"
> >>>     fail which is the same thing).
> >>>=20
> >>>     Also, with this change pkg will happily handle 3way merge for /ro=
ot/.cshrc
> >>>=20
> >>>     Differential Revision:  https://reviews.freebsd.org/D45382
> >>>     Reviewed by:            emaste, imp
> >>>     Sponsored by:           Beckhoff Automation GmbH & Co. KG
> >>=20
> >> FWIW, this happens anytime you use /bin/csh as root's shell and boot i=
nto
> >> single user mode.  Similar to /.profile being used for single user mod=
e if
> >> root's shell is /bin/sh.  Given we've changed the default shell for ro=
ot,
> >> then it's fine to do this change, but that probably should have been n=
oted
> >> in the commit log (in part to serve as a reminder so we don't remove t=
he
> >> links for sh).
> >=20
> > I've thought about single user and csh and yes that's a case where csh
> > will try to use /.cshrc but root shell doesn't matter here as you need
> > to specify /bin/csh as the init prompt for single user mode, the
> > default is still /bin/sh no matter what.
> > For /.profile, /bin/sh in single-user mode does have $HOME point
> > to /root so I think we can remove safely the /.profile hardlink. I
> > haven't looked at why /bin/csh doesn't have $HOME set but if someone
> > cares about using /bin/csh in single user mode (again nothing to do
> > with root shell) they probably wants to do something about setting
> > $HOME to /root/.
>=20
> Are you sure it?s /root before .profile is sourced? root?s .profile
> sets and exports HOME itself, so echo $HOME will be misleading at a
> single-user prompt for the environment at .profile source time.
>=20
> Note that root?s .cshrc doesn?t do this, which is likely what you?re
> seeing?
>=20
> Jess
>=20

 Yes indeed that's what I'm seeing, my bad :)

--=20
Emmanuel Vadot <manu@bidouilliste.com> <manu@freebsd.org>

From nobody Wed Jun  5 09:03:06 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvM1k2KjJz5MDWf;
	Wed, 05 Jun 2024 09:03:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvM1k1gz3z4Nl6;
	Wed,  5 Jun 2024 09:03:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717578186;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=5iYaWlF49jYycTyJTwl8vvKJCdtqYycZ5FN2r5593/A=;
	b=yk04Qwi0NwWcyPOiRU2oUMreJubj9/aso3MOLVCsDqrrzrowNHc85v9zupdm0I6ja/+mV1
	RuTOPuVbMhQBDE4IXwlaHYOq/ggbHCE6s+Ig2TPKgnSBjnuASSLnX8+UtFY0wEHcN63Hjt
	fRpgmohqf9KdxZp7iP7eOeelW3Jl1/eHagnKINivzuOQWorSjKHCxSSaarbOpaz49ehB7p
	2R3KUWMgsTeiMnauQg0KIrTmC7/o+8QXBdgGOcl/52lPSLxB8vKo0bTR2b2vdhxwecaXtK
	1Qa43JSW0buToMVatKu26/ousoZVLF4AxaQWLbDLHO1Wh71UWq/3xd97cFmgLw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717578186; a=rsa-sha256; cv=none;
	b=Tuaz6NU6Bgt4wPusKfblJgYfRp366QGHtwbVrLwGYRuqhaRQh/c7tXaTlz6SWwJqB9StEy
	Y8oOWKYDYUyoWxXwjjSpsdj7x/jdV0W0hRXtCVvuW/7H89bmWodlpSnXJu9eaEOvT+MNBK
	x06rDzxarM9klu2ishEN7MBGWt/3DImx+MMYCgMpiQs0+rVpiz8a1aQZlViqOmW2zJpL+P
	kwH2OOGn+YcxEPy2LVNDVSEnHuz26QanRuEpBbMEy4VhSiWWX2fgBUf0zbgDOIer6p1Dw7
	qjX55wXaxstUqbtfqiV88mK1U88zcq4tsKoQ/UFOs39fiWo6kQvml1cqVdJbNQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717578186;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=5iYaWlF49jYycTyJTwl8vvKJCdtqYycZ5FN2r5593/A=;
	b=DR3yhKbrERCP1NLAVP1ZkTJywiSsmi07N8Auuf7daMJw8N53C6LzGWYWHlq6iezC+LP0h9
	XFn+dTM4E97iqR2ce1uW6JLQdtfJFQw6IN73XCubQha8ikmNXRjrcJ6T451FbBGM44uIG4
	aLoFxSoymyjrKkCTFNWxly2ocDDX4cqlwkUr1Erw9wKUl++zNrIBeLLy9fHYnmyDxsc3a0
	iIe2gD5+UbCzxfUJt2MV3C6iNanUavhlfGBIZWzjMo2+Z4p43jUx1UvZEd7wDJWwmtPWxC
	SKs3N/uH9tUh8gVo78oGF25UeCggJ2OsKk7aJJZ4S29E+y3bZgwgZAbLVN57Cg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvM1k1GkJzwKx;
	Wed,  5 Jun 2024 09:03:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4559366d093352;
	Wed, 5 Jun 2024 09:03:06 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455936kc093349;
	Wed, 5 Jun 2024 09:03:06 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 09:03:06 GMT
Message-Id: <202406050903.455936kc093349@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Baptiste Daroussin <bapt@FreeBSD.org>
Subject: git: 83fcab792c9d - main - nuageinit: use pw(8) instead
  of getent(1)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: bapt
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 83fcab792c9d7f13f7e8bd73cf1850ba74f49341
Auto-Submitted: auto-generated

The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=83fcab792c9d7f13f7e8bd73cf1850ba74f49341

commit 83fcab792c9d7f13f7e8bd73cf1850ba74f49341
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-06-05 08:34:25 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-06-05 09:00:53 +0000

    nuageinit: use pw(8) instead of getent(1)
    
    pw(8) allows to seek for users in a custom rootdir, which makes it
    easier for a testsuite
    
    MFC After:      3 days
---
 libexec/nuageinit/nuage.lua | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index 55486ae2b122..020b54b0776c 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -72,7 +72,12 @@ local function adduser(pwd)
 		warnmsg("Argument should be a table")
 		return nil
 	end
-	local f = io.popen("getent passwd "..pwd.name)
+	local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+	local cmd = "pw "
+	if root then
+		cmd = cmd .. "-R " .. root .. " "
+	end
+	local f = io.popen(cmd .. " usershow " ..pwd.name .. " -7 2>/dev/null")
 	local pwdstr = f:read("*a")
 	f:close()
 	if pwdstr:len() ~= 0 then
@@ -109,8 +114,7 @@ local function adduser(pwd)
 		precmd = "echo "..pwd.plain_text_passwd .. "| "
 		postcmd = " -H 0 "
 	end
-	local root = os.getenv("NUAGE_FAKE_ROOTDIR")
-	local cmd = precmd .. "pw "
+	cmd = precmd .. "pw "
 	if root then
 		cmd = cmd .. "-R " .. root .. " "
 	end
@@ -140,7 +144,12 @@ local function addgroup(grp)
 		warnmsg("Argument should be a table")
 		return false
 	end
-	local f = io.popen("getent group "..grp.name)
+	local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+	local cmd = "pw "
+	if root then
+		cmd = cmd .. "-R " .. root .. " "
+	end
+	local f = io.popen(cmd .. " groupshow " ..grp.name .. " 2>/dev/null")
 	local grpstr = f:read("*a")
 	f:close()
 	if grpstr:len() ~= 0 then
@@ -151,8 +160,7 @@ local function addgroup(grp)
 		local list = splitlist(grp.members)
 		extraargs = " -M " .. table.concat(list, ',')
 	end
-	local root = os.getenv("NUAGE_FAKE_ROOTDIR")
-	local cmd = "pw "
+	cmd = "pw "
 	if root then
 		cmd = cmd .. "-R " .. root .. " "
 	end

From nobody Wed Jun  5 09:03:07 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvM1l3Zl7z5MDSn;
	Wed, 05 Jun 2024 09:03:07 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvM1l2TMPz4Nl7;
	Wed,  5 Jun 2024 09:03:07 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717578187;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=0CvP76hz2O1Yk0tUsbnosZhhHw1gG1TJUfPxiF4ya9U=;
	b=IQ60+ptJrFTMj5Qf2S/J3j0dq1KmImrqX1+VOEw6PUJtHBTpPHqmpVomgblgIDcsKRWFwj
	AYvh9wxy/tsNZOxsAP/BXMbTCq6/w7e6xeK2kjadjqJEjnYi/MYRopubkh+0gC4eAEJfxB
	CIIIRfj082TyoWeDJCvJuGsl2oX4vygyqAEAq7noF4fc9szcNYiHayQ8VdmYVihOgE/S3M
	3UJD/3BDcTyLWylnfEbnDHN9ijbAGzM7wMxGFIgyeR23FZ5ksY55Kktym33ZR/9miUiUB0
	JYIg6d0ToX99peEmJHwEj7ULV4Xu3J9JRiY61BMmgO05hnxQqwgk/pR6EtAO/g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717578187; a=rsa-sha256; cv=none;
	b=xqWTpYft2smoewNt0gVsYXzbtES2UMlx+22zpKhQAeudmWqlU+WoqGljhxp0hXyJuzhytM
	4vSr+YgG+TB5v7nUuMjTYW6j3LV8D8a9R+L1bnMmAo1YUhms66CEerHLbRA85gzohCaOej
	vKLsdHkzZ174UslYZkNiByizm27dvElWlNU38PqUI6UOxQDNQ/LMxLRHDRdEJVsaU7BTyb
	lOSdsmktVL3vIE+IZvl6DAGq59Nz6ybZUnZO8SusX61bDDktuUWCsRdtlJnFS7bYXcep7f
	tafR38U/8LV00zBpRBkDg/djgW7lIeNxEqZ7q+ltlRiPi7L4jSHMitNYZlr/zg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717578187;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=0CvP76hz2O1Yk0tUsbnosZhhHw1gG1TJUfPxiF4ya9U=;
	b=sgUUHghxZSpgRyJyZC79awE+wO4CysmblpfBZ9cXGJNqKddj2vk7+wWbZX6MUUEMxtIrOb
	YfRrzaOLrO1OYYH8CZACHo2fhDzrnjueT26PrNBbXwRNIB1D+bj0i3GCa8oMtRZ78uxowR
	dfKYBEHT8ywKdtJZjFYtnkUzYwQTxO4ckSRxplSuh3Kp8TCFrK1s8dNimLQQDnzDLxieNK
	TlFllPUYasPJ35UYt1rYUZCOmFNrHZgRl6ixCGUE3bnIyIdkTU1PgWWXk9ycSrunCzalEs
	aRm4Le8y8ik0aHVY/UjzZiJ/Coc79NnrWM9dExyEepKlhTXzpIXQD2PYAk+uaw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvM1l25ckzwlR;
	Wed,  5 Jun 2024 09:03:07 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4559377Q093404;
	Wed, 5 Jun 2024 09:03:07 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455937l5093401;
	Wed, 5 Jun 2024 09:03:07 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 09:03:07 GMT
Message-Id: <202406050903.455937l5093401@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Baptiste Daroussin <bapt@FreeBSD.org>
Subject: git: fa07b02f6e09 - main - nuageinit: make addsshkey
  friendly for testsuite
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: bapt
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: fa07b02f6e09f776b3afe5709e8fee1764c11a2a
Auto-Submitted: auto-generated

The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=fa07b02f6e09f776b3afe5709e8fee1764c11a2a

commit fa07b02f6e09f776b3afe5709e8fee1764c11a2a
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-06-05 08:44:17 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-06-05 09:00:53 +0000

    nuageinit: make addsshkey friendly for testsuite
---
 libexec/nuageinit/nuage.lua | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua
index 020b54b0776c..ca70c778791b 100644
--- a/libexec/nuageinit/nuage.lua
+++ b/libexec/nuageinit/nuage.lua
@@ -177,6 +177,10 @@ end
 local function addsshkey(homedir, key)
 	local chownak = false
 	local chowndotssh = false
+	local root = os.getenv("NUAGE_FAKE_ROOTDIR")
+	if root then
+		homedir = root .. "/" .. homedir
+	end
 	local ak_path = homedir .. "/.ssh/authorized_keys"
 	local dotssh_path = homedir .. "/.ssh"
 	local dirattrs = lfs.attributes(ak_path)

From nobody Wed Jun  5 09:03:08 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvM1m53gDz5MDnN;
	Wed, 05 Jun 2024 09:03:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvM1m3TFZz4Nsp;
	Wed,  5 Jun 2024 09:03:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717578188;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=hJjLDUJ2Z5TZmPXnvrnKdl1HkiDae8MLD+N1xBYPAvI=;
	b=Fbort4erLUOw3UN9hQKqWngHLpaFBxCnUwOXuicYFxj7Iol0oMCtkhvnU4eqhCNDHEyKRW
	7IMEHoCBjuBC6MdATfQlEon1aFQGKsIRjQyR7wWCbbp2nZlTwcnnso2ybhXiitRbCf/pCh
	p4xlvq5dCyE+sWLIxn6zI2Fx1UTWHq4R6ivB9ItolXmS7bRGnAboXzd4d69UyI17HKdaqv
	vlYxYDjET/ZlHBzvyiLzF5ah4qV0/AboWsZMe5thlO6fLHGFh0AdWYUZBfo5r0UdTdhVve
	bD1KomPJ+aCyq7990M4lF5aHmUhPJEeqhrORTM3ygOHgmAqpEoqT5IWGy/RUYw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717578188; a=rsa-sha256; cv=none;
	b=is79cM7Wmol+vICJkeUtgg8ZVv3gv78jjf1u/0BWnn9bJ/+g5Nb3TGdHIBjZprWeHcyF3v
	9pKgPqJCv5mEXe6gpXWYdr8scALwmaDqirlaTIX8aX1ikZ8s65nzHkVoEUPuiZ9uQwcx6X
	uPmqVm+lh3w3Itogz++qCEfSJbFEiVOugORAMvQV7d6q/FG232AXbyY/i8N945+/fG5Xal
	Zyn07APMqefaJwVEXTwcZiG64J5/BOqXj2W2KyOfZUpPkvrm0FqL+wuGgXMuG0O4V2mI6E
	RqLI/Fcrwai8xH/47u1GgxKgfhWmuilZV9owlqRP9zCzCehyb7bpNvhXvlJBVg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717578188;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=hJjLDUJ2Z5TZmPXnvrnKdl1HkiDae8MLD+N1xBYPAvI=;
	b=T70FitsJfgL3qAFMMXKZcL8LeUv9uKp2/tIqLp/bY1DKzCrmJdf1FgcxMuKTz7d8mdjG+R
	6arOOJ1F3ugCyarkFMmYSHU0D1UqZX2SrycKBEnoX/udYRCy+LU2xQWjVVHvGvcrebsfEE
	XWIqofPeX+2TXgqJobqsA4AsHmWvTSC2rRFw4K9x4PyDrsA1kPsVM5M0TrGoXg6Ys/KDBX
	DILsj3SrUQnUUBYFCN5v7SCZhXH90tDI8tO4vDBa61JBfC3L1Wqp5eOyQ2Oguo8l2aubmn
	He1gU5fAQfL0XZAnkeaU10mYn05BXPemkwvvzUFbCQlQqhMoivPAAxdx7shDTw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvM1m35XxzwKy;
	Wed,  5 Jun 2024 09:03:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455938ZH093443;
	Wed, 5 Jun 2024 09:03:08 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4559389f093440;
	Wed, 5 Jun 2024 09:03:08 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 09:03:08 GMT
Message-Id: <202406050903.4559389f093440@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Baptiste Daroussin <bapt@FreeBSD.org>
Subject: git: 8d7331e62a5a - main - nuageinit: fix authorized_key
  test
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: bapt
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8d7331e62a5aa75760ac54e3cb1594b0001645c6
Auto-Submitted: auto-generated

The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=8d7331e62a5aa75760ac54e3cb1594b0001645c6

commit 8d7331e62a5aa75760ac54e3cb1594b0001645c6
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2024-06-05 08:58:17 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2024-06-05 09:00:54 +0000

    nuageinit: fix authorized_key test
    
    After miss reading the cloudinit spec I ended up writting a wrong
    test for basic ssh key setup, nuageinit has been fixed, but not
    the test, here is the actual fix.
    
    Reported by:    markj
---
 libexec/nuageinit/tests/nuageinit.sh | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libexec/nuageinit/tests/nuageinit.sh b/libexec/nuageinit/tests/nuageinit.sh
index 926233bcf66d..42c95e1b2abd 100644
--- a/libexec/nuageinit/tests/nuageinit.sh
+++ b/libexec/nuageinit/tests/nuageinit.sh
@@ -173,16 +173,17 @@ EOF
 config2_pubkeys_body()
 {
 	here=$(pwd)
+	export NUAGE_FAKE_ROOTDIR=$(pwd)
 	if [ $(id -u) -ne 0 ]; then
 		atf_skip "root required"
 	fi
 	mkdir -p media/nuageinit
-	cat > media/nuageinit/meta_data.json << EOF
-{
-   "public_keys": {
-       "mykey": "ssh-rsa AAAAB3NzaC1y...== Generated by Nova"
-   },
-}
+	touch media/nuageinit/meta_data.json
+	cat > media/nuageinit/user-data << EOF
+#cloud-config
+
+ssh_authorized_keys:
+  - "ssh-rsa AAAAB3NzaC1y...== Generated by Nova"
 EOF
 	mkdir -p etc
 	cat > etc/master.passwd <<EOF
@@ -194,7 +195,6 @@ EOF
 wheel:*:0:root
 users:*:1:
 EOF
-	export NUAGE_FAKE_ROOTDIR=$(pwd)
 	atf_check /usr/libexec/nuageinit ${here}/media/nuageinit config-2
 	atf_check -o inline:"ssh-rsa AAAAB3NzaC1y...== Generated by Nova\n" cat home/freebsd/.ssh/authorized_keys
 }

From nobody Wed Jun  5 09:29:11 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvMbq6bgkz5MJRh;
	Wed, 05 Jun 2024 09:29:11 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvMbq5m1hz4RZQ;
	Wed,  5 Jun 2024 09:29:11 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717579751;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=w/VBgXBfnIoZecyIHDEoFWVonA5hWgc2say8E+FgEgk=;
	b=pNx/jej8f92locwM0XxaLqpr3AdGuJLLa6GsndNJundcN4K9YaFjF2wHw+MyC3xa/S2GOS
	2lnEXqX+IteGCHqKdXrH2vec+iDiKtHkuCt1dojQx4FHc8XCjy39QbugOM6hiI5sUvdNZd
	o2Dgxu6rUju6sxitaaqf8RwrvQicR+w1a3QRqjLq9KKCTQHNBR18RgJ/i0b0PC0wbdK/I1
	2h+dRLoFAycCJw4snEznUztYJ83nVDBS1Kl0I6t1gFAs56fTnapKEHvgMmBJxcEq1fa4T+
	shqrgHKbgjdKec+8ZWoKRtzonaOEZ+6y+yCFNjc+qAaSwIM25Bx0O1zhuEKoYg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717579751; a=rsa-sha256; cv=none;
	b=Rkrd5TCq0xOdDJUNHPtZlTpltxxCgmnaPSKMnMKxaU9MOMxGeoaBkFygi3geBPvKvqG853
	FcR4QmsULMa8l0t9nsQG9ldJnoaS7kW+6IpEw03/feUbqe/eA7Wx1GshIzaCNWrK0Wzda2
	cq41bFkDLowC8T/834gk5rLF5NjbJrY5hxTYrC92kVOgxP3DfxIHRaQEfOaGkDPMXeNO2e
	01dZ0qIWvbKbhK+mRGVn98cq161ArKVOf64EIvijv9ivwtr0JLZP55s+KKbhIoyreBSLPE
	tL+KBahfNC7ao1YwzkrpQt5hvZD5tOO/AnSjat4hjMxHhP7bKoKdakbAe4dc9A==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717579751;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=w/VBgXBfnIoZecyIHDEoFWVonA5hWgc2say8E+FgEgk=;
	b=Zu4/Hb4fLQsi6HElxnNrdMzz6Tazy8013zO7yNWAYAmn2im5Uhz8LzocP3Dp//YifYIyx8
	LN9NDwiDtqVVhG8fthOgviadkGBjCxC37u69VhIVhWE5AMBMsE/laph3ZSfxZCb1t/6R6h
	1liC94Gcu3b3kiPZmuKpeDxSmA3C8zIVNHccr0noSM4m2xSPZIi2uvyKl7GjnxaWvzB9LX
	u9mXQfUNM5jxJUJFfN23ZxXOh2CcS8WIDX+z/Q5cQLpkX99IEy7fL9Q/3WmpKqjLvzxZtS
	PfFs1GEoWT7dR4jmXZsB0tnCTjoqtcl7eXASnI9NSu+8kR7Gb3BboxRuT43WNw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvMbq5JkTzwmH;
	Wed,  5 Jun 2024 09:29:11 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4559TBhS027229;
	Wed, 5 Jun 2024 09:29:11 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4559TBSV027226;
	Wed, 5 Jun 2024 09:29:11 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 09:29:11 GMT
Message-Id: <202406050929.4559TBSV027226@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Andrew Turner <andrew@FreeBSD.org>
Subject: git: 361da40536d7 - main - arm64: Disable outling atomics
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: andrew
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 361da40536d7f6fc6c06d54b261c299d170ccf2f
Auto-Submitted: auto-generated

The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=361da40536d7f6fc6c06d54b261c299d170ccf2f

commit 361da40536d7f6fc6c06d54b261c299d170ccf2f
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-04 12:45:00 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-06-05 09:23:40 +0000

    arm64: Disable outling atomics
    
    We don't have the symbols for this. The virtio randon number driver
    uses a C11 atomic operation. With inline atomics this is translated to
    an Armv8.0 atomic operation, with outling atomics this becomes a
    function call to a handler. As we don't have the needed function the
    kernel fails to link.
    
    Fix by disabling outline atomics for now.
    
    Reviewed by:    brooks, imp
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D45301
---
 sys/conf/kern.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk
index d51aa1f1dfa9..106f09d80ac1 100644
--- a/sys/conf/kern.mk
+++ b/sys/conf/kern.mk
@@ -143,6 +143,8 @@ CFLAGS += -mgeneral-regs-only
 CFLAGS += -ffixed-x18
 # Build with BTI+PAC
 CFLAGS += -mbranch-protection=standard
+# TODO: support outline atomics
+CFLAGS += -mno-outline-atomics
 INLINE_LIMIT?=	8000
 .endif
 

From nobody Wed Jun  5 09:29:12 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvMbs33Jzz5MJcG;
	Wed, 05 Jun 2024 09:29:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvMbs15Nxz4Rhs;
	Wed,  5 Jun 2024 09:29:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717579753;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Rqjbrvfa0UzZXS+vCaMENMw65y5bSWIKjDcRzY7wG9I=;
	b=b/IastnKbpr9afk0gJ10LkcbmXOXTVBMXuMmu3UZVKmPjnrSkAXCL9sHeAeSszTIfrRTAt
	Yp3/eLgJqsPrlfIAQBG+5QF3w72yBgPxbYaukD/QBk79AP9N93MqwCxny1MRdc2zC1bjDT
	DFNKA1zFsJvRZZ9huae5mERUeLztPHXzLO/6m6c+ea7398CD1xtVOzsnkQGwKu8c1KVKak
	+Qzm8ibsTZdXqmHNWt1cQM+Si1dKxzeRMpEox0MrWG3Ghs4aut9KQflogK68YROMhJBG97
	tbNbA7jOaqHIXlZdtXFVy8njCd2cwwfy/G39SwH8bPcl8P0JYGhr5Qsrdc9haA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717579753; a=rsa-sha256; cv=none;
	b=oshXwoDUXCYwE32tWyb6vSOZ/cNVYHI6X70J57lHa9IWEPkcK1btdefEk8qepcazIXQNZk
	74DGGSko0rQuZNfbl+5ClJsx4L2p8GIAzN5usWHGdnxBYQJVq9BO+/DaU7BvuH8Jm8f91r
	hiTUSv7ybFFLbe4ZboZuxdco/0CXe2Q2eKBa1dZ27rsHm89iB8HSl5x1BnydcDuunUJtFw
	uaclX7R2McCOwXRhRmLbulrsg+G0Qe1khhrBGRn9uS6XQXNkUaNcKXivIURmGsZGCHIPjk
	uUjkuNIqDgMq4JizKKo+lpCISoLv/kmOgdLuW13vIxJPsUqfq3GHeL4TTsogMw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717579753;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Rqjbrvfa0UzZXS+vCaMENMw65y5bSWIKjDcRzY7wG9I=;
	b=PnF0gbRYYw6g60e55Us76sIqK7YJqfCHDTwjUvPBh4lAcMz0OCcw+oesCaWrOTkOeHtNVU
	N+7b0rdVCJkCLDyPdvshEWj+a/usPAF7vxiH6Ng0BDoaalDiUWQDsi/kRukTdpyvGt6fA8
	NmFwSmd6w5iP+4WPBY6G5a+gTS1fuEXNqOTWUSNGpHDg2o66wMIOkZscWa4hTT09TviN0t
	qAkH+cz0f02qG6yIGmu4Zpg+GnFEvLY/forpwrFY93AWo3sPFaLVZj+0fvBMyU4OYz1QBd
	SI80/Jgs5EUpygo783xk6Kat/jSMuB4taQmiKAHl97QjxBkCyOCRAozOpsMHzA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvMbs01Zrzwy5;
	Wed,  5 Jun 2024 09:29:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4559TCqV027281;
	Wed, 5 Jun 2024 09:29:12 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4559TCcA027278;
	Wed, 5 Jun 2024 09:29:12 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 09:29:12 GMT
Message-Id: <202406050929.4559TCcA027278@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Andrew Turner <andrew@FreeBSD.org>
Subject: git: a5affc0c4cab - main - stats: Fix the build under gcc
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: andrew
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: a5affc0c4cabb59cceca98c4099fc9acc6a05dda
Auto-Submitted: auto-generated

The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=a5affc0c4cabb59cceca98c4099fc9acc6a05dda

commit a5affc0c4cabb59cceca98c4099fc9acc6a05dda
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-04 12:46:33 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-06-05 09:23:40 +0000

    stats: Fix the build under gcc
    
    Reviewed by:    brooks, imp
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D45302
---
 sys/kern/subr_stats.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/kern/subr_stats.c b/sys/kern/subr_stats.c
index 9fb8f8cbd74b..e6e70f8c6e31 100644
--- a/sys/kern/subr_stats.c
+++ b/sys/kern/subr_stats.c
@@ -295,7 +295,7 @@ static const bool vsd_compoundtype[VSD_NUM_DTYPES] = {
 
 const struct voistatdata_numeric numeric_limits[2][VSD_DTYPE_Q_U64 + 1] = {
 	[LIM_MIN] = {
-		[VSD_DTYPE_VOISTATE] = {0},
+		[VSD_DTYPE_VOISTATE] = {},
 		[VSD_DTYPE_INT_S32] = {.int32 = {.s32 = INT32_MIN}},
 		[VSD_DTYPE_INT_U32] = {.int32 = {.u32 = 0}},
 		[VSD_DTYPE_INT_S64] = {.int64 = {.s64 = INT64_MIN}},
@@ -308,7 +308,7 @@ const struct voistatdata_numeric numeric_limits[2][VSD_DTYPE_Q_U64 + 1] = {
 		[VSD_DTYPE_Q_U64] = {.q64 = {.uq64 = 0}},
 	},
 	[LIM_MAX] = {
-		[VSD_DTYPE_VOISTATE] = {0},
+		[VSD_DTYPE_VOISTATE] = {},
 		[VSD_DTYPE_INT_S32] = {.int32 = {.s32 = INT32_MAX}},
 		[VSD_DTYPE_INT_U32] = {.int32 = {.u32 = UINT32_MAX}},
 		[VSD_DTYPE_INT_S64] = {.int64 = {.s64 = INT64_MAX}},

From nobody Wed Jun  5 09:29:13 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvMbt2pV6z5MJYr;
	Wed, 05 Jun 2024 09:29:14 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvMbt0YZXz4Rff;
	Wed,  5 Jun 2024 09:29:14 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717579754;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=JqYL+fNnZYwyRQvcEyu0vn90atIDcJjpVU/elkkxCl4=;
	b=NG/Mu1p3qsDiUBdntc3QHN1poP9z37PcHKGaS13oispikNCAaKqVQclfYUFuTdvM/+lAbS
	hK1XwbfLmRW1jqpU8n4Z11hYN+W4BBNcBt5XHHzvdGaxpGjXCPU8WZxpH1ocqrlx02jSvF
	JaUMDNib8y9FZrct2aSoCHxIAC5cny7PWnXA4MLDOI+lFUovRNgLmz/izvjeJayIFhONjJ
	AsizwALbZtr6dFlEB7DcEJ3xqJvzKel8lVhAKk9z+ZOzuFAwWxNLhsUdvoqpVrCbcWTsFj
	ATIGPAycEIErFDOjSRK0pAlEhz2bJZPbQrcXWMKlJ1YzOD9bcr0luWEUqEWi8Q==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717579754; a=rsa-sha256; cv=none;
	b=Tsfy7zwEPpSElVsT6QVxucWdobRH258ASCdjZrd79mP+1rO99Atc6nQ/ORiz+T2bQdMj+J
	eAc9Mr7mOyW8DF+Q4r0kWA0Yq8jiaHi7nQE3s58+wLpvYC0+GZi86ITgslkrEfvzW4KR+M
	cZhO4Pj6Oax3cQaEJ6chDvC3+dtn6ss83s8xuuidtXgO8B7ioTE5GjYJ+NQcm3jfqRfR7B
	U6wNqSMKbz5mqneUaZSmFmtnjbOX06PtroYYn9UWqrcsBLYi7WVdHQ3WZtdENHlpnnff6a
	Uu6mAbIK+S7BVY/NsjBDRZx7+dmNKJn4eZ1x4gGNln9EFzLrTnPX9YL/Ouj7fw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717579754;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=JqYL+fNnZYwyRQvcEyu0vn90atIDcJjpVU/elkkxCl4=;
	b=Sq+iC8H5RNaFvsPCIpGPFZzCCmTYVWJlrdkjmpAnc3OuzYdzzzfVLdN2mpEJLXWvB/6nh4
	uihmgcHaLOAopcqv6PZQ2HYnb8DXkthULWp0nS9A2aiYNAAwSBpwkKtCy5V4GhMnVxCqlr
	8qRCXozM+mc3Ie4tZvHJr6QGoae5sCJuCEkqjd70K3wHHNK5xH/iL5k63Sj0kWuYa2QDz1
	oeCnVTWnTR5hk83W+pzW9xTEX/KIx1LC5ld7oUWYh9NI8szAEaJb87MeoHlhV/lB4Di1B1
	X5iznQ4a2+nhpzeuPoWz1x1HiEK+bamUN8+PniXlWSMZIseKmClSE6sWEPLcyw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvMbt03VczwmJ;
	Wed,  5 Jun 2024 09:29:14 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4559TDPx027335;
	Wed, 5 Jun 2024 09:29:13 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4559TDiC027332;
	Wed, 5 Jun 2024 09:29:13 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 09:29:13 GMT
Message-Id: <202406050929.4559TDiC027332@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Andrew Turner <andrew@FreeBSD.org>
Subject: git: c2e0d56f5e49 - main - arm64: Support BTI checking in
  most of the kernel
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: andrew
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: c2e0d56f5e493a8514324fd5e062ddc99a68b599
Auto-Submitted: auto-generated

The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=c2e0d56f5e493a8514324fd5e062ddc99a68b599

commit c2e0d56f5e493a8514324fd5e062ddc99a68b599
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-04 12:46:46 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-06-05 09:23:40 +0000

    arm64: Support BTI checking in most of the kernel
    
    LLD has the -zbti-report=error argument to check if the BTI note is
    present when linking. To allow for this to be used when linking the
    kernel and modules:
     - Add the BTI note to the remaining assembly files
     - Mark ptrauth.c as protected by BTI
     - Disable -zbti-report for vmm hypervisor switching code as it's not
       used there.
    
    The linux64 module doesn't build with the flag as it includes vdso code
    that doesn't include the note.
    
    Reviewed by:    imp, kib, emaste
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D45466
---
 sys/arm64/arm64/bus_space_asm.S          | 4 ++++
 sys/arm64/arm64/copyinout.S              | 5 ++++-
 sys/arm64/arm64/cpufunc_asm.S            | 4 ++++
 sys/arm64/arm64/exception.S              | 3 +++
 sys/arm64/arm64/hyp_stub.S               | 4 ++++
 sys/arm64/arm64/locore.S                 | 3 +++
 sys/arm64/arm64/memcmp.S                 | 3 +++
 sys/arm64/arm64/memcpy.S                 | 3 +++
 sys/arm64/arm64/memset.S                 | 4 ++++
 sys/arm64/arm64/sigtramp.S               | 3 +++
 sys/arm64/arm64/strcmp.S                 | 3 +++
 sys/arm64/arm64/strncmp.S                | 3 +++
 sys/arm64/arm64/support.S                | 4 ++++
 sys/arm64/arm64/swtch.S                  | 3 +++
 sys/arm64/vmm/vmm_call.S                 | 3 +++
 sys/arm64/vmm/vmm_hyp_el2.S              | 5 +++++
 sys/cddl/dev/dtrace/aarch64/dtrace_asm.S | 3 +++
 sys/conf/files.arm64                     | 2 +-
 sys/dev/psci/smccc_arm64.S               | 5 +++++
 sys/kern/firmw.S                         | 6 ++++++
 sys/modules/vmm/Makefile                 | 2 +-
 21 files changed, 72 insertions(+), 3 deletions(-)

diff --git a/sys/arm64/arm64/bus_space_asm.S b/sys/arm64/arm64/bus_space_asm.S
index bc9b41f96952..699a27bedab4 100644
--- a/sys/arm64/arm64/bus_space_asm.S
+++ b/sys/arm64/arm64/bus_space_asm.S
@@ -25,7 +25,9 @@
  *
  */
 
+#include <sys/elf_common.h>
 #include <machine/asm.h>
+
 ENTRY(generic_bs_r_1)
 	ldrb	w0, [x1, x2]
 	ret
@@ -475,3 +477,5 @@ generic_bs_poke_8f:
 	mov	x0, #0
 	ret
 END(generic_bs_poke_8)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/copyinout.S b/sys/arm64/arm64/copyinout.S
index 23f56ae85daa..26dd0b4cf14f 100644
--- a/sys/arm64/arm64/copyinout.S
+++ b/sys/arm64/arm64/copyinout.S
@@ -27,9 +27,10 @@
  *
  */
 
-#include <machine/asm.h>
+#include <sys/elf_common.h>
 #include <sys/errno.h>
 
+#include <machine/asm.h>
 #include <machine/param.h>
 #include <machine/vmparam.h>
 
@@ -220,3 +221,5 @@ ending:
 	mov	x0, xzr		/* return 0 */
 	ret
 	.size	copycommon, . - copycommon
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/cpufunc_asm.S b/sys/arm64/arm64/cpufunc_asm.S
index 5a668aeb542e..a13b97c2cdee 100644
--- a/sys/arm64/arm64/cpufunc_asm.S
+++ b/sys/arm64/arm64/cpufunc_asm.S
@@ -29,7 +29,9 @@
  *
  */
 
+#include <sys/elf_common.h>
 #include <sys/errno.h>
+
 #include <machine/asm.h>
 #include <machine/param.h>
 
@@ -190,3 +192,5 @@ ENTRY(cache_maint_fault)
 	mov	x0, #EFAULT
 	ret
 END(cache_maint_fault)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S
index 41d7e7f7ae1f..662684588e0c 100644
--- a/sys/arm64/arm64/exception.S
+++ b/sys/arm64/arm64/exception.S
@@ -25,6 +25,8 @@
  *
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 #include <machine/armreg.h>
 #include "assym.inc"
@@ -324,3 +326,4 @@ exception_vectors:
 	vempty 0		/* FIQ 32-bit EL0 */
 	vector el0_serror 0	/* Error 32-bit EL0 */
 
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/hyp_stub.S b/sys/arm64/arm64/hyp_stub.S
index 42f76da95062..ee486edf67a0 100644
--- a/sys/arm64/arm64/hyp_stub.S
+++ b/sys/arm64/arm64/hyp_stub.S
@@ -24,6 +24,8 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 
 .macro vempty
@@ -63,3 +65,5 @@ hyp_stub_vectors:
 	vempty			/* IRQ 32-bit EL1 */
 	vempty			/* FIQ 32-bit EL1 */
 	vempty			/* SError 32-bit EL1 */
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S
index fffebe8f2b02..d1120e0476a2 100644
--- a/sys/arm64/arm64/locore.S
+++ b/sys/arm64/arm64/locore.S
@@ -26,6 +26,7 @@
 
 #include "assym.inc"
 #include "opt_kstack_pages.h"
+#include <sys/elf_common.h>
 #include <sys/syscall.h>
 #include <machine/asm.h>
 #include <machine/armreg.h>
@@ -1006,3 +1007,5 @@ aarch32_esigcode:
 	.global sz_aarch32_sigcode
 sz_aarch32_sigcode:
 	.quad aarch32_esigcode - aarch32_sigcode
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/memcmp.S b/sys/arm64/arm64/memcmp.S
index 8517a181f3f3..19f577f218e0 100644
--- a/sys/arm64/arm64/memcmp.S
+++ b/sys/arm64/arm64/memcmp.S
@@ -9,6 +9,8 @@
  * ARMv8-a, AArch64, unaligned accesses.
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 
 #define L(l) .L ## l
@@ -134,3 +136,4 @@ L(byte_loop):
 
 END (memcmp)
 
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/memcpy.S b/sys/arm64/arm64/memcpy.S
index b394d6c1d30a..01daa8e1c228 100644
--- a/sys/arm64/arm64/memcpy.S
+++ b/sys/arm64/arm64/memcpy.S
@@ -11,6 +11,8 @@
  *
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 
 #define L(l) .L ## l
@@ -240,3 +242,4 @@ L(copy64_from_start):
 END(memcpy)
 EEND(memmove)
 
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/memset.S b/sys/arm64/arm64/memset.S
index ec434493ce13..f52bfd62cc54 100644
--- a/sys/arm64/arm64/memset.S
+++ b/sys/arm64/arm64/memset.S
@@ -31,6 +31,8 @@
  *
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 
 #define dstin		x0
@@ -195,3 +197,5 @@ ENTRY(memset)
 	b.ne	.Ltail_maybe_long
 	ret
 END(memset)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/sigtramp.S b/sys/arm64/arm64/sigtramp.S
index f1936e695f33..3f1bb42c269f 100644
--- a/sys/arm64/arm64/sigtramp.S
+++ b/sys/arm64/arm64/sigtramp.S
@@ -27,6 +27,7 @@
  */
 
 #include "assym.inc"
+#include <sys/elf_common.h>
 #include <sys/syscall.h>
 #include <machine/asm.h>
 
@@ -57,3 +58,5 @@ esigcode:
 	.global	szsigcode
 szsigcode:
 	.quad	esigcode - sigcode
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/strcmp.S b/sys/arm64/arm64/strcmp.S
index 0d66aae07d9e..d31576bbcf34 100644
--- a/sys/arm64/arm64/strcmp.S
+++ b/sys/arm64/arm64/strcmp.S
@@ -12,6 +12,8 @@
  * MTE compatible.
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 
 #define L(l) .L ## l
@@ -187,3 +189,4 @@ L(done):
 
 END (strcmp)
 
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/strncmp.S b/sys/arm64/arm64/strncmp.S
index 595de0312678..1b475b4ce449 100644
--- a/sys/arm64/arm64/strncmp.S
+++ b/sys/arm64/arm64/strncmp.S
@@ -11,6 +11,8 @@
  * MTE compatible.
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 
 #define L(l) .L ## l
@@ -305,3 +307,4 @@ L(ret0):
 	ret
 END(strncmp)
 
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/support.S b/sys/arm64/arm64/support.S
index bb93cfd521e1..2d067c7f7730 100644
--- a/sys/arm64/arm64/support.S
+++ b/sys/arm64/arm64/support.S
@@ -29,6 +29,8 @@
  *
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 #include <machine/setjmp.h>
 #include <machine/param.h>
@@ -387,3 +389,5 @@ ENTRY(pagezero_cache)
 	ret
 
 END(pagezero_cache)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S
index 9c43de3a9eae..ca00d473fd47 100644
--- a/sys/arm64/arm64/swtch.S
+++ b/sys/arm64/arm64/swtch.S
@@ -33,6 +33,8 @@
 #include "opt_kstack_pages.h"
 #include "opt_sched.h"
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 #include <machine/armreg.h>
 .macro clear_step_flag pcbflags, tmp
@@ -277,3 +279,4 @@ ENTRY(savectx)
 	ret
 END(savectx)
 
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/vmm/vmm_call.S b/sys/arm64/vmm/vmm_call.S
index fc28e3f173eb..8caf0465f938 100644
--- a/sys/arm64/vmm/vmm_call.S
+++ b/sys/arm64/vmm/vmm_call.S
@@ -28,6 +28,7 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/elf_common.h>
 
 #include <machine/asm.h>
 
@@ -37,3 +38,5 @@ ENTRY(vmm_call_hyp)
 	hvc	#0
 	ret
 END(vmm_call_hyp)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/arm64/vmm/vmm_hyp_el2.S b/sys/arm64/vmm/vmm_hyp_el2.S
index 7012e238c9c8..0ba040ee7bad 100644
--- a/sys/arm64/vmm/vmm_hyp_el2.S
+++ b/sys/arm64/vmm/vmm_hyp_el2.S
@@ -28,6 +28,9 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/elf_common.h>
+
+#include <machine/asm.h>
 #include <machine/param.h>
 
 	.section .rodata
@@ -37,3 +40,5 @@ vmm_hyp_code:
 	.incbin "vmm_hyp_blob.bin"
 	.globl vmm_hyp_code_end
 vmm_hyp_code_end:
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S b/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S
index 3984d12bf67b..a934733251a3 100644
--- a/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S
+++ b/sys/cddl/dev/dtrace/aarch64/dtrace_asm.S
@@ -29,6 +29,7 @@
 
 #include <sys/cpuvar_defs.h>
 #include <sys/dtrace.h>
+#include <sys/elf_common.h>
 
 #include <machine/armreg.h>
 #include <machine/asm.h>
@@ -172,3 +173,5 @@ ENTRY(dtrace_casptr)
 2:	mov	x0, x3		/* Return the value loaded from target */
 	RET
 END(dtrace_casptr)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index 8139a7af8ed3..26f9eaf193af 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -65,7 +65,7 @@ arm64/arm64/nexus.c				standard
 arm64/arm64/ofw_machdep.c			optional fdt
 arm64/arm64/pl031_rtc.c				optional fdt pl031
 arm64/arm64/ptrauth.c				standard \
-	compile-with	"${NORMAL_C:N-mbranch-protection*}"
+	compile-with	"${NORMAL_C:N-mbranch-protection*} -mbranch-protection=bti"
 arm64/arm64/pmap.c				standard
 arm64/arm64/ptrace_machdep.c			standard
 arm64/arm64/sigtramp.S				standard
diff --git a/sys/dev/psci/smccc_arm64.S b/sys/dev/psci/smccc_arm64.S
index 25a64669fab3..2a3c09ec26b2 100644
--- a/sys/dev/psci/smccc_arm64.S
+++ b/sys/dev/psci/smccc_arm64.S
@@ -30,7 +30,10 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
+
 .macro arm_smccc_1_0	insn
 ENTRY(arm_smccc_\insn)
 	\insn	#0
@@ -84,3 +87,5 @@ END(arm_smccc_1_2_\insn)
  */
 arm_smccc_1_2	hvc
 arm_smccc_1_2	smc
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/kern/firmw.S b/sys/kern/firmw.S
index f0377c4e0584..cd808d4a9396 100644
--- a/sys/kern/firmw.S
+++ b/sys/kern/firmw.S
@@ -45,3 +45,9 @@ FIRMW_START(FIRMW_SYMBOL):
 	.type	FIRMW_END(FIRMW_SYMBOL), %object
 FIRMW_END(FIRMW_SYMBOL):
 	.size	FIRMW_END(FIRMW_SYMBOL), . - FIRMW_END(FIRMW_SYMBOL)
+
+#if defined(__aarch64__)
+#include <machine/asm.h>
+#include <sys/elf_common.h>
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
+#endif
diff --git a/sys/modules/vmm/Makefile b/sys/modules/vmm/Makefile
index a98f0f27e25b..6737d868f2ea 100644
--- a/sys/modules/vmm/Makefile
+++ b/sys/modules/vmm/Makefile
@@ -50,7 +50,7 @@ vmm_hyp.o: vmm_hyp.c
 
 vmm_hyp_blob.elf.full:	vmm_hyp_exception.o vmm_hyp.o
 	${LD} -m ${LD_EMULATION} -Bdynamic -T ${SYSDIR}/conf/ldscript.arm64 \
-	    ${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \
+	    ${_LDFLAGS:N-zbti-report*} --no-warn-mismatch --warn-common --export-dynamic \
 	    --dynamic-linker /red/herring -X -o ${.TARGET} ${.ALLSRC} \
 	    --defsym=_start='0x0' --defsym=text_start='0x0'
 

From nobody Wed Jun  5 09:29:15 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvMbv2Nmhz5MJWQ;
	Wed, 05 Jun 2024 09:29:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvMbv1q1Lz4Rfg;
	Wed,  5 Jun 2024 09:29:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717579755;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=KZjJjEYE5/ezAPLGPKTeEw8Y6CASYvTn3rw8G7Ns3IA=;
	b=gt3X2mnxt2d7YVbHS6HxK3MEFAFudFRPFr6tEi/oC6ru78hSIAEmTTNpaDZtXUpm1yzNaa
	qwrt4Ic6hCl82VdoqeRKPinJWp499XR9bnlnR7mrt3q/X9pbR0vZby2f4xTxljLBVHkx3x
	IKBRXq3k9YbHGQFhuA3snuojsthWTIQfVFwZDbrKqV7Qjon/DMq0JCX/7J2683vZywoHwZ
	edkQeJomgiFCa6RjfIfo7gTKslLAI+1HeW5J4pNfG6bGoay5Te0J7un8+2Z9/5SMvSFHoY
	VxUvIW8UwXhZIwURlp0AFkhLjDNUk1t8R7RtLdMrX7TF0JSu4g1a+uMM5aQq9g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717579755; a=rsa-sha256; cv=none;
	b=tGyksgXfpkBRjpw3YIvxsdFyLd1mYVSplfBpGf9xRcXf/J+aeoC3D4g4osWqUf7vZu1Exb
	KbIUGDs2JeVtgN2qYGEmK00RLLD6vmdRnzouoB7GgQGmgTSis4ZdXyLY4S4NsPND2Ibhuj
	ayo/n8qt0Vu2Q1cFDl2uT7wTUogjwE4p64uLHNVagvYRCi5J23//r/oLsTpXdtRucdyxuu
	dkOYc07941H6nGf0/9cXrxq5NFqWv2dg7z4l4jpHqWIQdJ3YIT8+Z/pKSDG8XxU4zMFRbb
	uX3WfEN+s12yr2rTbPBd8IkyKl47JzJAjo8my0uLbnvy/Db2NIcWjN9cvBiO+A==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717579755;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=KZjJjEYE5/ezAPLGPKTeEw8Y6CASYvTn3rw8G7Ns3IA=;
	b=dWZ/0FuZue95PVzdi6oHF8j901yI8xcFVU9P5dKlwm7LWPsz2XdS5vFZoHOkQCP+P1qR+R
	RBliEEK650V+12b+NGZY31ySaahBy+EBurKmwnT65/+x9DhLKMm7DD3bCkOSXkA/UjsAsY
	1MT9sKRafsoX/k5zCWFF/bfuDopH49s9jAas2JeadlTc3ibgLatXm0ju1+dQi+nTCgBQhT
	hlKfYf5XscrRI8tEIycfyW/ypFZAJREOgXesYYc1ObAeHNhmLlFrs6wEehOWASBY1fIlPt
	Utf3EyVJKVASQGu1kIV45mGVhiTCnHcMyaTQtgOBf+9g61acs07lelkOK5xn/A==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvMbv17RFzwmK;
	Wed,  5 Jun 2024 09:29:15 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4559TFWC027389;
	Wed, 5 Jun 2024 09:29:15 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4559TFj0027386;
	Wed, 5 Jun 2024 09:29:15 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 09:29:15 GMT
Message-Id: <202406050929.4559TFj0027386@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Andrew Turner <andrew@FreeBSD.org>
Subject: git: bed65d85c631 - main - linux64: Fix the build on arm64
  with bti checking
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: andrew
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: bed65d85c631c3a8e60a81a15a5a745c8ef92fbe
Auto-Submitted: auto-generated

The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=bed65d85c631c3a8e60a81a15a5a745c8ef92fbe

commit bed65d85c631c3a8e60a81a15a5a745c8ef92fbe
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-04 12:47:52 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-06-05 09:23:40 +0000

    linux64: Fix the build on arm64 with bti checking
    
    When we enable checking for BTI on arm64 we need to include an ELF
    note in all object files linked into a module.
    
    As using objcopy from a binary to an ELF object file doesn't add the
    note switch to using .incbin from an assembly file. This allows us to
    add the needed note without affecting the included object.
    
    Reviewed by:    imp, kib, emaste
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D45468
---
 sys/arm64/linux/linux_support.S   |  4 ++++
 sys/compat/linux/linux_vdso_inc.S | 39 +++++++++++++++++++++++++++++++++++++++
 sys/modules/linux64/Makefile      | 17 +++--------------
 3 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/sys/arm64/linux/linux_support.S b/sys/arm64/linux/linux_support.S
index 151ede7e1c19..3b16583e9d54 100644
--- a/sys/arm64/linux/linux_support.S
+++ b/sys/arm64/linux/linux_support.S
@@ -26,6 +26,8 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/elf_common.h>
+
 #include <machine/asm.h>
 #include <machine/param.h>
 #include <machine/vmparam.h>
@@ -172,3 +174,5 @@ ENTRY(futex_xorl)
 	str w4, [x2]
 	ret
 END(futex_xorl)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/sys/compat/linux/linux_vdso_inc.S b/sys/compat/linux/linux_vdso_inc.S
new file mode 100644
index 000000000000..af10907f0b60
--- /dev/null
+++ b/sys/compat/linux/linux_vdso_inc.S
@@ -0,0 +1,39 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 Arm Ltd
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+	.section .rodata
+	.globl _binary_linux_vdso_so_o_start
+_binary_linux_vdso_so_o_start:
+	.incbin "linux_vdso.so.o"
+	.globl _binary_linux_vdso_so_o_end
+_binary_linux_vdso_so_o_end:
+
+#if defined(__aarch64__)
+#include <sys/elf_common.h>
+#include <machine/asm.h>
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
+#endif
diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile
index 62e3b464d39f..beed5ec59c4b 100644
--- a/sys/modules/linux64/Makefile
+++ b/sys/modules/linux64/Makefile
@@ -35,7 +35,8 @@ SRCS=	linux_dummy_machdep.c \
 	bus_if.h \
 	device_if.h \
 	vnode_if.h \
-	linux_support.S
+	linux_support.S \
+	linux_vdso_inc.S
 .if ${MACHINE_CPUARCH} == "amd64"
 SRCS+=	linux_dummy_x86.c
 .endif
@@ -47,7 +48,6 @@ SRCS+=  opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
 CLEANFILES=	linux_assym.h linux_genassym.o linux_locore.o \
 		genassym.o linux_vdso_gtod.o linux_vdso.so.o
 
-OBJS=	linux_vdso.so
 
 linux_assym.h: linux_genassym.o
 	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
@@ -83,18 +83,7 @@ linux_vdso.so.o: linux_locore.o linux_vdso_gtod.o
 	-T${SRCTOP}/sys/${MACHINE}/linux/linux_vdso.lds.s \
 	-o ${.TARGET} ${.ALLSRC:M*.o}
 
-.if ${MACHINE_CPUARCH} == "aarch64"
-OBJCOPY_TARGET=--output-target elf64-littleaarch64 --binary-architecture aarch64
-.elif ${MACHINE_CPUARCH} == "amd64"
-OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-64
-.else
-.error ${MACHINE_CPUARCH} not yet supported by linux64
-.endif
-
-linux_vdso.so: linux_vdso.so.o
-	${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \
-	    linux_vdso.so.o ${.TARGET}
-	${STRIPBIN} -N _binary_linux_vdso_so_o_size ${.TARGET}
+linux_vdso_inc.o: linux_vdso.so.o
 
 linux_support.o: linux_support.S assym.inc linux_assym.h
 	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \

From nobody Wed Jun  5 12:04:40 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvR3D5sfDz5Mk4g;
	Wed, 05 Jun 2024 12:04:40 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvR3D5NXPz4kDY;
	Wed,  5 Jun 2024 12:04:40 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717589080;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=WOgr7Mhxah5DrD88gvgnxfNfQZfUgMvQ3uaAYL7aoMg=;
	b=S8xe4eSxKZAVqWuz+IfdwrvD40M02fivqJDEu3ytlF7g6ttfQWHFPZpsUWNn7o5/2JSvHa
	+ugTvTm91yCj2mZpfcK70hBU9AV5i/Uo/BgQr1aBn8STH9nFTsNyaDIBJEGPviUFQmMI9u
	AlwSfFOANjVZRG0CfWyTlpLd6EcSv0vXqTZ6vTwa4SvTT0tgC4Vlc0frKcI2/c5aDQk2vn
	FrTZ7B/QDbEWGpkoQV/q551t1lOgGNIVeElhrIPUSLNkgUewOB8yH2X7Fg7NXDWnjXeRIy
	eeRMyEOOdL8GaJmNXDZ6LrBxK+glABBr3178vakVpuJ759AhbQfYMYmXRfy0tw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717589080; a=rsa-sha256; cv=none;
	b=hpm3Acui9pG3A/0dtaVc8Uq4XFbsGPseEOAP1yDzmE2gXR/SMIMRnVX/yuvnuSIMENFBSx
	jPQ5MyO1edOc/N1kjIHW9Exz0iUVToY8bmYll9+9cK8CiY9mv08tF7lc81NgroRuGSMT17
	I5HZ1XjdNho+PP19t7LSbaADJmenesirV8RaZJDKHR5zG+6M8XBJsP8EYnu0FZm3cSegjL
	SE9v4PB51l6GHISPph+OmGViBqSG5kWn1cUptpJVQ+lswtPeMs3Ng6r7nRq3MTmb0i4XMC
	ETwUh/+HlQJzEYXvHXVGcMjqyZmDJkOgu9bnTzVIxZxKkthwi2c41nHFvBTgsQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717589080;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=WOgr7Mhxah5DrD88gvgnxfNfQZfUgMvQ3uaAYL7aoMg=;
	b=ANv0e9i12x+I0+n6fF0GQxN5yRrNZPScC6R/EGZIiiZVwwPa5TjslHXfMdrJg7cwzQ+wMT
	cjVxCmV3NidbvHreDtV5V7MZqStPTldaqY4QINM3YIllHRWuEesSTWnk03xLgIJrIpiCT2
	g8hN9yt1uinhKSeMk5lSm8zCtwXlwCoVLLf8w/71aSpw20Ikh1VX/FwmOX8ZFcTm/VNbdx
	fGwtLpyqMsoHOidz3F4DuXTQGwFqctOEXZaDtA8PoRYOQ3uimcoDb4tgRIdHMivwOT5jgr
	QismN5oN5qzqJ4/v7kuaguBcOD3KBqbhEHasfkSm962QpUWjEM9aM2HZuq9aog==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvR3D4rJWz1185;
	Wed,  5 Jun 2024 12:04:40 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455C4eHJ098229;
	Wed, 5 Jun 2024 12:04:40 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455C4et4098226;
	Wed, 5 Jun 2024 12:04:40 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 12:04:40 GMT
Message-Id: <202406051204.455C4et4098226@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Zhenlei Huang <zlei@FreeBSD.org>
Subject: git: 4eb82e65a73f - main - hidbus(4): Fix wrong assertion
  of bus
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: zlei
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 4eb82e65a73f6cd180700bb8ae47227a553f94ed
Auto-Submitted: auto-generated

The branch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=4eb82e65a73f6cd180700bb8ae47227a553f94ed

commit 4eb82e65a73f6cd180700bb8ae47227a553f94ed
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-06-05 12:03:27 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-06-05 12:03:27 +0000

    hidbus(4): Fix wrong assertion of bus
    
    Reviewed by:    wulf
    Fixes:          4151ac9f1292 hidbus(4): Use generic hid methods to ...
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D45496
---
 sys/dev/hid/hidbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c
index 99bfd7715c24..f50abd4b0a4d 100644
--- a/sys/dev/hid/hidbus.c
+++ b/sys/dev/hid/hidbus.c
@@ -604,7 +604,7 @@ hidbus_set_intr(device_t child, hid_intr_t *handler, void *context)
 static int
 hidbus_intr_start(device_t bus, device_t child)
 {
-	MPASS(bus = device_get_parent(child));
+	MPASS(bus == device_get_parent(child));
 	struct hidbus_softc *sc = device_get_softc(bus);
 	struct hidbus_ivars *ivar = device_get_ivars(child);
 	struct hidbus_ivars *tlc;
@@ -630,7 +630,7 @@ hidbus_intr_start(device_t bus, device_t child)
 static int
 hidbus_intr_stop(device_t bus, device_t child)
 {
-	MPASS(bus = device_get_parent(child));
+	MPASS(bus == device_get_parent(child));
 	struct hidbus_softc *sc = device_get_softc(bus);
 	struct hidbus_ivars *ivar = device_get_ivars(child);
 	struct hidbus_ivars *tlc;

From nobody Wed Jun  5 12:38:39 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvRpR56P7z5Mq4p;
	Wed, 05 Jun 2024 12:38:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvRpR4XcGz4nc9;
	Wed,  5 Jun 2024 12:38:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717591119;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=VMzfyZzaybEPFNGZH8Ge8rql6eWQHVc+XzOOf85yZmU=;
	b=MIMz0CYzmR/aSDkDGocqxEasS6gDvfNYdkFqaH34KCWPH+iC3Dwd39lnHYKDHKfIoJGLkQ
	1RxShPBzYS48J/qXBmbkeXpXCZTHO4ApnbbePOdSdfp1TPN57uzCSC37ZvNn133m5NKSiw
	wYkgdSjpLN5aH/xNt/m8xTYu2j95wpu8gT6bIaEbboDqsIYEX4GdL2xvSI/ykH+GrU3KJn
	PoeBaN43tiD+iq/6Ma3tXEif2rajWQL3m66hVq5jvqgZDPgNDzkmezAf6ri5fa3bl6dekn
	Yi5IqErLTb33RexBBRVP3RMRROWeyVXb3F1Wk7OEw1J3fQdnlJb0MYX2QqdFeA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717591119; a=rsa-sha256; cv=none;
	b=X4lHGixuh4dX3vARao3Xv1HlJISvs2XYK+neHxR0d8oTfo+abFaM55xXly5UX853QFkbfx
	yvSap5j+u5yE96mHw0mxo1M8GQPdxr4nPubbFa4oDGI8ee0qYwis0wCOtftvEFdIbL/xIq
	Xj1gBY26petvSGW/ChnPMVHhEm7oyciJP0ldI1gne4zmQz38ElWTKuhNXhASwaLCGITfOO
	GvQVFHP83vk7abF0YG358KHDwVtXmC7qlnC1gqSi0dlGkguUHVeZbhomwRL/+nNXppqTkz
	jsSa56zGBDKF6tNbxwJqiH6ceGf+xoiAOiIbyUXRMvcA1TxgtPCiNtCG/QIUEw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717591119;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=VMzfyZzaybEPFNGZH8Ge8rql6eWQHVc+XzOOf85yZmU=;
	b=JQCg6SAKdrubCU4VUgYbm20PY+Fj48lTe8mZQwPn8V3ZdXP6tUgvcVQUKVYOlkwNRxvQjV
	DsIwbI9/bEyRhRuKnY96Y1WCP1HCkrzhq2GN2FeMyrTfUMW1zx7YMM178HJmk/ws3B/Ttj
	hVx0KrbWmv3z25cYd7jXeYC3mwukaB6NVv6n+9bFuRsuO4gcYrlPrl3Z/aCBF0dty5CSfO
	zqsWdreBVSDgInfPxB6N9cFm+aBTGC59XfluGmbJMiR1bIkyZmUfg7kUlTI1isDg+eUKCC
	mz8qD1CRU73qlNxsChO5cL9b3cGbWGgJVtVHAeeIryT19UnYbDT+f2YPK9nSiw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvRpR41bXz12qM;
	Wed,  5 Jun 2024 12:38:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455Ccd4b050232;
	Wed, 5 Jun 2024 12:38:39 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455CcdGB050229;
	Wed, 5 Jun 2024 12:38:39 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 12:38:39 GMT
Message-Id: <202406051238.455CcdGB050229@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Wei Hu <whu@FreeBSD.org>
Subject: git: bec000c9c1ef - main - amd64: add a func pointer to
  tlb shootdown function
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: whu
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: bec000c9c1ef409989685bb03ff0532907befb4a
Auto-Submitted: auto-generated

The branch main has been updated by whu:

URL: https://cgit.FreeBSD.org/src/commit/?id=bec000c9c1ef409989685bb03ff0532907befb4a

commit bec000c9c1ef409989685bb03ff0532907befb4a
Author:     Souradeep Chakrabarti <schakrabarti@microsoft.com>
AuthorDate: 2024-06-05 12:25:05 +0000
Commit:     Wei Hu <whu@FreeBSD.org>
CommitDate: 2024-06-05 12:25:05 +0000

    amd64: add a func pointer to tlb shootdown function
    
    Make the tlb shootdown function as a pointer. By default, it still
    points to the system function smp_targeted_tlb_shootdown(). It allows
    other implemenations to overwrite in the future.
    
    Reviewed by:    kib
    Tested by:      whu
    Authored-by:    Souradeep Chakrabarti <schakrabarti@microsoft.com>
    Co-Authored-by: Erni Sri Satya Vennela <ernis@microsoft.com>
    MFC after:      1 week
    Sponsored by:   Microsoft
    Differential Revision:  https://reviews.freebsd.org/D45174
---
 sys/amd64/amd64/mp_machdep.c | 27 ++++++---------------------
 sys/vm/pmap.h                | 27 +++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index d506ffada4b9..91737637b714 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -102,13 +102,16 @@ void *bootpcpu;
 
 extern u_int mptramp_la57;
 extern u_int mptramp_nx;
-
+smp_targeted_tlb_shootdown_t smp_targeted_tlb_shootdown = &smp_targeted_tlb_shootdown_native;
 /*
  * Local data and functions.
  */
 
 static int start_ap(int apic_id, vm_paddr_t boot_address);
 
+void
+smp_targeted_tlb_shootdown_native(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2,
+    smp_invl_cb_t curcpu_cb, enum invl_op_codes op);
 /*
  * Initialize the IPI handlers and start up the AP's.
  */
@@ -497,24 +500,6 @@ start_ap(int apic_id, vm_paddr_t boot_address)
  * Flush the TLB on other CPU's
  */
 
-/*
- * Invalidation request.  PCPU pc_smp_tlb_op uses u_int instead of the
- * enum to avoid both namespace and ABI issues (with enums).
- */
-enum invl_op_codes {
-      INVL_OP_TLB		= 1,
-      INVL_OP_TLB_INVPCID	= 2,
-      INVL_OP_TLB_INVPCID_PTI	= 3,
-      INVL_OP_TLB_PCID		= 4,
-      INVL_OP_PGRNG		= 5,
-      INVL_OP_PGRNG_INVPCID	= 6,
-      INVL_OP_PGRNG_PCID	= 7,
-      INVL_OP_PG		= 8,
-      INVL_OP_PG_INVPCID	= 9,
-      INVL_OP_PG_PCID		= 10,
-      INVL_OP_CACHE		= 11,
-};
-
 /*
  * These variables are initialized at startup to reflect how each of
  * the different kinds of invalidations should be performed on the
@@ -600,8 +585,8 @@ invl_scoreboard_slot(u_int cpu)
  * Function must be called with the thread pinned, and it unpins on
  * completion.
  */
-static void
-smp_targeted_tlb_shootdown(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2,
+void
+smp_targeted_tlb_shootdown_native(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2,
     smp_invl_cb_t curcpu_cb, enum invl_op_codes op)
 {
 	cpuset_t mask;
diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h
index 9101201287b2..c8ca6279031c 100644
--- a/sys/vm/pmap.h
+++ b/sys/vm/pmap.h
@@ -167,6 +167,33 @@ void		 pmap_unwire(pmap_t pmap, vm_offset_t start, vm_offset_t end);
 void		 pmap_zero_page(vm_page_t);
 void		 pmap_zero_page_area(vm_page_t, int off, int size);
 
+/*
+ * Invalidation request.  PCPU pc_smp_tlb_op uses u_int instead of the
+ * enum to avoid both namespace and ABI issues (with enums).
+ */
+enum invl_op_codes {
+	INVL_OP_TLB               = 1,
+	INVL_OP_TLB_INVPCID       = 2,
+	INVL_OP_TLB_INVPCID_PTI   = 3,
+	INVL_OP_TLB_PCID          = 4,
+	INVL_OP_PGRNG             = 5,
+	INVL_OP_PGRNG_INVPCID     = 6,
+	INVL_OP_PGRNG_PCID        = 7,
+	INVL_OP_PG                = 8,
+	INVL_OP_PG_INVPCID        = 9,
+	INVL_OP_PG_PCID           = 10,
+	INVL_OP_CACHE             = 11,
+};
+typedef void (*smp_invl_local_cb_t)(struct pmap *, vm_offset_t addr1,
+    vm_offset_t addr2);
+typedef void (*smp_targeted_tlb_shootdown_t)(pmap_t, vm_offset_t, vm_offset_t,
+    smp_invl_local_cb_t, enum invl_op_codes);
+
+extern void
+smp_targeted_tlb_shootdown_native(pmap_t, vm_offset_t, vm_offset_t,
+    smp_invl_local_cb_t, enum invl_op_codes);
+extern smp_targeted_tlb_shootdown_t smp_targeted_tlb_shootdown;
+
 #define	pmap_resident_count(pm)	((pm)->pm_stats.resident_count)
 #define	pmap_wired_count(pm)	((pm)->pm_stats.wired_count)
 

From nobody Wed Jun  5 13:40:51 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvTBC5tXZz5N078;
	Wed, 05 Jun 2024 13:40:51 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvTBC5QcWz4tkL;
	Wed,  5 Jun 2024 13:40:51 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717594851;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=n59Ph9oz7jSUGBay3DujiFOvDTZkxGZS25Kz5QqYDf4=;
	b=FJ0riVDe/VYxTGqkkTlWOSk39jd9xk+rePSS75tBGLo8BZX5YXy5+DVkA8SbturiVkORMy
	HZVvDrbMQciMJzCNpV9pJMzyeqWAXNXzcLOVMS6fhZEdnSFVfv1o+jmXNIFnHquO42iXcf
	uverIEPGnDlTdbwUIG1BTdq7MKaFa1K6PvNlQreMGcjL7AbcPZ5Z/+FZLut8iNPGu197jc
	zj/xHVPT8S152SwHI99PNzWJary1fH2buPJjNfvyDj44xUSWcMlaC+B5kvcEYac73WlSoU
	DBXqhA+fzRAhblBNAVJ9nhtcoCDzIUjRLWJsPPU+7rTyq1yWWfTXRSUtlVDMxA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717594851; a=rsa-sha256; cv=none;
	b=MijvVzduSnH0NCF2O23OtuaJLs3tjZ3vs7ezi8JaVw69dasPREhSFvxalwlwAHs6v8/k3J
	ZqRb6QvkFG7a5/Bk/dPY4e5oo5sw7Y9tcOHc9DWrsSZBNLmVoHfRtmkfC/81qmGdZ1Attk
	J/LGL2uwVc0wHgPObXGh5E2/TCAWeiFjIzYIuB1Fte2SbdfEPKfpSC/QSyRZq9H32ps+eD
	wG5p/n+7LXgKIQBE9fxaXE9cdLidhhHbnuHyaU+2SLGxLb0VrvzInPsxGKY7uuvvQ8hSyP
	VHnvnHm/itLARI3JVQY8IMyyJQSRhgLrc+qES28kFMgl4Wu5bJN9SDV5MfbXoA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717594851;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=n59Ph9oz7jSUGBay3DujiFOvDTZkxGZS25Kz5QqYDf4=;
	b=TMLlwm9QF0zEBbsdoq7rA1jAFo8Z8k4RH9Fc41QDVxqQ01chIdt9s6H/5F67jBpjs1bRjV
	1wEisVS+anGDJdf5Xqmo432Y+T5xE8mTpnBl4dvUTntq/b/cfhLyohZhf3zYOaDVOj0sdd
	qdAcJ264cwon2G1ijHBdo/1TMr7WHCMmOUCc6dcKtSGN064DkpZ7DzNKdhU1C/1Ir7jxP9
	1lCp+xYr7xMyrQO5EDwRIT5UVF2RRes4FAXYRIBgeSzQSCk6CgAmXihFn7KLqlZViwvegs
	BPwd0o7xONRpbZunEmiXvqpRRUTcZKUlxJj+foSNXzJqxN0ikFxgc+kH5Z5Qhw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvTBC525Bz13tW;
	Wed,  5 Jun 2024 13:40:51 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455Dep6T060596;
	Wed, 5 Jun 2024 13:40:51 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455Depcl060593;
	Wed, 5 Jun 2024 13:40:51 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 13:40:51 GMT
Message-Id: <202406051340.455Depcl060593@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ruslan Bukin <br@FreeBSD.org>
Subject: git: 03b330e1916f - main - riscv: add stage 2 translation
  to pmap.
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: br
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 03b330e1916f468b16f7dbd0b7bd67b567a1eb1e
Auto-Submitted: auto-generated

The branch main has been updated by br:

URL: https://cgit.FreeBSD.org/src/commit/?id=03b330e1916f468b16f7dbd0b7bd67b567a1eb1e

commit 03b330e1916f468b16f7dbd0b7bd67b567a1eb1e
Author:     Ruslan Bukin <br@FreeBSD.org>
AuthorDate: 2024-06-05 13:08:35 +0000
Commit:     Ruslan Bukin <br@FreeBSD.org>
CommitDate: 2024-06-05 13:36:57 +0000

    riscv: add stage 2 translation to pmap.
    
    Add basic stage 2 translation support (guest-physical to host-physical).
    
    RISC-V hypervisor spec[1] introduces new translation schemes: Sv32x4,
    Sv39x4, Sv48x4 and Sv57x4.
    In each case, the size of the incoming address is widened by 2 bits (e.g.
    Sv39 becomes 41-bit system).
    To accommodate the 2 extra bits, the root page table (only) is expanded
    by a factor of four to be 16 KiB instead of the usual 4 KiB. The rest of
    page table system (including PTE format) is similar.
    This gives us 4x of memory space in each scheme, but it does not make sense
    to support all that memory for now.
    Allocate required amount of pages for the top directory in case of stage 2,
    but leave it unused.
    
    1. https://github.com/riscv/riscv-isa-manual/blob/main/src/hypervisor.adoc
    
    Reviewed by:    mhorne
    Sponsored by:   UKRI
    Differential Revision:  https://reviews.freebsd.org/D45481
---
 sys/riscv/include/pmap.h |  8 ++++++++
 sys/riscv/riscv/pmap.c   | 46 +++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h
index e10cbacb6e1f..8123231144bb 100644
--- a/sys/riscv/include/pmap.h
+++ b/sys/riscv/include/pmap.h
@@ -67,6 +67,12 @@ struct md_page {
 	vm_memattr_t		pv_memattr;
 };
 
+enum pmap_stage {
+	PM_INVALID,
+	PM_STAGE1,
+	PM_STAGE2,
+};
+
 struct pmap {
 	struct mtx		pm_mtx;
 	struct pmap_statistics	pm_stats;	/* pmap statictics */
@@ -76,6 +82,7 @@ struct pmap {
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
 	LIST_ENTRY(pmap)	pm_list;	/* List of all pmaps */
 	struct vm_radix		pm_root;
+	enum pmap_stage		pm_stage;
 };
 
 typedef struct pmap *pmap_t;
@@ -134,6 +141,7 @@ vm_paddr_t pmap_kextract(vm_offset_t va);
 void	pmap_kremove(vm_offset_t);
 void	pmap_kremove_device(vm_offset_t, vm_size_t);
 void	*pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma);
+int	pmap_pinit_stage(pmap_t, enum pmap_stage);
 bool	pmap_page_is_mapped(vm_page_t m);
 bool	pmap_ps_enabled(pmap_t);
 
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
index 0bdf3be8ea39..8176975b049c 100644
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -632,6 +632,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen)
 
 	/* Set this early so we can use the pagetable walking functions */
 	kernel_pmap_store.pm_top = (pd_entry_t *)l1pt;
+	kernel_pmap_store.pm_stage = PM_STAGE1;
 	PMAP_LOCK_INIT(kernel_pmap);
 	TAILQ_INIT(&kernel_pmap->pm_pvchunk);
 	vm_radix_init(&kernel_pmap->pm_root);
@@ -1324,6 +1325,7 @@ pmap_pinit0(pmap_t pmap)
 {
 	PMAP_LOCK_INIT(pmap);
 	bzero(&pmap->pm_stats, sizeof(pmap->pm_stats));
+	pmap->pm_stage = PM_STAGE1;
 	pmap->pm_top = kernel_pmap->pm_top;
 	pmap->pm_satp = pmap_satp_mode() |
 	    (vtophys(pmap->pm_top) >> PAGE_SHIFT);
@@ -1334,23 +1336,35 @@ pmap_pinit0(pmap_t pmap)
 }
 
 int
-pmap_pinit(pmap_t pmap)
+pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage)
 {
 	vm_paddr_t topphys;
-	vm_page_t mtop;
+	vm_page_t m;
 	size_t i;
 
-	mtop = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO |
-	    VM_ALLOC_WAITOK);
+	/*
+	 * Top directory is 4 pages in hypervisor case.
+	 * Current address space layout makes 3 of them unused.
+	 */
+	if (stage == PM_STAGE1)
+		m = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO |
+		    VM_ALLOC_WAITOK);
+	else
+		m = vm_page_alloc_noobj_contig(VM_ALLOC_WIRED | VM_ALLOC_ZERO,
+		    4, 0, ~0ul, L2_SIZE, 0, VM_MEMATTR_DEFAULT);
 
-	topphys = VM_PAGE_TO_PHYS(mtop);
+	topphys = VM_PAGE_TO_PHYS(m);
 	pmap->pm_top = (pd_entry_t *)PHYS_TO_DMAP(topphys);
 	pmap->pm_satp = pmap_satp_mode() | (topphys >> PAGE_SHIFT);
+	pmap->pm_stage = stage;
 
 	bzero(&pmap->pm_stats, sizeof(pmap->pm_stats));
 
 	CPU_ZERO(&pmap->pm_active);
 
+	if (stage == PM_STAGE2)
+		goto finish;
+
 	if (pmap_mode == PMAP_MODE_SV39) {
 		/*
 		 * Copy L1 entries from the kernel pmap.  This must be done with
@@ -1371,12 +1385,20 @@ pmap_pinit(pmap_t pmap)
 		pmap->pm_top[i] = kernel_pmap->pm_top[i];
 	}
 
+finish:
 	TAILQ_INIT(&pmap->pm_pvchunk);
 	vm_radix_init(&pmap->pm_root);
 
 	return (1);
 }
 
+int
+pmap_pinit(pmap_t pmap)
+{
+
+	return (pmap_pinit_stage(pmap, PM_STAGE1));
+}
+
 /*
  * This routine is called if the desired page table page does not exist.
  *
@@ -1609,6 +1631,8 @@ void
 pmap_release(pmap_t pmap)
 {
 	vm_page_t m;
+	int npages;
+	int i;
 
 	KASSERT(pmap->pm_stats.resident_count == 0,
 	    ("pmap_release: pmap resident count %ld != 0",
@@ -1616,15 +1640,23 @@ pmap_release(pmap_t pmap)
 	KASSERT(CPU_EMPTY(&pmap->pm_active),
 	    ("releasing active pmap %p", pmap));
 
+	if (pmap->pm_stage == PM_STAGE2)
+		goto finish;
+
 	if (pmap_mode == PMAP_MODE_SV39) {
 		mtx_lock(&allpmaps_lock);
 		LIST_REMOVE(pmap, pm_list);
 		mtx_unlock(&allpmaps_lock);
 	}
 
+finish:
+	npages = pmap->pm_stage == PM_STAGE2 ? 4 : 1;
 	m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_top));
-	vm_page_unwire_noq(m);
-	vm_page_free(m);
+	for (i = 0; i < npages; i++) {
+		vm_page_unwire_noq(m);
+		vm_page_free(m);
+		m++;
+	}
 }
 
 static int

From nobody Wed Jun  5 13:56:33 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvTXL0glvz5N1xd;
	Wed, 05 Jun 2024 13:56:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvTXL04BYz3xMf;
	Wed,  5 Jun 2024 13:56:34 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717595794;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=l/naSpP4eZioUNeznk5pV3SfILfndF0Q0Q6seitstm4=;
	b=MXCvQB3HCzqs8KY+TQayPyiR2x3ZetYMVccK/CkNv9wNCkfOf/JS5gPzuVj6W+nYF/SMY9
	XO+tvDx7f3r7FuOk8sSc8XvVA/gO6S6n6RzqXTHYYRyJ7vrLr1NNEX8dRQZJXOMPvkr2En
	KnmD+RvH0g/wW+rS0mtP5W3U/DLMPokSMRvz+lgewgkxvCVxtaSK/OMsJ3JoBZrczc2L3F
	8sOBsIqlFsixiPRZBr5t20lD6/zFHx16azleG/CXnezDr3J3mVbB6X4HDf/7j0vOxS3Uva
	yP2BC/2X4DlwmZaBMuPZs2Rgg5wMXP3xpMVlfQoN5TzjRa2WxBeGx+ua+nxBzA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717595794; a=rsa-sha256; cv=none;
	b=TrMBYSnp/jfQ0wUseGDFcoxzY9dZCgFVvF4oUDTnlw42ISlp5onPJvrGEYYh6OXrCV2W27
	v5meRztwr51OFXCKT89jWjtzupQtn7g16nARtPhsPp/7AwDUmPjfGps2znzn/+hKbksH1P
	XazdYaw3bXHJ8fGHwIxCJo2aWT5KGwbJmk1QrUc7emCSzmDlBTqxHYIA+lBGJaRahT3F5Q
	b83UVLEqfQ3ZTiRqwTZvANpQtFahhiy5KYLVd/9KdRUsq7HxMD0DENG8+t2gsyiUBN2c+V
	NtduTbdAonetagfSatbIA+qBu0VVuDWslwDu/LupXFFfxijNKFHO7ZSyM8D/6w==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717595794;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=l/naSpP4eZioUNeznk5pV3SfILfndF0Q0Q6seitstm4=;
	b=UK/hgOPItsBXsrT8qN93FvyPZTMp9cPOx1JRffdXJfvlfDS1p8HpJc9pSAQLlupzkxkehX
	0CKNj66ItA7MxFCBzUgiRxzQiM02qSlqgMIqwDP5XMDcuykovfu0ZjWEDfxB5wbbsco/gX
	5+80amlowU4FIlqmfaK2w23tD+TAc+VM9F/fbjV4huEjhMZv7t2KZlq1DD62bX1WW2VBbJ
	JlPOanYWDdKXU1nkT3eJC+GWqoUzLpY/8pM8XSc34UlkCSHSQk2ennodvFAZ2lDRJxUAvP
	bepsM+POPjr7w+dZ/wLpXasjmP99U8YRJ1Ac2JPZnOhUFksh1MuZbX4qP7zP4Q==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvTXK6d93z14f4;
	Wed,  5 Jun 2024 13:56:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455DuXGf084129;
	Wed, 5 Jun 2024 13:56:33 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455DuXOB084126;
	Wed, 5 Jun 2024 13:56:33 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 13:56:33 GMT
Message-Id: <202406051356.455DuXOB084126@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Enji Cooper <ngie@FreeBSD.org>
Subject: git: 637ee1391957 - main - pci(4): unbreak the build
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ngie
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 637ee1391957acb3ae0f68aef3e2fad76a5ae338
Auto-Submitted: auto-generated

The branch main has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=637ee1391957acb3ae0f68aef3e2fad76a5ae338

commit 637ee1391957acb3ae0f68aef3e2fad76a5ae338
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2024-06-05 04:16:48 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2024-06-05 13:55:33 +0000

    pci(4): unbreak the build
    
    `argsp` is not defined in `generic_pcie_unmap_resource(..)`. Remove the
    parameter passed to `bus_generic_unmap_resource(..)` as this parameter
    is never passed to `generic_pcie_unmap_resource(..)`.
    
    Fixes:  98056127ddfa ("acpi/pci/vmd: Fix a nit with nested resource mapping requests")
    Reported by:    Jenkins (aarch64, armv6, armv7, etc)
    Differential Revision:  https://reviews.freebsd.org/D45493
---
 sys/dev/pci/pci_host_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
index d97a7597df25..c3dba9d72484 100644
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -666,7 +666,7 @@ generic_pcie_unmap_resource(device_t dev, device_t child, struct resource *r,
 	case SYS_RES_MEMORY:
 		break;
 	default:
-		return (bus_generic_unmap_resource(dev, child, r, argsp, map));
+		return (bus_generic_unmap_resource(dev, child, r, map));
 	}
 
 	range = generic_pcie_containing_range(dev, type, rman_get_start(r),

From nobody Wed Jun  5 15:37:14 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvWmY53rGz5NGhG;
	Wed, 05 Jun 2024 15:37:17 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33])
	(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 4VvWmY2xQFz4DSB;
	Wed,  5 Jun 2024 15:37:17 +0000 (UTC)
	(envelope-from cy.schubert@cschubert.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: from shw-obgw-4004a.ext.cloudfilter.net ([10.228.9.227])
	by cmsmtp with ESMTPS
	id ErKqsggx3drxEEshQsSXYL; Wed, 05 Jun 2024 15:37:16 +0000
Received: from spqr.komquats.com ([70.66.152.170])
	by cmsmtp with ESMTPSA
	id EshOsKl4RWhyfEshPsnzS1; Wed, 05 Jun 2024 15:37:16 +0000
X-Auth-User: cschuber
X-Authority-Analysis: v=2.4 cv=MenPuI/f c=1 sm=1 tr=0 ts=6660862c
 a=y8EK/9tc/U6QY+pUhnbtgQ==:117 a=y8EK/9tc/U6QY+pUhnbtgQ==:17
 a=kj9zAlcOel0A:10 a=T1WGqf2p2xoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8
 a=EkcXrb_YAAAA:8 a=fY2H276N9kE6I-Hg-AQA:9 a=CjuIK1q_8ugA:10
 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22
Received: from slippy.cwsent.com (slippy [10.1.1.91])
	by spqr.komquats.com (Postfix) with ESMTP id 7B48FE4;
	Wed, 05 Jun 2024 08:37:14 -0700 (PDT)
Received: by slippy.cwsent.com (Postfix, from userid 1000)
	id 5161218F; Wed, 05 Jun 2024 08:37:14 -0700 (PDT)
X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.8+dev
Reply-to: Cy Schubert <Cy.Schubert@cschubert.com>
From: Cy Schubert <Cy.Schubert@cschubert.com>
X-os: FreeBSD
X-Sender: cy@cwsent.com
X-URL: http://www.cschubert.com/
To: Andrew Turner <andrew@FreeBSD.org>
cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
    dev-commits-src-main@FreeBSD.org
Subject: Re: git: bed65d85c631 - main - linux64: Fix the build on arm64 
 with bti checking
In-reply-to: <202406050929.4559TFj0027386@gitrepo.freebsd.org>
References: <202406050929.4559TFj0027386@gitrepo.freebsd.org>
Comments: In-reply-to Andrew Turner <andrew@FreeBSD.org>
   message dated "Wed, 05 Jun 2024 09:29:15 +0000."
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Wed, 05 Jun 2024 08:37:14 -0700
Message-Id: <20240605153714.5161218F@slippy.cwsent.com>
X-CMAE-Envelope: MS4xfEim+Co7LYoPti2XYqU28nerNhMDY5vmlrA+NOSkFK8vfFEkTzYw89nzdrAexpLfCX3JPyl5VbsgvTk6tBt2piaMAty+EpifvqhrwajRsWqkqcPR/EVQ
 bKcxHyvbjo5jzqyHr+eNSEjW2xaEX2J5Kt5qDwIiAuNXnQjyfrjufgw6g1pqVbaIIw/Bq0fizbGzxTCc3nf/nHam19ZPYjTEeCtm663gUMOAJe7c6ZPlo42y
 Q9zJLM/jcpfv6/N/nSKUAUoXC9KfaypMHnrUfqKpK9jdW7LjYLJdONlguId3KmUqWyTKjYClwBpuZiOIiPaLr2OZkP8g2zXLblfkN4qGkJA=
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:16509, ipnet:3.96.0.0/15, country:US]
X-Rspamd-Queue-Id: 4VvWmY2xQFz4DSB

In message <202406050929.4559TFj0027386@gitrepo.freebsd.org>, Andrew Turner 
wri
tes:
> The branch main has been updated by andrew:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=bed65d85c631c3a8e60a81a15a5a745c
> 8ef92fbe
>
> commit bed65d85c631c3a8e60a81a15a5a745c8ef92fbe
> Author:     Andrew Turner <andrew@FreeBSD.org>
> AuthorDate: 2024-06-04 12:47:52 +0000
> Commit:     Andrew Turner <andrew@FreeBSD.org>
> CommitDate: 2024-06-05 09:23:40 +0000
>
>     linux64: Fix the build on arm64 with bti checking
>     
>     When we enable checking for BTI on arm64 we need to include an ELF
>     note in all object files linked into a module.
>     
>     As using objcopy from a binary to an ELF object file doesn't add the
>     note switch to using .incbin from an assembly file. This allows us to
>     add the needed note without affecting the included object.
>     
>     Reviewed by:    imp, kib, emaste
>     Sponsored by:   Arm Ltd
>     Differential Revision:  https://reviews.freebsd.org/D45468
> ---
>  sys/arm64/linux/linux_support.S   |  4 ++++
>  sys/compat/linux/linux_vdso_inc.S | 39 +++++++++++++++++++++++++++++++++++++
> ++
>  sys/modules/linux64/Makefile      | 17 +++--------------
>  3 files changed, 46 insertions(+), 14 deletions(-)
>
> diff --git a/sys/arm64/linux/linux_support.S b/sys/arm64/linux/linux_support.
> S
> index 151ede7e1c19..3b16583e9d54 100644
> --- a/sys/arm64/linux/linux_support.S
> +++ b/sys/arm64/linux/linux_support.S
> @@ -26,6 +26,8 @@
>   * SUCH DAMAGE.
>   */
>  
> +#include <sys/elf_common.h>
> +
>  #include <machine/asm.h>
>  #include <machine/param.h>
>  #include <machine/vmparam.h>
> @@ -172,3 +174,5 @@ ENTRY(futex_xorl)
>  	str w4, [x2]
>  	ret
>  END(futex_xorl)
> +
> +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
> diff --git a/sys/compat/linux/linux_vdso_inc.S b/sys/compat/linux/linux_vdso_
> inc.S
> new file mode 100644
> index 000000000000..af10907f0b60
> --- /dev/null
> +++ b/sys/compat/linux/linux_vdso_inc.S
> @@ -0,0 +1,39 @@
> +/*-
> + * SPDX-License-Identifier: BSD-2-Clause
> + *
> + * Copyright (C) 2020 Arm Ltd
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOS
> E
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIA
> L
> + * 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, STRIC
> T
> + * 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.
> + */
> +
> +	.section .rodata
> +	.globl _binary_linux_vdso_so_o_start
> +_binary_linux_vdso_so_o_start:
> +	.incbin "linux_vdso.so.o"
> +	.globl _binary_linux_vdso_so_o_end
> +_binary_linux_vdso_so_o_end:
> +
> +#if defined(__aarch64__)
> +#include <sys/elf_common.h>
> +#include <machine/asm.h>
> +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
> +#endif
> diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile
> index 62e3b464d39f..beed5ec59c4b 100644
> --- a/sys/modules/linux64/Makefile
> +++ b/sys/modules/linux64/Makefile
> @@ -35,7 +35,8 @@ SRCS=	linux_dummy_machdep.c \
>  	bus_if.h \
>  	device_if.h \
>  	vnode_if.h \
> -	linux_support.S
> +	linux_support.S \
> +	linux_vdso_inc.S
>  .if ${MACHINE_CPUARCH} == "amd64"
>  SRCS+=	linux_dummy_x86.c
>  .endif
> @@ -47,7 +48,6 @@ SRCS+=  opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h
>  CLEANFILES=	linux_assym.h linux_genassym.o linux_locore.o \
>  		genassym.o linux_vdso_gtod.o linux_vdso.so.o
>  
> -OBJS=	linux_vdso.so
>  
>  linux_assym.h: linux_genassym.o
>  	sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
> @@ -83,18 +83,7 @@ linux_vdso.so.o: linux_locore.o linux_vdso_gtod.o
>  	-T${SRCTOP}/sys/${MACHINE}/linux/linux_vdso.lds.s \
>  	-o ${.TARGET} ${.ALLSRC:M*.o}
>  
> -.if ${MACHINE_CPUARCH} == "aarch64"
> -OBJCOPY_TARGET=--output-target elf64-littleaarch64 --binary-architecture aar
> ch64
> -.elif ${MACHINE_CPUARCH} == "amd64"
> -OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-architecture i386:x86-6
> 4
> -.else
> -.error ${MACHINE_CPUARCH} not yet supported by linux64
> -.endif
> -
> -linux_vdso.so: linux_vdso.so.o
> -	${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \
> -	    linux_vdso.so.o ${.TARGET}
> -	${STRIPBIN} -N _binary_linux_vdso_so_o_size ${.TARGET}
> +linux_vdso_inc.o: linux_vdso.so.o
>  
>  linux_support.o: linux_support.S assym.inc linux_assym.h
>  	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
>

kldload linux64.ko results in the following panic on amd64. Reverting this 
revision addresses the regression.

Fatal trap 12: page fault while in kernel mode
cpuid = 2; apic id = 02
fault virtual address	= 0xffffffff824cd1df
fault code		= supervisor write data, protection violation
instruction pointer	= 0x20:0xffffffff824c49d9
stack pointer	        = 0x28:0xfffffe008ecc8a10
frame pointer	        = 0x28:0xfffffe008ecc8a50
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		= 4069 (kldload)
rdi: ffffffff824cd1d8 rsi: ffffffff824ce298 rdx: 000000000000000b
rcx: aaaaaaaaaaaaaaab  r8: 00000000000000c0  r9: fffffe00b3123bc0
rax: 0000000000000058 rbx: fffff801701a6c00 rbp: fffffe008ecc8a50
r10: fffff80006015800 r11: 0000000000000423 r12: fffff8002075c000
r13: ffffffff824cd4b0 r14: fffff8002075c000 r15: fffff800031d6a00
trap number		= 12
panic: page fault
cpuid = 2
time = 1717600139
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
0xfffffe008ecc8700
vpanic() at vpanic+0x13f/frame 0xfffffe008ecc8830
panic() at panic+0x43/frame 0xfffffe008ecc8890
trap_fatal() at trap_fatal+0x40b/frame 0xfffffe008ecc88f0
trap_pfault() at trap_pfault+0x46/frame 0xfffffe008ecc8940
calltrap() at calltrap+0x8/frame 0xfffffe008ecc8940
--- trap 0xc, rip = 0xffffffff824c49d9, rsp = 0xfffffe008ecc8a10, rbp = 
0xfffffe008ecc8a50 ---
elf64_linux_vdso_fixup() at elf64_linux_vdso_fixup+0x99/frame 
0xfffffe008ecc8a50
linux_vdso_install() at linux_vdso_install+0x53/frame 0xfffffe008ecc8a90
linker_load_module() at linker_load_module+0xc29/frame 0xfffffe008ecc8d80
kern_kldload() at kern_kldload+0x164/frame 0xfffffe008ecc8dd0
sys_kldload() at sys_kldload+0x5c/frame 0xfffffe008ecc8e00
amd64_syscall() at amd64_syscall+0x115/frame 0xfffffe008ecc8f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe008ecc8f30
--- syscall (304, FreeBSD ELF64, kldload), rip = 0x2959195a57da, rsp = 
0x295917b80438, rbp = 0x295917b809b0 ---
Uptime: 7m24s
Dumping 608 out of 8160 MB:..3%..11%..22%..32%..43%..53%..61%..71%..82%..92%
Dump complete
Automatic reboot in 15 seconds - press a key on the console to abort
acpi0: reset failed - timeout
Rebooting...
cpu_reset: Restarting BSP
cpu_reset_proxy: Stopped CPU 2


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0



From nobody Wed Jun  5 15:49:04 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvX2S4mGyz5NJdx;
	Wed, 05 Jun 2024 15:49:20 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvX2R6BTmz4GBn;
	Wed,  5 Jun 2024 15:49:19 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1f480624d10so1555ad.1;
        Wed, 05 Jun 2024 08:49:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1717602556; x=1718207356; darn=freebsd.org;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:from:to:cc:subject:date:message-id:reply-to;
        bh=EX9utdwYCrK8t5r7URdjS2PugxJ6kp8ZdztQRnY26WE=;
        b=H/4XBq5IkyQ2v4hTaTyVNRdCMtYFrot8nD65+FrGGuIJZ1P3wHGycWqxUk65CYXz/1
         he4OxKT0XxM5M1MG4mnv2h+NjFHBUEDSdNt3QAu5LyJwINRDftESNY89MlGliaKjbn56
         WJ+R1+wUtiDjoIur0TTo7/yiCHYxfDGuTJ2Zoc63+48ncN108riyUcT9c+wj8k0GjQda
         jIZmZpO6Ju+QWoKbhAjEHuvmMJDpQbFPim3Ctpd2pL6jDojF4whn0I+7K/yUn1h+lEvr
         BSEwYBot8n6wSynG55j0sFkPIAXcWIVljAt8+5Db68hbOWR9/IyrDHV0st3tRjSmsQhW
         9I9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717602556; x=1718207356;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
        bh=EX9utdwYCrK8t5r7URdjS2PugxJ6kp8ZdztQRnY26WE=;
        b=oaHDFTrSt/QhN895Y7npNLXtM5uSmiIGQ7oUedVbu26yV0C/R5Wr1jdyAtXY8pVAIM
         oSwCDLUvy2kLW+V1MSYAWIr/LtT88MqNOp1Q2tJApR9xy7MEoU2fWcYWzGU6i8nURgFD
         2qMQwd/yWhQTkm3njYq9NL+ebRp3ko7KmierNsm0Pj4jB9+0lD44mm9LsHpE8ofK8p3U
         hXvYyh/Lg490tvzJdS0ZQam/u9VxEcMtrMVpVgRYQ7naXDkzsQhCxPs2PSui8Pmky5DY
         aoTrViwhTCt0xsvHrByy40+PW62P6dLsceqQhm2/WmbfFyyosuUvYVKd94BBrsRAtL5J
         rgEA==
X-Forwarded-Encrypted: i=1; AJvYcCUPL3XLcpy0HtiLo569d0GyqTTpRCo6WeVqMH3dfSyoIcqimpH1u8EW8vcuOFxLjff+gGfzAbDCdXPPa5YmMw4/7WxmYQ19moUJz4u5Io80wy48hKEIyfO+ibVR/6rkn6BIdr0BzzxcdukQUnab8Q/0Vw==
X-Gm-Message-State: AOJu0YzpMHOazmIBgPNBuIt4yUmESpuNOwgRec76luv0rSMAsJuNNPWK
	ZpXYjmu1O3kVxMTOo8zx1WPqqKxXw69zVAEcwskSLT9+umIQBBoi5t92bg==
X-Google-Smtp-Source: AGHT+IEpjcgwFbUr9gGzJXoMY7SjgF+IHdOkY5oBxUrCx2Fj9uI69qqivmfBylSvfvA+C+yWm1tApw==
X-Received: by 2002:a17:903:1d0:b0:1f6:7a41:eeac with SMTP id d9443c01a7336-1f6a5a9b03cmr37335385ad.61.1717602555760;
        Wed, 05 Jun 2024 08:49:15 -0700 (PDT)
Received: from smtpclient.apple ([162.118.1.182])
        by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f677e4b819sm61604345ad.270.2024.06.05.08.49.15
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 05 Jun 2024 08:49:15 -0700 (PDT)
From: Enji Cooper <yaneurabeya@gmail.com>
Message-Id: <EFF41E75-E97A-4ED7-B439-839346C9951B@gmail.com>
Content-Type: multipart/signed;
	boundary="Apple-Mail=_F47BFFCE-A883-4C7A-BA09-83BBAA428F87";
	protocol="application/pgp-signature";
	micalg=pgp-sha256
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: git: bec000c9c1ef - main - amd64: add a func pointer to tlb
 shootdown function
Date: Wed, 5 Jun 2024 08:49:04 -0700
In-Reply-To: <202406051238.455CcdGB050229@gitrepo.freebsd.org>
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
To: Wei Hu <whu@FreeBSD.org>
References: <202406051238.455CcdGB050229@gitrepo.freebsd.org>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]
X-Rspamd-Queue-Id: 4VvX2R6BTmz4GBn


--Apple-Mail=_F47BFFCE-A883-4C7A-BA09-83BBAA428F87
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_13E3B6E0-5A6F-4504-982A-460B19959BDB"


--Apple-Mail=_13E3B6E0-5A6F-4504-982A-460B19959BDB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Jun 5, 2024, at 5:38=E2=80=AFAM, Wei Hu <whu@FreeBSD.org> wrote:
>=20
> The branch main has been updated by whu:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Dbec000c9c1ef409989685bb03ff05329=
07befb4a
>=20
> commit bec000c9c1ef409989685bb03ff0532907befb4a
> Author:     Souradeep Chakrabarti <schakrabarti@microsoft.com>
> AuthorDate: 2024-06-05 12:25:05 +0000
> Commit:     Wei Hu <whu@FreeBSD.org>
> CommitDate: 2024-06-05 12:25:05 +0000
>=20
>    amd64: add a func pointer to tlb shootdown function
>=20
>    Make the tlb shootdown function as a pointer. By default, it still
>    points to the system function smp_targeted_tlb_shootdown(). It =
allows
>    other implemenations to overwrite in the future.
>=20
>    Reviewed by:    kib
>    Tested by:      whu
>    Authored-by:    Souradeep Chakrabarti <schakrabarti@microsoft.com>
>    Co-Authored-by: Erni Sri Satya Vennela <ernis@microsoft.com>
>    MFC after:      1 week
>    Sponsored by:   Microsoft
>    Differential Revision:  https://reviews.freebsd.org/D45174

This broke the i386 build: =
https://ci.freebsd.org/job/FreeBSD-main-i386-build/28056/
Cheers,
-Enji


--Apple-Mail=_13E3B6E0-5A6F-4504-982A-460B19959BDB
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><br><div><blockquote type=3D"cite"><div>On Jun 5, =
2024, at 5:38=E2=80=AFAM, Wei Hu &lt;whu@FreeBSD.org&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div><div>The branch main has been =
updated by whu:<br><br>URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Dbec000c9c1ef409989685bb03ff05329=
07befb4a<br><br>commit =
bec000c9c1ef409989685bb03ff0532907befb4a<br>Author: =
&nbsp;&nbsp;&nbsp;&nbsp;Souradeep Chakrabarti =
&lt;schakrabarti@microsoft.com&gt;<br>AuthorDate: 2024-06-05 12:25:05 =
+0000<br>Commit: &nbsp;&nbsp;&nbsp;&nbsp;Wei Hu =
&lt;whu@FreeBSD.org&gt;<br>CommitDate: 2024-06-05 12:25:05 +0000<br><br> =
&nbsp;&nbsp;&nbsp;amd64: add a func pointer to tlb shootdown =
function<br><br> &nbsp;&nbsp;&nbsp;Make the tlb shootdown function as a =
pointer. By default, it still<br> &nbsp;&nbsp;&nbsp;points to the system =
function smp_targeted_tlb_shootdown(). It allows<br> =
&nbsp;&nbsp;&nbsp;other implemenations to overwrite in the =
future.<br><br> &nbsp;&nbsp;&nbsp;Reviewed by: &nbsp;&nbsp;&nbsp;kib<br> =
&nbsp;&nbsp;&nbsp;Tested by: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;whu<br> =
&nbsp;&nbsp;&nbsp;Authored-by: &nbsp;&nbsp;&nbsp;Souradeep Chakrabarti =
&lt;schakrabarti@microsoft.com&gt;<br> &nbsp;&nbsp;&nbsp;Co-Authored-by: =
Erni Sri Satya Vennela &lt;ernis@microsoft.com&gt;<br> =
&nbsp;&nbsp;&nbsp;MFC after: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 week<br> =
&nbsp;&nbsp;&nbsp;Sponsored by: &nbsp;&nbsp;Microsoft<br> =
&nbsp;&nbsp;&nbsp;Differential Revision: =
&nbsp;https://reviews.freebsd.org/D45174<br></div></div></blockquote><br><=
/div><div>This broke the i386 build:&nbsp;<a =
href=3D"https://ci.freebsd.org/job/FreeBSD-main-i386-build/28056/">https:/=
/ci.freebsd.org/job/FreeBSD-main-i386-build/28056/</a></div><div>Cheers,</=
div><div>-Enji</div><br></body></html>=

--Apple-Mail=_13E3B6E0-5A6F-4504-982A-460B19959BDB--

--Apple-Mail=_F47BFFCE-A883-4C7A-BA09-83BBAA428F87
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZgiPAACgkQGpE5DjPs
NJhYfw//Sc1G+GKvXTd0Uw99nAiTypdvohjWH0WaT4OjesOA5JPB6M/VcKPWVBQR
K7JGBmCTcCdC/zSpdgjP1i+BH5zMJwavAgqu6k9W29szFLr/D9SqQLrGJxTUCtoA
n6VOY5b3W4B2rV3UwM+zxrtWsH7b/IrkgDyuXRjDdRd1mgwzI/HufekGagMlH6DK
wPMOM+PFNbau1GfHiR3Tb5DK/HZ3xHLtfX47w6K/cWdygLc7JNC0YyEAJc8Po3f8
TLULki1tuLur2LLV7zTQsqKV1Bm00/wW0HeYKncn7+FY60eu9YLHFGCQa71ApEri
hy0qKoAxg0MXCI+X+BunZn9ET2Zycqy6CARMlv798zDQAYtMsNfRyIMGSKpa7CUd
ZKvZvJCM8n7Shk3J1HhjOz974Be+w/bChD1rNK0LcwREDzebrDqReopD9L1Y+P7T
mEyYJsYb5HD+knvCuvwBOaZQ8fzOZFxfE6nOy95hZibU+Z75l1N4gmDFzSVriLxp
KEOPiYxwA52VnguusE/Fhaip4c42ZffEWlXUngg9A8cz9veLZr5XpW0NhJn435Rx
sROw0KF8zwNzfKUlvHXIFvAENT1/szKCbJ+UJywOdjavZyRUOKVkuiE7UQ60tpvM
57VLO3JZxYoZNc++F1msZwlxGueuBexdv38nZAHgXoOSqc4COxE=
=P6Xm
-----END PGP SIGNATURE-----

--Apple-Mail=_F47BFFCE-A883-4C7A-BA09-83BBAA428F87--

From nobody Wed Jun  5 16:42:12 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvYCT0M4pz5LD6b;
	Wed, 05 Jun 2024 16:42:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvYCS7306z4MNW;
	Wed,  5 Jun 2024 16:42:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717605733;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=7cRzEHtJAz9t+lt6SncLsC6+8d+KLnY/sARRuHOtVhE=;
	b=q1mYIsRotDxDjviDahVnTHrvFZiw7ubE9aFz01iKHDL6kdI6/BvaeryBKra8uwmRlvcN1V
	/BCfiKIHVpG4H3OnulbUBFR5QqYyE0Ho2Mxc87v+JjlSeu3CmgDMCLaoInha62jhton52i
	P8mp9wBWghSK45xHRl0JmINOTk2VyvfxM6M9StdEKcNj4Gte8stck1C+IlUuH+zrSIQF0s
	ZueRY17EZHRKPpPdEhKXNvyVLByPk3qgihNsh9mmOIONYMjjVIvC2L3xFBjTn74CVbcBS3
	Of+BB0THHUvfgIWBM0HeUoIwKjF1aZP1SPKGcSBKD29G56518XYJpZBcw7r0JA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717605733; a=rsa-sha256; cv=none;
	b=UfK31Am32pA/ljSV7Nxuns/ahCh7m8/NJjojuPhIGXj9Ctx8fx0qDFvVb9MbrRQl1zHoZO
	Kd5snGk5MfhUGm+L89Vbl84tNwQTE2yqW+AdnH/k1D2pmr+8W9sxKLN0pHfWmnc/1EsAUu
	Pei0d/oMcd0Sg0E2BHFKyG9uL69MCPATLYK0uMXOS3HpcjZyY+8OJT5DTS5Ej9OQxX6xyy
	89Z3QnuC1aoR0unc3CiiQqmb6pQ+DlsHC1bOe+b9tlvIMaqAhkCv8wr56JZbnZDKYZNbEF
	+3mtHFBqRSbFF8WzWsEWmthcVdE9tC263gSu3RTGReAQagdm4xjFXOe3gotgyQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717605733;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=7cRzEHtJAz9t+lt6SncLsC6+8d+KLnY/sARRuHOtVhE=;
	b=fG8QeFgbTI8O+BQ5UfKkUZjcfMMEwWuJZjpyTcp3znbSFSjrQZfnRr0OlDlRacJ+tIK8Tw
	qFtcGB0+X9U6aA2X7Z2Bilhu+BAOpjDpRIB+Zqz6OcjVWsrIVXPkm18jVdgKZtRZItRxuj
	VU7nFh79I39runKQbeAsvOKuKIFpjIXVxudHFpQl1DxRU5HeXpvXwuXsQtvHl29RXt1fIh
	ZCzznCkwUA8TFq27ioUTSEZhnbjA6dPxCOR+Oi/y2ZTjOzC4F4ZI8aqvqqGidExFFg4MLn
	fNbIy86gpWfn+xDfJf64gjsLVai3Y8hdazXIiCigIWxAgKAzFekuHu01APbJdA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvYCS6fJqz18Sv;
	Wed,  5 Jun 2024 16:42:12 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455GgCdL069106;
	Wed, 5 Jun 2024 16:42:12 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455GgCo8069103;
	Wed, 5 Jun 2024 16:42:12 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 16:42:12 GMT
Message-Id: <202406051642.455GgCo8069103@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Jessica Clarke <jrtc27@FreeBSD.org>
Subject: git: 98200077809a - main - rtld-elf: Use a proper struct
  type for tlsdesc entries
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jrtc27
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 98200077809a0926ae1775e4d56dd02651131e88
Auto-Submitted: auto-generated

The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=98200077809a0926ae1775e4d56dd02651131e88

commit 98200077809a0926ae1775e4d56dd02651131e88
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2024-06-05 16:41:54 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2024-06-05 16:41:54 +0000

    rtld-elf: Use a proper struct type for tlsdesc entries
    
    This clarifies the code and makes it less error-prone. It also makes it
    easier to extend downstream in CheriBSD (where pointer and integer
    members no longer have the same representation and an additional member
    is present).
    
    Reviewed by:    jhb, kib
    Differential Revision:  https://reviews.freebsd.org/D45143
---
 libexec/rtld-elf/aarch64/reloc.c | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c
index 78e2e2b1aaae..5dfe19e3d4f4 100644
--- a/libexec/rtld-elf/aarch64/reloc.c
+++ b/libexec/rtld-elf/aarch64/reloc.c
@@ -183,7 +183,7 @@ struct tls_data {
 	Elf_Addr	tls_offs;
 };
 
-static Elf_Addr
+static struct tls_data *
 reloc_tlsdesc_alloc(int tlsindex, Elf_Addr tlsoffs)
 {
 	struct tls_data *tlsdesc;
@@ -193,18 +193,26 @@ reloc_tlsdesc_alloc(int tlsindex, Elf_Addr tlsoffs)
 	tlsdesc->tls_index = tlsindex;
 	tlsdesc->tls_offs = tlsoffs;
 
-	return ((Elf_Addr)tlsdesc);
+	return (tlsdesc);
 }
 
+struct tlsdesc_entry {
+	void	*(*func)(void *);
+	union {
+		Elf_Ssize	addend;
+		Elf_Size	offset;
+		struct tls_data	*data;
+	};
+};
+
 static void
-reloc_tlsdesc(const Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *where,
-    int flags, RtldLockState *lockstate)
+reloc_tlsdesc(const Obj_Entry *obj, const Elf_Rela *rela,
+    struct tlsdesc_entry *where, int flags, RtldLockState *lockstate)
 {
 	const Elf_Sym *def;
 	const Obj_Entry *defobj;
 	Elf_Addr offs;
 
-
 	offs = 0;
 	if (ELF_R_SYM(rela->r_info) != 0) {
 		def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, flags,
@@ -215,8 +223,8 @@ reloc_tlsdesc(const Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *where,
 		obj = defobj;
 		if (def->st_shndx == SHN_UNDEF) {
 			/* Weak undefined thread variable */
-			where[0] = (Elf_Addr)_rtld_tlsdesc_undef;
-			where[1] = rela->r_addend;
+			where->func = _rtld_tlsdesc_undef;
+			where->addend = rela->r_addend;
 			return;
 		}
 	}
@@ -224,12 +232,12 @@ reloc_tlsdesc(const Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *where,
 
 	if (obj->tlsoffset != 0) {
 		/* Variable is in initialy allocated TLS segment */
-		where[0] = (Elf_Addr)_rtld_tlsdesc_static;
-		where[1] = obj->tlsoffset + offs;
+		where->func = _rtld_tlsdesc_static;
+		where->offset = obj->tlsoffset + offs;
 	} else {
 		/* TLS offest is unknown at load time, use dynamic resolving */
-		where[0] = (Elf_Addr)_rtld_tlsdesc_dynamic;
-		where[1] = reloc_tlsdesc_alloc(obj->tlsindex, offs);
+		where->func = _rtld_tlsdesc_dynamic;
+		where->data = reloc_tlsdesc_alloc(obj->tlsindex, offs);
 	}
 }
 
@@ -289,8 +297,8 @@ reloc_plt(Obj_Entry *obj, int flags, RtldLockState *lockstate)
 			}
 			break;
 		case R_AARCH64_TLSDESC:
-			reloc_tlsdesc(obj, rela, where, SYMLOOK_IN_PLT | flags,
-			    lockstate);
+			reloc_tlsdesc(obj, rela, (struct tlsdesc_entry *)where,
+			    SYMLOOK_IN_PLT | flags, lockstate);
 			break;
 		case R_AARCH64_IRELATIVE:
 			obj->irelative = true;
@@ -549,7 +557,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
 			}
 			break;
 		case R_AARCH64_TLSDESC:
-			reloc_tlsdesc(obj, rela, where, flags, lockstate);
+			reloc_tlsdesc(obj, rela, (struct tlsdesc_entry *)where,
+			    flags, lockstate);
 			break;
 		case R_AARCH64_TLS_TPREL64:
 			/*

From nobody Wed Jun  5 16:50:49 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvYPP2lnsz5LF3j;
	Wed, 05 Jun 2024 16:50:49 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvYPP2FzMz4N2k;
	Wed,  5 Jun 2024 16:50:49 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717606249;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=uq5Cs26l2EblWISgbWyUASCSKiGx3n4OYwWc2+1hDcY=;
	b=hiVRfvncj/TqnIfT1dCae9W4aGZZc1O9m9dzwgKyOLp2jn3z4UxvQSmth/lZHgoxVHuqB6
	acQwlgqTs1AYzC2F+AUttPwmHPzToEb0vEHs3sNz4Hlmi4KnrK2G1j2JlR9PSQpOEzcAeO
	zbFoxG/+DICwsbKDnVBR2i2zk/kOvu42i9g8r2MvFWqy0z8WRUvZVJCA6qCPHEYLITeImH
	0RLckdhOrdPsKvHANwEMX2r11QHyh1hg6NtC3q/h8loHCT3FZ744wmWtQRhA58vtfGNtiS
	G5blEET2Pp1uDi6xUMp1KrPguGBGdlKHUYCAI2PG++yhT0YvVGlQTribKIDvHw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717606249; a=rsa-sha256; cv=none;
	b=K9tHQ3E4EeXySy3GyVQGJKfF7IIOAQRvijeqGZouW1YREVNYh4v33AE7kfJ3v1cOrXGmh5
	G56YmP05i4idZz2usoI37DZv15G3jAqZotwNSO9Eem6/41f2sVSluU/3ihoYPFZe6Jzqah
	0/gtfVjOSg67z1HOmnVVBowuzdKZlkLjQyrxy2y9BWCSIXG5szb4jwBYf3+OVQzx99TNlX
	KBcrYy81XWGFq+QmaoVLPmIY1OONJH6Iswgcinp1xnLe//yC4WApTtWoer7PumInhISxMv
	eQ5B5MWDPdf9GojdJkzU/gNtFAxU2vJLn2H60cAS67LCmTpD2g7yTYZRhgnD/g==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717606249;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=uq5Cs26l2EblWISgbWyUASCSKiGx3n4OYwWc2+1hDcY=;
	b=ufU5U4DbTkd3uE50BVpADYFTYojpf5AFHrVEEmDVGkcwwaRmP3z8aH/VyX+JjsMz7kGPcD
	htG64Di9l8i4bSzTemJkE3mZsg7K9yo2n4iWSX4uWz4zxkIzjUwUZOavF3H46hQicUwjdz
	/3yXaE75fl3yRPL6GxYeSWEbSswDnMe3e+prZT+g2MKSR0bNeXIfSMGkQNscbAMOTUgoN7
	qXGzaM/qkPpJ8TiQa7LxAMtD2aUhWyigeYnVJ4pagTrvQJ6ykCHWOrJZIXcY3JDHNx6Yuh
	Mt5/lCmKzDa9r/dew9BqUOuTH2Ppd577OyDbt9VsonqxyRCB2gMxHFoJBiDqpw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvYPP1kV7z18T8;
	Wed,  5 Jun 2024 16:50:49 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455Gon4t082247;
	Wed, 5 Jun 2024 16:50:49 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455GonBQ082244;
	Wed, 5 Jun 2024 16:50:49 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 16:50:49 GMT
Message-Id: <202406051650.455GonBQ082244@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: 56b822a17cde - main - pci: Only add special VF handling
  for direct children in bus methods
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 56b822a17cde5940909633c50623d463191a7852
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=56b822a17cde5940909633c50623d463191a7852

commit 56b822a17cde5940909633c50623d463191a7852
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 16:50:05 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 16:50:05 +0000

    pci: Only add special VF handling for direct children in bus methods
    
    For activate/deactivate resource, use a more standard check at the
    start of the function since the addition of the PCI_IOV code made this
    more complex.  For the three recently added methods, just add the
    typical check at the beginning that I missed.
    
    This wasn't always fatal as if your system only had PCI device_t's as
    children of PCI bus devices it would happen to work ok, but if you
    have a non-PCI child device (e.g. an ATA channel) then dereferencing
    ivars for non-direct-children could fault.
    
    Reported by:    Cirrus-CI (via emaste)
    Reviewed by:    emaste
    Fixes:          871b33ad65ba pci: Consistently use pci_vf_* for suballocated VF memory resources
    Differential Revision:  https://reviews.freebsd.org/D45499
---
 sys/dev/pci/pci.c | 55 +++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 35 insertions(+), 20 deletions(-)

diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 2093d6a8b5ef..9661cfd19db7 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -5695,6 +5695,9 @@ pci_activate_resource(device_t dev, device_t child, struct resource *r)
 	struct pci_devinfo *dinfo;
 	int error, rid, type;
 
+	if (device_get_parent(child) != dev)
+		return (bus_generic_activate_resource(dev, child, r));
+
 	dinfo = device_get_ivars(child);
 #ifdef PCI_IOV
 	if (dinfo->cfg.flags & PCICFG_VF) {
@@ -5716,20 +5719,20 @@ pci_activate_resource(device_t dev, device_t child, struct resource *r)
 	if (error)
 		return (error);
 
+	rid = rman_get_rid(r);
+	type = rman_get_type(r);
+
+	/* Device ROMs need their decoding explicitly enabled. */
+	if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
+		pci_write_bar(child, pci_find_bar(child, rid),
+		    rman_get_start(r) | PCIM_BIOS_ENABLE);
+
 	/* Enable decoding in the command register when activating BARs. */
-	if (device_get_parent(child) == dev) {
-		/* Device ROMs need their decoding explicitly enabled. */
-		rid = rman_get_rid(r);
-		type = rman_get_type(r);
-		if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
-			pci_write_bar(child, pci_find_bar(child, rid),
-			    rman_get_start(r) | PCIM_BIOS_ENABLE);
-		switch (type) {
-		case SYS_RES_IOPORT:
-		case SYS_RES_MEMORY:
-			error = PCI_ENABLE_IO(dev, child, type);
-			break;
-		}
+	switch (type) {
+	case SYS_RES_IOPORT:
+	case SYS_RES_MEMORY:
+		error = PCI_ENABLE_IO(dev, child, type);
+		break;
 	}
 	return (error);
 }
@@ -5740,6 +5743,9 @@ pci_deactivate_resource(device_t dev, device_t child, struct resource *r)
 	struct pci_devinfo *dinfo;
 	int error, rid, type;
 
+	if (device_get_parent(child) != dev)
+		return (bus_generic_deactivate_resource(dev, child, r));
+
 	dinfo = device_get_ivars(child);
 #ifdef PCI_IOV
 	if (dinfo->cfg.flags & PCICFG_VF) {
@@ -5762,13 +5768,11 @@ pci_deactivate_resource(device_t dev, device_t child, struct resource *r)
 		return (error);
 
 	/* Disable decoding for device ROMs. */
-	if (device_get_parent(child) == dev) {
-		rid = rman_get_rid(r);
-		type = rman_get_type(r);
-		if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
-			pci_write_bar(child, pci_find_bar(child, rid),
-			    rman_get_start(r));
-	}
+	rid = rman_get_rid(r);
+	type = rman_get_type(r);
+	if (type == SYS_RES_MEMORY && PCIR_IS_BIOS(&dinfo->cfg, rid))
+		pci_write_bar(child, pci_find_bar(child, rid),
+		    rman_get_start(r));
 	return (0);
 }
 
@@ -5779,6 +5783,10 @@ pci_adjust_resource(device_t dev, device_t child, struct resource *r,
 {
 	struct pci_devinfo *dinfo;
 
+	if (device_get_parent(child) != dev)
+		return (bus_generic_adjust_resource(dev, child, r, start,
+		    end));
+
 	dinfo = device_get_ivars(child);
 	if (dinfo->cfg.flags & PCICFG_VF) {
 		switch (rman_get_type(r)) {
@@ -5802,6 +5810,10 @@ pci_map_resource(device_t dev, device_t child, struct resource *r,
 {
 	struct pci_devinfo *dinfo;
 
+	if (device_get_parent(child) != dev)
+		return (bus_generic_map_resource(dev, child, r, argsp,
+		    map));
+
 	dinfo = device_get_ivars(child);
 	if (dinfo->cfg.flags & PCICFG_VF) {
 		switch (rman_get_type(r)) {
@@ -5825,6 +5837,9 @@ pci_unmap_resource(device_t dev, device_t child, struct resource *r,
 {
 	struct pci_devinfo *dinfo;
 
+	if (device_get_parent(child) != dev)
+		return (bus_generic_unmap_resource(dev, child, r, map));
+
 	dinfo = device_get_ivars(child);
 	if (dinfo->cfg.flags & PCICFG_VF) {
 		switch (rman_get_type(r)) {

From nobody Wed Jun  5 16:51:55 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvYQy4GZsz5LG24;
	Wed, 05 Jun 2024 16:52:10 +0000 (UTC)
	(envelope-from rlibby@gmail.com)
Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvYQy1sPYz4Nny;
	Wed,  5 Jun 2024 16:52:10 +0000 (UTC)
	(envelope-from rlibby@gmail.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52b91f655d1so1191105e87.1;
        Wed, 05 Jun 2024 09:52:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1717606328; x=1718211128; darn=freebsd.org;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:from:to:cc:subject:date
         :message-id:reply-to;
        bh=RuJOoyrudwSLRsyujndWQbsjWfHBra49UzYvXf2i5FE=;
        b=FCQoEJD+1NAt734cB2uc7Tq7PCUxbqXhnUEqXQRl4WvYACGv3OX+wNSwVvGJpP4uXw
         xLGRtxioQG4E0Vv0GWuuiTxjVMa1k84C2LTbWLLzDxoYWqxpeu2k7Em2Ao+oVuNgv9f4
         CxAY2czUz8DULKJHTt/5EfBdmpr+0DP78FoAqc91+6sga9ScTIqJ6FSdFXNgI7xE38jn
         s5gDwIaHc6S8793JMiuN5xDpQgxWH79hEwaUi9BPKftPirEBKTY9HE/P1JhUdUs1qMEu
         Wys6IEg55KAmEmJKFNhNCq0y6f1xLi1jqEDGd4xQjBKI2T1Gpy4v9Avhc7BxQJzyN4hM
         x4bA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717606328; x=1718211128;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=RuJOoyrudwSLRsyujndWQbsjWfHBra49UzYvXf2i5FE=;
        b=BlzRf8/+HRKlW0qZaSwx2uyKOWiS4Erze2MKP+un7pnSkMlaYbTrlLcBSgLrOqVLYu
         AfJ5aUkkYDb6ybJpOM/Hn49lfGSSXKZMDFsSeab/ueDGBYGS7pqj+H2ncX1MZBH7yKjC
         SXNHpcJAPV82RjDpzShWTj+RafRL66YT+ODu6Xv6fAoYEUpl2g8sUnz0qpE7uV0UpWte
         q40+R7PHjm8qC6WTvwlZiUzoyqXjB52yEgwbQY31d/JH8verUjfNf6jY2nlS6it4gBV1
         3VdLJFW4hMTG31PQ6swGi3lT4BJ8NeI0UdF4wiIIOmQJzbyyhS/zKwtns78ECrxte1i4
         GmhQ==
X-Forwarded-Encrypted: i=1; AJvYcCXwg4KSDG7qCZYCeOcfM8vwT58xuDUwR+hyqLN7Sackx3NLKoR8PABahaANR8GAy9ReC/tKE6OZuAFmppk55ifcHptAWucaMZuWaznmIucVqjVxADroZo2IFRRD/l1H1RA2l0aklfd4al+xgVBQZhSI3K5vETm0oXcj2egLJam4NgNu
X-Gm-Message-State: AOJu0YwkHUmCDJto+ELNtBUwsCL2JGSBswiI6xRtm4t+I5T85bdCSqlZ
	KDYK/5zI8DCc94goKzYWPjkTkLo7tlCSFcUzPc9Rz4LSc3lmt9m4v271xy02gPKUb4yBdkN5/Er
	TbaDV7ADaCA0TBGk+aU4EbySCdw4=
X-Google-Smtp-Source: AGHT+IHJiWEnKgFYwkX3Asr5TXzPtzTrcVdcSqQUeTr0hQfefbEZalGDlq89kRyiBWWJ+HzKAhXXECZLvOpXG3gqXt8=
X-Received: by 2002:a05:6512:3e14:b0:52b:9a69:67c7 with SMTP id
 2adb3069b0e04-52bb217b8f7mr64108e87.7.1717606327514; Wed, 05 Jun 2024
 09:52:07 -0700 (PDT)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
References: <202406051238.455CcdGB050229@gitrepo.freebsd.org> <EFF41E75-E97A-4ED7-B439-839346C9951B@gmail.com>
In-Reply-To: <EFF41E75-E97A-4ED7-B439-839346C9951B@gmail.com>
From: Ryan Libby <rlibby@gmail.com>
Date: Wed, 5 Jun 2024 09:51:55 -0700
Message-ID: <CAHgpiFwoHd6JEGijeKGQHp3q265=Vreh6id7fUc56Dt8SuRtqw@mail.gmail.com>
Subject: Re: git: bec000c9c1ef - main - amd64: add a func pointer to tlb
 shootdown function
To: Enji Cooper <yaneurabeya@gmail.com>, Wei Hu <whu@freebsd.org>
Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, 
	"dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, 
	"dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]
X-Rspamd-Queue-Id: 4VvYQy1sPYz4Nny

On Wed, Jun 5, 2024 at 8:49=E2=80=AFAM Enji Cooper <yaneurabeya@gmail.com> =
wrote:
>
>
> On Jun 5, 2024, at 5:38=E2=80=AFAM, Wei Hu <whu@FreeBSD.org> wrote:
>
> The branch main has been updated by whu:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=3Dbec000c9c1ef409989685bb03f=
f0532907befb4a
>
> commit bec000c9c1ef409989685bb03ff0532907befb4a
> Author:     Souradeep Chakrabarti <schakrabarti@microsoft.com>
> AuthorDate: 2024-06-05 12:25:05 +0000
> Commit:     Wei Hu <whu@FreeBSD.org>
> CommitDate: 2024-06-05 12:25:05 +0000
>
>    amd64: add a func pointer to tlb shootdown function
>
>    Make the tlb shootdown function as a pointer. By default, it still
>    points to the system function smp_targeted_tlb_shootdown(). It allows
>    other implemenations to overwrite in the future.
>
>    Reviewed by:    kib
>    Tested by:      whu
>    Authored-by:    Souradeep Chakrabarti <schakrabarti@microsoft.com>
>    Co-Authored-by: Erni Sri Satya Vennela <ernis@microsoft.com>
>    MFC after:      1 week
>    Sponsored by:   Microsoft
>    Differential Revision:  https://reviews.freebsd.org/D45174
>
>
> This broke the i386 build: https://ci.freebsd.org/job/FreeBSD-main-i386-b=
uild/28056/
> Cheers,
> -Enji
>

Should this be touching sys/vm/pmap.h at all?  It seems wholly focused on a=
md64.

Ryan

From nobody Wed Jun  5 16:57:52 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvYYZ3vtlz5LGW4;
	Wed, 05 Jun 2024 16:57:54 +0000 (UTC)
	(envelope-from jhibbits@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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvYYZ3KwWz4PXD;
	Wed,  5 Jun 2024 16:57:54 +0000 (UTC)
	(envelope-from jhibbits@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717606674;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=VDwYr6w5gY+dAl8skm9RRvbuTa93dkKjcvAg1X8iL3o=;
	b=RckaA+XIhfzPU2mZHy5dnNb6UTJMoOo/kzrkGpPLwOxirj1Lx9ZxDBwJo+3ehE9/38BYR9
	CG4L5wmuOw7H2NpQvp6JQDbbNEFFDOBShA0xMATyi/w9qFE6ETmqFVL83YnihgT7P1K1qC
	B9DaM/vR2Q3QV/zPDl6RSbJvFev/8TAH+lfrbRAAmPWTnHXha4WBwc9kcMpBaf2+9/eX4L
	e53OqAx5V4izzCVgz+dIvTtKZyvghbSctRnWXjVNTiMTHQRVWhOszDPiqAKmsNngg3nN67
	2NXow1+7zYoCEYpHAgZc4rutKFS7rQSu8aPy6eJ3QCz0ad60OiqgrdYX9g8zKQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717606674; a=rsa-sha256; cv=none;
	b=mypFv87+FpAmjyZcGtNoSX4bhb7Su/6N2bGv1VQuBSsSHAtiYZfC4qD1LXYzFaqmqFKY/8
	Rkpt4KK9Jd7j78j8COCwe46hLM5JqNny6u3mfIilN3aLHaB0t3bx7axOEhhBUq6vL9SpSL
	R3wjB7DIUeXim3S//Oun1YNik3iCbcUTS9CN9MBsdAOYas8qK1GCfiTZ6sc7OTbYMPUV/f
	kL0ltXtL14fs9fZw74BxbPsv9ah5+lLf5nE+mcH3PC8uYrHJ1jutBRLSgL/X9jp963RbiT
	/kG8n7/4c/9oZR8r1Huk4oDrtC1DUrBc+NMBLIHNx8Y/yYeIL7mdiN0pmYynig==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717606674;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=VDwYr6w5gY+dAl8skm9RRvbuTa93dkKjcvAg1X8iL3o=;
	b=dgAgHW8snML7hOPX+4DPUZXp/sABzpv3wZpCtYfG6ZVCUG6HCHC9KaN4jeMDR+Ux/dTiVl
	mxsKcRTEbUhAhQU4oml9L0wWNHLgERbLAXqonCU1dbjpi9NncLlB9kDA7qOCrAwPWFs1mO
	EgXRPDTkQ/YxovnMKNu+BvPGAwINnIGFLlpk2CBLep5xK36xUPtG1anVZPftVaNiNF30DI
	t4JeuVW4rF7bUSQgvt+u4Rt5Bo2L3CCra73pXWJNPTVHDLkgRAOeN0cdCBQnqVWWgRqlIR
	woAnJCq349dSVhBgytS5q25i4MQ27d9ipYQ/OqaSYSa9m7/OzT+H2eMOU5X9ag==
Received: from ralga.knownspace (ip-163-182-7-56.dynamic.fuse.net [163.182.7.56])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: jhibbits)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4VvYYZ0zXJz117R;
	Wed,  5 Jun 2024 16:57:54 +0000 (UTC)
	(envelope-from jhibbits@FreeBSD.org)
Date: Wed, 5 Jun 2024 12:57:52 -0400
From: Justin Hibbits <jhibbits@FreeBSD.org>
To: Ryan Libby <rlibby@gmail.com>
Cc: Enji Cooper <yaneurabeya@gmail.com>, Wei Hu <whu@freebsd.org>,
 "src-committers@freebsd.org" <src-committers@freebsd.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
Subject: Re: git: bec000c9c1ef - main - amd64: add a func pointer to tlb
 shootdown function
Message-ID: <20240605125743.5b39005f@ralga.knownspace>
In-Reply-To: <CAHgpiFwoHd6JEGijeKGQHp3q265=Vreh6id7fUc56Dt8SuRtqw@mail.gmail.com>
References: <202406051238.455CcdGB050229@gitrepo.freebsd.org>
	<EFF41E75-E97A-4ED7-B439-839346C9951B@gmail.com>
	<CAHgpiFwoHd6JEGijeKGQHp3q265=Vreh6id7fUc56Dt8SuRtqw@mail.gmail.com>
X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; powerpc64le-unknown-linux-gnu)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wed, 5 Jun 2024 09:51:55 -0700
Ryan Libby <rlibby@gmail.com> wrote:

> On Wed, Jun 5, 2024 at 8:49=E2=80=AFAM Enji Cooper <yaneurabeya@gmail.com>
> wrote:
> >
> >
> > On Jun 5, 2024, at 5:38=E2=80=AFAM, Wei Hu <whu@FreeBSD.org> wrote:
> >
> > The branch main has been updated by whu:
> >
> > URL:
> > https://cgit.FreeBSD.org/src/commit/?id=3Dbec000c9c1ef409989685bb03ff05=
32907befb4a
> >
> > commit bec000c9c1ef409989685bb03ff0532907befb4a
> > Author:     Souradeep Chakrabarti <schakrabarti@microsoft.com>
> > AuthorDate: 2024-06-05 12:25:05 +0000
> > Commit:     Wei Hu <whu@FreeBSD.org>
> > CommitDate: 2024-06-05 12:25:05 +0000
> >
> >    amd64: add a func pointer to tlb shootdown function
> >
> >    Make the tlb shootdown function as a pointer. By default, it
> > still points to the system function smp_targeted_tlb_shootdown().
> > It allows other implemenations to overwrite in the future.
> >
> >    Reviewed by:    kib
> >    Tested by:      whu
> >    Authored-by:    Souradeep Chakrabarti
> > <schakrabarti@microsoft.com> Co-Authored-by: Erni Sri Satya Vennela
> > <ernis@microsoft.com> MFC after:      1 week
> >    Sponsored by:   Microsoft
> >    Differential Revision:  https://reviews.freebsd.org/D45174
> >
> >
> > This broke the i386 build:
> > https://ci.freebsd.org/job/FreeBSD-main-i386-build/28056/ Cheers,
> > -Enji
> > =20
>=20
> Should this be touching sys/vm/pmap.h at all?  It seems wholly
> focused on amd64.
>=20
> Ryan

Agreed, this should be done in sys/amd64/include/pmap.h .

- Justin

From nobody Wed Jun  5 17:42:19 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvZXq6bKCz5LNGh;
	Wed, 05 Jun 2024 17:42:19 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvZXq65Tjz4Ssx;
	Wed,  5 Jun 2024 17:42:19 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717609339;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=54m2THz63XNRuw3w+BPlmOOyNxKUDWxJf649fSVsojQ=;
	b=Dsn8jijSuq5VISpMxdjUBzCVzXVJS09IA0ut1YGu5Dx3zYJgR6gnAvsQ4pgAboKXbQCGUw
	3h4WoZXTiNxr28mok34BOqSf6p/hfIw0mxmRcyXkQIQcC5WIz/UvNs8Mrwjojw1Qvh4GcH
	gXk7ogAexRtHqczmNYT1WX3hxjNKyOyqHuYAzIu/c4Nq4TaRXxftfsf5VpTFaVOiF2Wu2h
	FrPXfFULYPuXpjpR9QfgAbrvdaZPkphGj5LoaCaAvchPdW0ONZeCx4xQ/BIDSl9gbaOslo
	E8L48jJg/4LebYfKm2e8x9Y8niY/eSqfcYSKqw6qO8fD1iWvcgZDrNbLVHY4Tg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717609339; a=rsa-sha256; cv=none;
	b=ZM27OkxbwjVxQwwFzilvQvga5sF4LIs2Z99byElvTSZsG/JCMIi+C6qKZ2ef75ojnx4Jqm
	aUQ1n8S3me3jqfvGDNfkyF6d+fGsGHLfqnnB3LHN5AKxFgjC/SWyMIfvvP5rBOu6VM3V/w
	IUxLwWIXAPEe9s0flQQIUD6YkJV5oY+uFGupvvsuwdH2uGjEax5I9IbthhHvlRVJGCDiGS
	7DNBqPHzWj/tYzm5/6cmDRyFY+C+hZaux5nwawi7ZLITyFxkEFPdWRRa3/9N6Pi3qEJk7h
	8WEHui4R0Dw0dN8h3CqN9QnEZjTRpV4ocGb5yqim9G7KBwUK8Vk9qE0AWsPcfg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717609339;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=54m2THz63XNRuw3w+BPlmOOyNxKUDWxJf649fSVsojQ=;
	b=xM3dD+bfS+qYd4HDq38GoYn64pTEDoaTZtPzsZSusjr8WZZDC4dOifAJrDQMoa4KzibDOg
	1fDg/Xex0+dt0hIq8G1Jsn8apvFeSZhbZLaUO/8KuacoOrbJidROSoTNkYg2Vy1MSEj0gn
	RgkkJEDnyMWvFmt6g3FEteciMRsGzBwrBcnli+uMPk4AmZYdUcNDKJDMueokMzLSPuMUc9
	pA7nHHV/hLfRu+tPQjVF+D2QpAhUTog6RFyuweZJhstgb4UrsY+bynNpyoo3zlq0utZjgo
	S51G7nJpIGe6Nco91rpjt24F2SY+YTx/iDMSFN5r3+p2eY69U9qiZWsFXIsNTQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvZXq5hnYz1BXp;
	Wed,  5 Jun 2024 17:42:19 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455HgJaF071084;
	Wed, 5 Jun 2024 17:42:19 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455HgJhp071081;
	Wed, 5 Jun 2024 17:42:19 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 17:42:19 GMT
Message-Id: <202406051742.455HgJhp071081@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Alan Cox <alc@FreeBSD.org>
Subject: git: 60847070f908 - main - vm: Eliminate a redundant call
  to vm_reserv_break_all()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: alc
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 60847070f908c7c5ebb2ea4c851f8b98680fd01a
Auto-Submitted: auto-generated

The branch main has been updated by alc:

URL: https://cgit.FreeBSD.org/src/commit/?id=60847070f908c7c5ebb2ea4c851f8b98680fd01a

commit 60847070f908c7c5ebb2ea4c851f8b98680fd01a
Author:     Alan Cox <alc@FreeBSD.org>
AuthorDate: 2024-06-05 06:40:20 +0000
Commit:     Alan Cox <alc@FreeBSD.org>
CommitDate: 2024-06-05 17:39:47 +0000

    vm: Eliminate a redundant call to vm_reserv_break_all()
    
    When vm_object_collapse() was changed in commit 98087a0 to call
    vm_object_terminate(), rather than destroying the object directly, its
    call to vm_reserv_break_all() should have been removed, as
    vm_object_terminate() calls vm_reserv_break_all().
    
    Reviewed by:    kib, markj
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45495
---
 sys/vm/vm_object.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c
index 905df5454355..0af4402938ba 100644
--- a/sys/vm/vm_object.c
+++ b/sys/vm/vm_object.c
@@ -1953,14 +1953,6 @@ vm_object_collapse(vm_object_t object)
 			 */
 			vm_object_collapse_scan(object);
 
-#if VM_NRESERVLEVEL > 0
-			/*
-			 * Break any reservations from backing_object.
-			 */
-			if (__predict_false(!LIST_EMPTY(&backing_object->rvq)))
-				vm_reserv_break_all(backing_object);
-#endif
-
 			/*
 			 * Move the pager from backing_object to object.
 			 *

From nobody Wed Jun  5 17:52:02 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvZmJ3pgTz5LQNt
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Wed, 05 Jun 2024 17:52:16 +0000 (UTC)
	(envelope-from kevin.bowling@kev009.com)
Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvZmJ0McFz4Tsl
	for <dev-commits-src-main@freebsd.org>; Wed,  5 Jun 2024 17:52:16 +0000 (UTC)
	(envelope-from kevin.bowling@kev009.com)
Authentication-Results: mx1.freebsd.org;
	none
Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-681953ad4f2so42411a12.2
        for <dev-commits-src-main@freebsd.org>; Wed, 05 Jun 2024 10:52:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=kev009.com; s=google; t=1717609934; x=1718214734; darn=freebsd.org;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:from:to:cc:subject:date
         :message-id:reply-to;
        bh=3VGcqv+30ZwjpbLu6KT3vHBcWHAogQT/fJD2Z6JO8ls=;
        b=CaKHkCKMvZjgLW/zfCbzDgpDou8AO1UuMRXUqf4mRl+rwEho0B5/jK9X4f7F69Dada
         0c74SXLYPzC+kT82EjlzyPQoLcKcbJymg9emTSprOxxE6vfsaAktRvM/mQkEIM0eTaxP
         SyQjxmghB+i3sdIUbXawp/DCFe7sJppVrcG/Y=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717609934; x=1718214734;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
         :subject:date:message-id:reply-to;
        bh=3VGcqv+30ZwjpbLu6KT3vHBcWHAogQT/fJD2Z6JO8ls=;
        b=jnR9aHHcoLRU/wce2mQsbix8jX5hDpzUcBEq2ucVr0ZdQBboSXIZTnDCmcAAqyIT5k
         8qOXnOxD0e1gU9Q542LD1lPMhpSLXK7UiXB/Le/T+AdtkVbXGUkgQnLCCacBwbd2SLHn
         oXrTNfE8VyyGkBMww72dG9NRDWCyRn2822GdnjiCLuTKszMrgmggpjh6oCoNAUypcJ79
         1PgQa/jtfsthIbWxsLw7bBiohlJCQbSKFZ/gp0npQ8uttstOwfhT5jQ1OhbiPstqgL1i
         c8hE3PUQHWffzta3yt0SxQMzyWqrfNA4oCFlg2ioHqdSPBETgJhh5KTF6t1mfe6+tbgK
         InCg==
X-Forwarded-Encrypted: i=1; AJvYcCV/XYQ5jT8Hg6dHPI1xSbfqK6HGLZsz+sb85OQE5UdMh8RQwnGIUQHCP5ZMR9jMSbZm+ETc7HDsvmFxjJUuObJagKP+A8Gx69TrXDOYNhecbQ==
X-Gm-Message-State: AOJu0Yye0elCNCY8V0k4kIwK+/KdJ9h+YPwBlQm1X6irkqDpx1iXKOs9
	QQQcUoqn8eO58P6JpE63nkLi3TujJf4jJgrXpcQLPYHwOYElHR8ffMLDxUl+hbEbXJLe8BO7aP7
	A2zQXvQ9IcZWEplcP2oGmbVvoyiFJgyZIiXIp3jbzFDAnzSkUaA==
X-Google-Smtp-Source: AGHT+IH2+eGCk6UBVrcpn2zRvhvz9yOm6DPxB3J8E7pAxafwbJE5qA6aej3LBULvcJzfvHeZzzmsxRjD036WPvRagqg=
X-Received: by 2002:a17:90a:e392:b0:2c2:97c2:1426 with SMTP id
 98e67ed59e1d1-2c297c2156bmr466794a91.10.1717609934210; Wed, 05 Jun 2024
 10:52:14 -0700 (PDT)
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
References: <202405280643.44S6hBkh054482@gitrepo.freebsd.org> <1ade77c1-f15a-4e20-a8ea-29ac3a86e85e@FreeBSD.org>
In-Reply-To: <1ade77c1-f15a-4e20-a8ea-29ac3a86e85e@FreeBSD.org>
From: Kevin Bowling <kevin.bowling@kev009.com>
Date: Wed, 5 Jun 2024 10:52:02 -0700
Message-ID: <CAK7dMtB3H+g_d2WAvSEFu_t8xgNU3ZTcWQXyERUhyJOtuJc6vA@mail.gmail.com>
Subject: Re: git: 1c45a62a2f66 - main - qlnxe: Fix multiple locking issues
To: John Baldwin <jhb@freebsd.org>, keith.reynolds@hpe.com
Cc: Kevin Bowling <kbowling@freebsd.org>, src-committers@freebsd.org, 
	dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]
X-Rspamd-Queue-Id: 4VvZmJ0McFz4Tsl

On Tue, Jun 4, 2024 at 4:02=E2=80=AFPM John Baldwin <jhb@freebsd.org> wrote=
:
>
> On 5/28/24 2:43 AM, Kevin Bowling wrote:
> > The branch main has been updated by kbowling:
> >
> > URL: https://cgit.FreeBSD.org/src/commit/?id=3D1c45a62a2f667b45ec10a92a=
d58ff5a34e68b569
> >
> > commit 1c45a62a2f667b45ec10a92ad58ff5a34e68b569
> > Author:     Keith Reynolds <keith.reynolds@hpe.com>
> > AuthorDate: 2024-05-28 06:41:05 +0000
> > Commit:     Kevin Bowling <kbowling@FreeBSD.org>
> > CommitDate: 2024-05-28 06:41:05 +0000
> >
> >      qlnxe: Fix multiple locking issues
> >
> >      Multiple issues are reported with WITNESS and code inspection of t=
he
> >      locking and lock initialization.
> >
> >      PR:             278084
> >      MFC after:      1 week
> > ---
> >   sys/dev/qlnx/qlnxe/bcm_osal.h  |  8 +++----
> >   sys/dev/qlnx/qlnxe/ecore.h     |  1 +
> >   sys/dev/qlnx/qlnxe/ecore_mcp.c | 48 +++++++++++++++++++++------------=
---------
> >   sys/dev/qlnx/qlnxe/ecore_mcp.h |  6 +++---
> >   sys/dev/qlnx/qlnxe/qlnx_def.h  |  2 +-
> >   sys/dev/qlnx/qlnxe/qlnx_os.c   |  9 ++++----
> >   sys/dev/qlnx/qlnxe/qlnx_os.h   |  4 ++--
> >   7 files changed, 40 insertions(+), 38 deletions(-)
> >
> > diff --git a/sys/dev/qlnx/qlnxe/bcm_osal.h b/sys/dev/qlnx/qlnxe/bcm_osa=
l.h
> > index 5d940d3272d6..c820532c9e0a 100644
> > --- a/sys/dev/qlnx/qlnxe/bcm_osal.h
> > +++ b/sys/dev/qlnx/qlnxe/bcm_osal.h
> > @@ -72,7 +72,7 @@ extern void qlnx_dma_free_coherent(void *ecore_dev, v=
oid *v_addr,
> >                           bus_addr_t phys, uint32_t size);
> >
> >   extern void qlnx_link_update(void *p_hwfn);
> > -extern void qlnx_barrier(void *p_hwfn);
> > +extern void qlnx_barrier(void *p_dev);
> >
> >   extern void *qlnx_zalloc(uint32_t size);
> >
> > @@ -213,14 +213,14 @@ typedef struct osal_list_t
> >   #define OSAL_SPIN_LOCK_ALLOC(p_hwfn, mutex)
> >   #define OSAL_SPIN_LOCK_DEALLOC(mutex) mtx_destroy(mutex)
> >   #define OSAL_SPIN_LOCK_INIT(lock) {\
> > -             mtx_init(lock, __func__, MTX_NETWORK_LOCK, MTX_SPIN); \
> > +             mtx_init(lock, __func__, "OSAL spin lock", MTX_SPIN); \
> >       }
> >
>
> Do you really need MTX_SPIN here?  Device drivers rarely need spin locks.
> The equivalent to a Linux spin lock in drivers is generally a MTX_DEF
> mutex.

Can you include the author for follow ups?  This driver was a bit of a
disaster, the patch in question doesn't rectify that overall but does
fix the most serious PRs which is worthwhile.  The spin in question
seems to match what the vendor initially did in their OS API, Keith
may be able to test your suggestion.

> --
> John Baldwin
>

From nobody Wed Jun  5 18:52:10 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvc6F6xLyz5LbN9
	for <dev-commits-src-main@mlmmj.nyi.freebsd.org>; Wed, 05 Jun 2024 18:52:53 +0000 (UTC)
	(envelope-from bounce.et14jdlz6vmqrc0=ip426riv613n=cvnaskdkq7eeti@em790814.fubar.geek.nz)
Received: from e3i74.smtp2go.com (e3i74.smtp2go.com [158.120.84.74])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvc6F3kpxz4ZgB
	for <dev-commits-src-main@FreeBSD.org>; Wed,  5 Jun 2024 18:52:53 +0000 (UTC)
	(envelope-from bounce.et14jdlz6vmqrc0=ip426riv613n=cvnaskdkq7eeti@em790814.fubar.geek.nz)
Authentication-Results: mx1.freebsd.org;
	none
Received: from [10.99.243.232] (helo=morbo.fubar.geek.nz)
	by smtpcorp.com with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256)
	(Exim 4.97.1-S2G)
	(envelope-from <andrew@fubar.geek.nz>)
	id 1sEvkE-4o5NDgrgnEd-nLPb;
	Wed, 05 Jun 2024 18:52:22 +0000
Received: from smtpclient.apple (92.40.184.0.threembb.co.uk [92.40.184.0])
	by morbo.fubar.geek.nz (Postfix) with ESMTPSA id A26C9108AA;
	Wed, 05 Jun 2024 18:52:21 +0000 (UTC)
From: Andrew Turner <andrew@fubar.geek.nz>
Message-Id: <CFE64928-3C70-411E-90A0-E79C90662070@fubar.geek.nz>
Content-Type: multipart/mixed;
	boundary="Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302"
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.100.2.1.4\))
Subject: Re: git: bed65d85c631 - main - linux64: Fix the build on arm64  with
 bti checking
Date: Wed, 5 Jun 2024 19:52:10 +0100
In-Reply-To: <20240605153714.5161218F@slippy.cwsent.com>
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
To: Cy Schubert <Cy.Schubert@cschubert.com>
References: <202406050929.4559TFj0027386@gitrepo.freebsd.org>
 <20240605153714.5161218F@slippy.cwsent.com>
X-Mailer: Apple Mail (2.3774.100.2.1.4)
X-Report-Abuse: Please forward a copy of this message, including all headers, to <abuse-report@smtp2go.com>
Feedback-ID: 790814m:790814amQcrys:790814s9DKRXVPkQ
X-smtpcorp-track: 2ToIrm-8da7V.wSDK-lsXQYNE.9VknOA2ZrD0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smtpservice.net;
 i=@smtpservice.net; q=dns/txt; s=a1-4; t=1717613561; h=feedback-id :
 x-smtpcorp-track : date : message-id : to : subject : from : reply-to
 : sender : list-unsubscribe : list-unsubscribe-post;
 bh=//crtbKMkuOORpg8umoOjhwxPeHlZtYnVCf/M19gf1g=;
 b=dobwEhqFujJbR6dpzV73Op0NuGQFS7Qf5WmXO5Alfmg6HpzhlIoJgRbtvfl+0NxIWOnHb
 GnbT3/HEhjbN3xWt8flm9Uhz5P9wtMl2xMRE3YsFtyDvL9lGbNjDDq2mGmnT9+UtwqB9QJf
 LyeYshRaEHcARIcprv4DXHzAL0/YUoMj8V8oRQe3zK33PrL935yxMt7b99QmWbT1SzilXnt
 GCnymmPGNV8lmmwJLcbD0skaYRExiMDyVSg5I7K+cC2PYzJqDZ+gN4wZp8DfOd9BShPqhuC
 RwN7tFtiSEOGVFpWqjuUv4MsWhsgXml34A5sZ/JGYstWqQ8FKnSIWOisrxFw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fubar.geek.nz;
 i=@fubar.geek.nz; q=dns/txt; s=s790814; t=1717613561; h=from : subject
 : to : message-id : date;
 bh=//crtbKMkuOORpg8umoOjhwxPeHlZtYnVCf/M19gf1g=;
 b=bI+4FFQk06l3pVeiTWs9JJD0CJAi+t1Iyh8We2FG+nMs7eNbxNMAnAaqSDim6/ufJ9LNy
 KgDj7KG/zM6iQb0VlL33s4fJ60zdPFK3VnRxqP4Zdho9hF/jdxiKMJCosWhscJzxBf9Ab1J
 ChoFFc1DC2o/VaA7XQpW05To7XuJ2OTde2w/fAM3+gEfb0TcJr1vRLat2DjV+H2llNovE+i
 0cCYOsOPPbTt+NCUqaAgZl9vllQkAp9LRHubs4WbzkBZqB0k76qiqRrU9T7fvvyCjgYbZeP
 1XVODmYSoB9Bmkl7BIWXma22E+SjDhu49cymivCOhbJ4uDSn7WNPHCdLJLNA==
X-Spamd-Bar: ----
X-Rspamd-Pre-Result: action=no action;
	module=replies;
	Message is reply to one we originated
X-Spamd-Result: default: False [-4.00 / 15.00];
	REPLY(-4.00)[];
	ASN(0.00)[asn:23352, ipnet:158.120.84.0/22, country:US]
X-Rspamd-Queue-Id: 4Vvc6F3kpxz4ZgB


--Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On 5 Jun 2024, at 16:37, Cy Schubert <Cy.Schubert@cschubert.com> =
wrote:
>=20
> In message <202406050929.4559TFj0027386@gitrepo.freebsd.org>, Andrew =
Turner=20
> wri
> tes:
>> The branch main has been updated by andrew:
>>=20
>> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3Dbed65d85c631c3a8e60a81a15a5a745c=

>> 8ef92fbe
>>=20
>> commit bed65d85c631c3a8e60a81a15a5a745c8ef92fbe
>> Author:     Andrew Turner <andrew@FreeBSD.org>
>> AuthorDate: 2024-06-04 12:47:52 +0000
>> Commit:     Andrew Turner <andrew@FreeBSD.org>
>> CommitDate: 2024-06-05 09:23:40 +0000
>>=20
>>    linux64: Fix the build on arm64 with bti checking
>>=20
>>    When we enable checking for BTI on arm64 we need to include an ELF
>>    note in all object files linked into a module.
>>=20
>>    As using objcopy from a binary to an ELF object file doesn't add =
the
>>    note switch to using .incbin from an assembly file. This allows us =
to
>>    add the needed note without affecting the included object.
>>=20
>>    Reviewed by:    imp, kib, emaste
>>    Sponsored by:   Arm Ltd
>>    Differential Revision:  https://reviews.freebsd.org/D45468
>> ---
>> sys/arm64/linux/linux_support.S   |  4 ++++
>> sys/compat/linux/linux_vdso_inc.S | 39 =
+++++++++++++++++++++++++++++++++++++
>> ++
>> sys/modules/linux64/Makefile      | 17 +++--------------
>> 3 files changed, 46 insertions(+), 14 deletions(-)
>>=20
>> diff --git a/sys/arm64/linux/linux_support.S =
b/sys/arm64/linux/linux_support.
>> S
>> index 151ede7e1c19..3b16583e9d54 100644
>> --- a/sys/arm64/linux/linux_support.S
>> +++ b/sys/arm64/linux/linux_support.S
>> @@ -26,6 +26,8 @@
>>  * SUCH DAMAGE.
>>  */
>>=20
>> +#include <sys/elf_common.h>
>> +
>> #include <machine/asm.h>
>> #include <machine/param.h>
>> #include <machine/vmparam.h>
>> @@ -172,3 +174,5 @@ ENTRY(futex_xorl)
>> str w4, [x2]
>> ret
>> END(futex_xorl)
>> +
>> =
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
>> diff --git a/sys/compat/linux/linux_vdso_inc.S =
b/sys/compat/linux/linux_vdso_
>> inc.S
>> new file mode 100644
>> index 000000000000..af10907f0b60
>> --- /dev/null
>> +++ b/sys/compat/linux/linux_vdso_inc.S
>> @@ -0,0 +1,39 @@
>> +/*-
>> + * SPDX-License-Identifier: BSD-2-Clause
>> + *
>> + * Copyright (C) 2020 Arm Ltd
>> + *
>> + * Redistribution and use in source and binary forms, with or =
without
>> + * modification, are permitted provided that the following =
conditions
>> + * are met:
>> + * 1. Redistributions of source code must retain the above copyright
>> + *    notice, this list of conditions and the following disclaimer.
>> + * 2. Redistributions in binary form must reproduce the above =
copyright
>> + *    notice, this list of conditions and the following disclaimer =
in the
>> + *    documentation and/or other materials provided with the =
distribution.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS =
IS'' AND
>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, =
THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A =
PARTICULAR PURPOS
>> E
>> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE =
LIABLE
>> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR =
CONSEQUENTIA
>> L
>> + * 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, STRIC
>> T
>> + * 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.
>> + */
>> +
>> + .section .rodata
>> + .globl _binary_linux_vdso_so_o_start
>> +_binary_linux_vdso_so_o_start:
>> + .incbin "linux_vdso.so.o"
>> + .globl _binary_linux_vdso_so_o_end
>> +_binary_linux_vdso_so_o_end:
>> +
>> +#if defined(__aarch64__)
>> +#include <sys/elf_common.h>
>> +#include <machine/asm.h>
>> =
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
>> +#endif
>> diff --git a/sys/modules/linux64/Makefile =
b/sys/modules/linux64/Makefile
>> index 62e3b464d39f..beed5ec59c4b 100644
>> --- a/sys/modules/linux64/Makefile
>> +++ b/sys/modules/linux64/Makefile
>> @@ -35,7 +35,8 @@ SRCS=3D linux_dummy_machdep.c \
>> bus_if.h \
>> device_if.h \
>> vnode_if.h \
>> - linux_support.S
>> + linux_support.S \
>> + linux_vdso_inc.S
>> .if ${MACHINE_CPUARCH} =3D=3D "amd64"
>> SRCS+=3D linux_dummy_x86.c
>> .endif
>> @@ -47,7 +48,6 @@ SRCS+=3D  opt_kstack_pages.h opt_nfs.h =
opt_hwpmc_hooks.h
>> CLEANFILES=3D linux_assym.h linux_genassym.o linux_locore.o \
>> genassym.o linux_vdso_gtod.o linux_vdso.so.o
>>=20
>> -OBJS=3D linux_vdso.so
>>=20
>> linux_assym.h: linux_genassym.o
>> sh ${SYSDIR}/kern/genassym.sh linux_genassym.o > ${.TARGET}
>> @@ -83,18 +83,7 @@ linux_vdso.so.o: linux_locore.o linux_vdso_gtod.o
>> -T${SRCTOP}/sys/${MACHINE}/linux/linux_vdso.lds.s \
>> -o ${.TARGET} ${.ALLSRC:M*.o}
>>=20
>> -.if ${MACHINE_CPUARCH} =3D=3D "aarch64"
>> -OBJCOPY_TARGET=3D--output-target elf64-littleaarch64 =
--binary-architecture aar
>> ch64
>> -.elif ${MACHINE_CPUARCH} =3D=3D "amd64"
>> -OBJCOPY_TARGET=3D--output-target elf64-x86-64 --binary-architecture =
i386:x86-6
>> 4
>> -.else
>> -.error ${MACHINE_CPUARCH} not yet supported by linux64
>> -.endif
>> -
>> -linux_vdso.so: linux_vdso.so.o
>> - ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} \
>> -    linux_vdso.so.o ${.TARGET}
>> - ${STRIPBIN} -N _binary_linux_vdso_so_o_size ${.TARGET}
>> +linux_vdso_inc.o: linux_vdso.so.o
>>=20
>> linux_support.o: linux_support.S assym.inc linux_assym.h
>> ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
>>=20
>=20
> kldload linux64.ko results in the following panic on amd64. Reverting =
this=20
> revision addresses the regression.
>=20

Does the attached patch fix it? I didn=E2=80=99t see this when testing.

Andrew


--Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302
Content-Disposition: attachment;
	filename=0001-linux-Allows-writing-to-the-vdso-from-the-kernel.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="0001-linux-Allows-writing-to-the-vdso-from-the-kernel.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20fd684f8b907077b6ee83fe510b9163edddb645d0=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Andrew=20Turner=20<andrew@FreeBSD.org>=0ADate:=20=
Wed,=205=20Jun=202024=2018:47:48=20+0000=0ASubject:=20[PATCH]=20linux:=20=
Allows=20writing=20to=20the=20vdso=20from=20the=20kernel=0A=0AWe=20need=20=
to=20write=20to=20the=20vdso=20in=20the=20kernel=20to=20perform=20=
fixups.=20Move=20it=0Afrom=20.rodata=20to=20.data=20so=20these=20can=20=
be=20run.=0A=0ASponsored=20by:=09Arm=20Ltd=0A---=0A=20=
sys/compat/linux/linux_vdso_inc.S=20|=202=20+-=0A=201=20file=20changed,=20=
1=20insertion(+),=201=20deletion(-)=0A=0Adiff=20--git=20=
a/sys/compat/linux/linux_vdso_inc.S=20=
b/sys/compat/linux/linux_vdso_inc.S=0Aindex=20af10907f0b60..44cc357b4a4a=20=
100644=0A---=20a/sys/compat/linux/linux_vdso_inc.S=0A+++=20=
b/sys/compat/linux/linux_vdso_inc.S=0A@@=20-25,7=20+25,7=20@@=0A=20=20*=20=
SUCH=20DAMAGE.=0A=20=20*/=0A=20=0A-=09.section=20.rodata=0A+=09.section=20=
.data=0A=20=09.globl=20_binary_linux_vdso_so_o_start=0A=20=
_binary_linux_vdso_so_o_start:=0A=20=09.incbin=20"linux_vdso.so.o"=0A--=20=
=0A2.44.0=0A=0A=

--Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii




--Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302--

From nobody Wed Jun  5 20:03:58 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvdhG2bbKz5M3W7;
	Wed, 05 Jun 2024 20:03:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvdhG1Znpz4j8f;
	Wed,  5 Jun 2024 20:03:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717617838;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Q9Wc7Yk6sgT05oN7BMntZn+KQXEWTu/ridrVvOxfu+E=;
	b=ocHK5QdLK0rDBMBsXiDn5LJBx41odK5YjEwMa8RT5U79qBLd6XUjMLlRnFqc7A9lFOBKUZ
	1UIZoU8l47aLxeZm8kgxf47mgLGUYC13f0KU66JbhP/SXJ+R+KwF4PGIask8V2btHrhxBa
	ax+dfnz0Rg+ctVUdZwY1RKXnlX/MAp5/kg9RxlimuN5jjDguhQSSe+PvS2bn4yG+ccT1b5
	yAUWaAbrdqdZ6qsYZjLlkxuw0ry2R2DyxhjMF+rVJMPhBed3q+9IvicKfG/mxAWaes/u6q
	iQi3URdz+t5IF4lyZBlkakQ+kRfJvu4lGna0/LAsyV+3d3UH6XmoihmHysDcMQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717617838; a=rsa-sha256; cv=none;
	b=lbhMNsOicK92tbu/mfEbeCvrBfjw6172llZgQf8nCnm/ziOB5NQ8Ne4S+To5tInO3Lqwu+
	6u36SIpRweVwKpA+e46iKJusq51ltXqxu68/mB0pwwqJbMxJRSlpYV1Ybgx3DGsmA6OsU7
	bXcH9ztTffAYdkw6o1lCQq16olLjymAj+MUUS1ang7bgEWkWsor1iaNEapZ98/Ba9vmpFR
	ULEPmaWDDD83b4MLK+a9aUmnVhBQYxYpWo3Fyis5vR6LLEA311FNTQz31JqsDWWYhn7SVc
	0cAPLJyaKxLp3kH6hWghvGuQNYOGRA6O1s9lDQQsVEUWLUN0WaBaXInaUUF7kQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717617838;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Q9Wc7Yk6sgT05oN7BMntZn+KQXEWTu/ridrVvOxfu+E=;
	b=JrUB2WQt2M0CjnsjlMIleshsShIaUJOHIaBYJKubvKLEmE3j18oI+uUZIZHjcRlbiVBUhZ
	ScQ5zg9ZAMo8M6xruIG4L/bCDXey/VJvG/eNWlOQuWaUxbY10qh9MyQ9gE+hUAKIQ5+gRi
	zcYaNq+RGaKZyiUknq5h2myW7X1eUu37O1TAc3yWr/4BcK1ewJeLdPL91ikoPMnlDVljus
	PQvmQVpSrkzBwb98ptyvvA836EE2YDVX2m2fcXlqa+Kzejwxk2jyhhBA5L86BbHyr5Svrt
	vsDNXZ1fvBhU/zAV8zFjmFTcxC1kUyTmt7u+9OBAx9Y16yz+ewCI/PRzErH3GA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvdhG19v6zFxd;
	Wed,  5 Jun 2024 20:03:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455K3wP6011547;
	Wed, 5 Jun 2024 20:03:58 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455K3wUt011545;
	Wed, 5 Jun 2024 20:03:58 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 20:03:58 GMT
Message-Id: <202406052003.455K3wUt011545@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: bed59baba2ca - main - nvmf: Pass const pointers to
  namespace data to nvmf_*_ns
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: bed59baba2caaf0bbbee3fed378e469b915e8a15
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=bed59baba2caaf0bbbee3fed378e469b915e8a15

commit bed59baba2caaf0bbbee3fed378e469b915e8a15
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 19:51:37 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 19:51:37 +0000

    nvmf: Pass const pointers to namespace data to nvmf_*_ns
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45457
---
 sys/dev/nvmf/host/nvmf_ns.c  | 5 +++--
 sys/dev/nvmf/host/nvmf_var.h | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/sys/dev/nvmf/host/nvmf_ns.c b/sys/dev/nvmf/host/nvmf_ns.c
index 30acbe815dbe..0727ca960a57 100644
--- a/sys/dev/nvmf/host/nvmf_ns.c
+++ b/sys/dev/nvmf/host/nvmf_ns.c
@@ -313,7 +313,7 @@ static struct cdevsw nvmf_ns_cdevsw = {
 
 struct nvmf_namespace *
 nvmf_init_ns(struct nvmf_softc *sc, uint32_t id,
-    struct nvme_namespace_data *data)
+    const struct nvme_namespace_data *data)
 {
 	struct make_dev_args mda;
 	struct nvmf_namespace *ns;
@@ -454,7 +454,8 @@ nvmf_destroy_ns(struct nvmf_namespace *ns)
 }
 
 bool
-nvmf_update_ns(struct nvmf_namespace *ns, struct nvme_namespace_data *data)
+nvmf_update_ns(struct nvmf_namespace *ns,
+    const struct nvme_namespace_data *data)
 {
 	uint8_t lbads, lbaf;
 
diff --git a/sys/dev/nvmf/host/nvmf_var.h b/sys/dev/nvmf/host/nvmf_var.h
index 64525851631e..e0f6d33d2a73 100644
--- a/sys/dev/nvmf/host/nvmf_var.h
+++ b/sys/dev/nvmf/host/nvmf_var.h
@@ -180,12 +180,12 @@ void	nvmf_ctl_unload(void);
 
 /* nvmf_ns.c */
 struct nvmf_namespace *nvmf_init_ns(struct nvmf_softc *sc, uint32_t id,
-    struct nvme_namespace_data *data);
+    const struct nvme_namespace_data *data);
 void	nvmf_disconnect_ns(struct nvmf_namespace *ns);
 void	nvmf_reconnect_ns(struct nvmf_namespace *ns);
 void	nvmf_destroy_ns(struct nvmf_namespace *ns);
 bool	nvmf_update_ns(struct nvmf_namespace *ns,
-    struct nvme_namespace_data *data);
+    const struct nvme_namespace_data *data);
 
 /* nvmf_qpair.c */
 struct nvmf_host_qpair *nvmf_init_qp(struct nvmf_softc *sc,

From nobody Wed Jun  5 20:03:59 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvdhH4f63z5M3MZ;
	Wed, 05 Jun 2024 20:03:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvdhH2Z77z4jDw;
	Wed,  5 Jun 2024 20:03:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717617839;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=PPCwrE8b8y9pNNwA5UpIRNrpjgKgkdboFyUa+kgToV8=;
	b=xBlnmiWhwrsOwxKQrLvCNy7HlQSN+wPx6ZgQhx1EZhLC09zE1vQKpY6Lg2QzNB3he8M7k6
	dO2RYiG+oZjYvsc1I+YOJ0/qIvDYxquemGfZ48aWtEwLxMElFzUicMnlSdbLWDJorst75w
	I+BFzsb9N7IQ/sXNgpn2fCKYpJZxh+J+0vny1EqjtslQkYfcob2WtRuFWTd/cJ+W8/VFK+
	wtHIJsP8dU6Y7dxDyNLSfSy/M6HXZPPrtY2a4VpBoiUls/4fhtppZ54F8IoLhzPYlM8L5d
	4+EincHtx4A2Ve5Inw5W6KbCfa8Syb9Cq8yJCdbxEoStXm54TxvoO/51RpE1Zw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717617839; a=rsa-sha256; cv=none;
	b=gK2uFJfm014py2bmOUimBV1z9RyD4DecikeaNTvP8N3jK59FDtau5bq1qxOGrIvJwxKAg6
	fXDwG9C//ySIg+O84beE6C4UfW4vKEjE7hDkYF4mC0imPUhF8W7bb//mBnhjDOuXPI+8D3
	z4lQzZ8N6u1J2xA3KcJp8uBA2kdCp6Gh//hVrh/hICqN/qmS8mqSx6os8Ksjj8CkUdn8SD
	0T/ZKEAmzW8XJ3Od5Axi3eAWZx30JbQY19SIo27JNg1AtDiNSQzyOo4vg4/ndDSQRHG7sS
	vJYblfkEM9s3txafKBVkBT/Ku98JXqA6hHftUsCdH+9Rl9tNcFGlkztVus/BbQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717617839;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=PPCwrE8b8y9pNNwA5UpIRNrpjgKgkdboFyUa+kgToV8=;
	b=uie9mrgX7wBl8XUXDDRANfjir8zkP3w8qhjevyEivHHEJei07QjIge7Q95FTrUIm4B+Fko
	XUqFifiZATI1dsd3hxEWz2a7K653pDKdjaWSu7Y8St6mdyrCsmqGvSar8kqWLpcvMG0p7+
	unxkmYCrdGwfUip7as3zdHZJoKJwzOSMCGonmeYQ62effKL3+o2+AoiM+2WaRpW1SZkM95
	Rnn4BrOV8U98+l2UW4BnN5w76bu/zlZuQ4vgNf5t6wZN0bhB3OorNLS2Qj6T+VTFLbulHd
	GTfGZjDPWRYvgexwlbuTu8iMrAUd4l+S+2eWvVzb9qmylypqwnhlsw6B4Vv1oQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvdhH2BR7zGHK;
	Wed,  5 Jun 2024 20:03:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455K3xJq011597;
	Wed, 5 Jun 2024 20:03:59 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455K3x5q011594;
	Wed, 5 Jun 2024 20:03:59 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 20:03:59 GMT
Message-Id: <202406052003.455K3x5q011594@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: 02ddb305cc6d - main - nvmf: Refactor nvmf_add_namespaces
  to be more generic
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 02ddb305cc6d7fc3964e33985ae89501b99bb05b
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=02ddb305cc6d7fc3964e33985ae89501b99bb05b

commit 02ddb305cc6d7fc3964e33985ae89501b99bb05b
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 19:51:56 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 19:51:56 +0000

    nvmf: Refactor nvmf_add_namespaces to be more generic
    
    Rename to nvmf_scan_active_namespaces and accept an additional
    callback function and callback argument.  The callback is invoked on
    each active namespace enumerated by the active namespace list from the
    IDENTIFY command.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45458
---
 sys/dev/nvmf/host/nvmf.c | 74 ++++++++++++++++++++++++++++++------------------
 1 file changed, 47 insertions(+), 27 deletions(-)

diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
index e43d438aaa8c..df07d70b6c86 100644
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -295,9 +295,13 @@ nvmf_establish_connection(struct nvmf_softc *sc, struct nvmf_ivars *ivars)
 	return (0);
 }
 
+typedef bool nvmf_scan_active_ns_cb(struct nvmf_softc *, uint32_t,
+    const struct nvme_namespace_data *, void *);
+
 static bool
-nvmf_scan_nslist(struct nvmf_softc *sc, struct nvme_ns_list *nslist,
-    struct nvme_namespace_data *data, uint32_t *nsidp)
+nvmf_scan_active_nslist(struct nvmf_softc *sc, struct nvme_ns_list *nslist,
+    struct nvme_namespace_data *data, uint32_t *nsidp,
+    nvmf_scan_active_ns_cb *cb, void *cb_arg)
 {
 	struct nvmf_completion_status status;
 	uint32_t nsid;
@@ -333,13 +337,6 @@ nvmf_scan_nslist(struct nvmf_softc *sc, struct nvme_ns_list *nslist,
 			return (true);
 		}
 
-		if (sc->ns[nsid - 1] != NULL) {
-			device_printf(sc->dev,
-			    "duplicate namespace %u in active namespace list\n",
-			    nsid);
-			return (false);
-		}
-
 		nvmf_status_init(&status);
 		nvmf_status_wait_io(&status);
 		if (!nvmf_cmd_identify_namespace(sc, nsid, data, nvmf_complete,
@@ -365,21 +362,9 @@ nvmf_scan_nslist(struct nvmf_softc *sc, struct nvme_ns_list *nslist,
 			return (false);
 		}
 
-		/*
-		 * As in nvme_ns_construct, a size of zero indicates an
-		 * invalid namespace.
-		 */
 		nvme_namespace_data_swapbytes(data);
-		if (data->nsze == 0) {
-			device_printf(sc->dev,
-			    "ignoring active namespace %u with zero size\n",
-			    nsid);
-			continue;
-		}
-
-		sc->ns[nsid - 1] = nvmf_init_ns(sc, nsid, data);
-
-		nvmf_sim_rescan_ns(sc, nsid);
+		if (!cb(sc, nsid, data, cb_arg))
+			return (false);
 	}
 
 	MPASS(nsid == nslist->ns[nitems(nslist->ns) - 1] && nsid != 0);
@@ -392,22 +377,22 @@ nvmf_scan_nslist(struct nvmf_softc *sc, struct nvme_ns_list *nslist,
 }
 
 static bool
-nvmf_add_namespaces(struct nvmf_softc *sc)
+nvmf_scan_active_namespaces(struct nvmf_softc *sc, nvmf_scan_active_ns_cb *cb,
+    void *cb_arg)
 {
 	struct nvme_namespace_data *data;
 	struct nvme_ns_list *nslist;
 	uint32_t nsid;
 	bool retval;
 
-	sc->ns = mallocarray(sc->cdata->nn, sizeof(*sc->ns), M_NVMF,
-	    M_WAITOK | M_ZERO);
 	nslist = malloc(sizeof(*nslist), M_NVMF, M_WAITOK);
 	data = malloc(sizeof(*data), M_NVMF, M_WAITOK);
 
 	nsid = 0;
 	retval = true;
 	for (;;) {
-		if (!nvmf_scan_nslist(sc, nslist, data, &nsid)) {
+		if (!nvmf_scan_active_nslist(sc, nslist, data, &nsid, cb,
+		    cb_arg)) {
 			retval = false;
 			break;
 		}
@@ -420,6 +405,41 @@ nvmf_add_namespaces(struct nvmf_softc *sc)
 	return (retval);
 }
 
+static bool
+nvmf_add_ns(struct nvmf_softc *sc, uint32_t nsid,
+    const struct nvme_namespace_data *data, void *arg __unused)
+{
+	if (sc->ns[nsid - 1] != NULL) {
+		device_printf(sc->dev,
+		    "duplicate namespace %u in active namespace list\n",
+		    nsid);
+		return (false);
+	}
+
+	/*
+	 * As in nvme_ns_construct, a size of zero indicates an
+	 * invalid namespace.
+	 */
+	if (data->nsze == 0) {
+		device_printf(sc->dev,
+		    "ignoring active namespace %u with zero size\n", nsid);
+		return (true);
+	}
+
+	sc->ns[nsid - 1] = nvmf_init_ns(sc, nsid, data);
+
+	nvmf_sim_rescan_ns(sc, nsid);
+	return (true);
+}
+
+static bool
+nvmf_add_namespaces(struct nvmf_softc *sc)
+{
+	sc->ns = mallocarray(sc->cdata->nn, sizeof(*sc->ns), M_NVMF,
+	    M_WAITOK | M_ZERO);
+	return (nvmf_scan_active_namespaces(sc, nvmf_add_ns, NULL));
+}
+
 static int
 nvmf_attach(device_t dev)
 {

From nobody Wed Jun  5 20:04:00 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvdhJ5dc8z5M3Ps;
	Wed, 05 Jun 2024 20:04:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvdhJ3cFCz4jKK;
	Wed,  5 Jun 2024 20:04:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717617840;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=N1slBVglaih0WgTh6jqdMYomYeGg6BXnNr0xwCa+7cM=;
	b=lk7N3eU2FJdJxBvzmFP+99Ogn05gjMtfIOj7LMuxwcZatqPE8M4iH0zgAkfVZcV9NcM2lw
	mpXP1aTElrZJQgsmyIZOEpKeLyHU6RTbhXfKqDrIdUEj460V3nb7ZW+UIrG35UGznLsXyK
	lcQjbzEqPJNVeQEy0PQDO0IfFSfPqaGKK6YaqxOW7I1U7spY/C1/X24JLps3I/7sbDCdmJ
	TKZuOi6qBAwGLZA38w4bBtJN6YtjF29mUar7TsL/9CvFMAbCRemJFUoGeSfwdnP63Q/NBj
	4wEnb4iQdkCheqkrKeCTQSyc8oqmIqqv3vyNCHPqzwWUh27S71sO/3QbOX0gkQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717617840; a=rsa-sha256; cv=none;
	b=nglCPUIbVE7vKcsLHvt2JtFF6A86PnLoepixSC5CbUI2GXzhvhj40Z6cutl9CYaJBIFsrM
	73C6cbJbLfFqqeHaLSrqgtGBSRP2lk39tAO+javGWt2u0xWF0Xj7ud0/XI9jN4vZNifxfL
	iFLCHQxc1e6ojNivH6yElNWtSnCGCbRfPPRKBb6dRK9gkWrhUqVdWS3+WZlal4rBe7LUxX
	snld531xSpnL9Il2wMTF92a08+unhqAEyxRta0+tb3fzdhOlpGtHY68G5Hh7t0IM/pUgH9
	Qe3AUjPsI926hE9Or67E3E1/XGJkFvY44iktF2fxGrXR91++LE9U4N1wfeYYRg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717617840;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=N1slBVglaih0WgTh6jqdMYomYeGg6BXnNr0xwCa+7cM=;
	b=U4FTxfnFgFHqMeZc6ep4TODeH/3GicV+FEuirD9kmjEr+lXzok3V14cXgGUfTF0JhQrwqo
	9E024M20unt8yFz1mV+fpIL294AvD4U8trS1jn1SLiB6O+8jyjSjjB+cWo2ceNoJklH/Y9
	nCPI/73grhh9f5DdyIfAHteCtngYTGk3A7Qig0x9JcBM8mfN8HEoaW8q/PPGcOKiWI6x6x
	FMJ6akd+9xgQz4PXgQxFDYUQlMIW3YjGoaZk9p1pBVXaXZOjYfRgECBAYfjQ9SvfYMo3TY
	T+AB78ZdYqS03Dy/0jrJAjlpqTnIIP57vHBIXBhgOWqBhxeNHtzneguxchsZJg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvdhJ39pqzGMj;
	Wed,  5 Jun 2024 20:04:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455K40UW011664;
	Wed, 5 Jun 2024 20:04:00 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455K4002011660;
	Wed, 5 Jun 2024 20:04:00 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 20:04:00 GMT
Message-Id: <202406052004.455K4002011660@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: 8a082ca89fc0 - main - nvmf: Factor out most of
  nvmf_rescan_ns into a helper routine
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8a082ca89fc007850b302f4eead2f9b6eb2ccbe0
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=8a082ca89fc007850b302f4eead2f9b6eb2ccbe0

commit 8a082ca89fc007850b302f4eead2f9b6eb2ccbe0
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 19:52:24 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 19:52:24 +0000

    nvmf: Factor out most of nvmf_rescan_ns into a helper routine
    
    This function accepts a namespace ID and associated namespace data
    from IDENTIFY and takes care of updating nvmeXnY and ndaZ.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45459
---
 sys/dev/nvmf/host/nvmf.c | 52 ++++++++++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
index df07d70b6c86..086df5f637c9 100644
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -733,12 +733,40 @@ nvmf_detach(device_t dev)
 	return (0);
 }
 
+static void
+nvmf_rescan_ns_1(struct nvmf_softc *sc, uint32_t nsid,
+    const struct nvme_namespace_data *data)
+{
+	struct nvmf_namespace *ns;
+
+	/* XXX: Needs locking around sc->ns[]. */
+	ns = sc->ns[nsid - 1];
+	if (data->nsze == 0) {
+		/* XXX: Needs locking */
+		if (ns != NULL) {
+			nvmf_destroy_ns(ns);
+			sc->ns[nsid - 1] = NULL;
+		}
+	} else {
+		/* XXX: Needs locking */
+		if (ns == NULL) {
+			sc->ns[nsid - 1] = nvmf_init_ns(sc, nsid, data);
+		} else {
+			if (!nvmf_update_ns(ns, data)) {
+				nvmf_destroy_ns(ns);
+				sc->ns[nsid - 1] = NULL;
+			}
+		}
+	}
+
+	nvmf_sim_rescan_ns(sc, nsid);
+}
+
 void
 nvmf_rescan_ns(struct nvmf_softc *sc, uint32_t nsid)
 {
 	struct nvmf_completion_status status;
 	struct nvme_namespace_data *data;
-	struct nvmf_namespace *ns;
 
 	data = malloc(sizeof(*data), M_NVMF, M_WAITOK);
 
@@ -771,29 +799,9 @@ nvmf_rescan_ns(struct nvmf_softc *sc, uint32_t nsid)
 
 	nvme_namespace_data_swapbytes(data);
 
-	/* XXX: Needs locking around sc->ns[]. */
-	ns = sc->ns[nsid - 1];
-	if (data->nsze == 0) {
-		/* XXX: Needs locking */
-		if (ns != NULL) {
-			nvmf_destroy_ns(ns);
-			sc->ns[nsid - 1] = NULL;
-		}
-	} else {
-		/* XXX: Needs locking */
-		if (ns == NULL) {
-			sc->ns[nsid - 1] = nvmf_init_ns(sc, nsid, data);
-		} else {
-			if (!nvmf_update_ns(ns, data)) {
-				nvmf_destroy_ns(ns);
-				sc->ns[nsid - 1] = NULL;
-			}
-		}
-	}
+	nvmf_rescan_ns_1(sc, nsid, data);
 
 	free(data, M_NVMF);
-
-	nvmf_sim_rescan_ns(sc, nsid);
 }
 
 int

From nobody Wed Jun  5 20:04:01 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvdhK6hL7z5M3Zn;
	Wed, 05 Jun 2024 20:04:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvdhK4jSQz4jBX;
	Wed,  5 Jun 2024 20:04:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717617841;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=t+PathxO4z6yerhIeVXY0zEEQ0oVDRHjaoYDJ+1uRS8=;
	b=KzzwVaoSVk9Pfr5DSTKnVBapkdSkwhsOn+5tYLJf3dBwVIGdsOi8ui+O5sNdhTH4QoDkwC
	EXgZZDcAoP24ybF9u2RN9bSoByuzZcrWIUH0NYdkyyELFcUVzqccwDvj4OocLPEte91eV3
	5vyG/wFLNqiemSErLuR+zQjvoCKYQsiK0LyuetR0SGCYdbbiX60TdUCzVl2fXe9RRcHsII
	HNvG1JkyrJJE9l+mQ8TBtM9cDUnfGOdt26mZEBb4E8JIU7V3hQt1RqSPRz3b9gR+kiBlwu
	hBQeKmZM0WLh5hfk6j7oLqhzXcJ0Bn6ouahISapL+pOrgLq5gypQavd5mAo7+Q==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717617841; a=rsa-sha256; cv=none;
	b=ttYP9AnTXYlYEUeKpYh7IzHXUkoYWXUSYmtBCx98B9jhzl8pIO30fMj3X8MxuqDctsTN97
	NO4ybIKaAdZ6+TQ2CGzk9dwAzI0FRz7HN+1n3NCeqGVkJbWzTyYR2Cz0MB6i39LhzddpGC
	Mc29kM+8uumqeWp0TtYTP7ALss205TqsX5N5e5hhevHvAlSONbUYdql3nQ7CdvKPLlrKbe
	if5kua/y46o3cdqDkXUC+7hG238GU+d0GTK0sEQUNE6ZUg/VSEM7GGVDV8ZuVBZmFkIlhs
	uDC8V3eQAnEY7ee54gFBFXUHSM+CdmTdSnVhF0b6zVtPZkvQSsaWNofSi97MyA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717617841;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=t+PathxO4z6yerhIeVXY0zEEQ0oVDRHjaoYDJ+1uRS8=;
	b=G1iQSEZbD6kF7z9i5UzgUidFd8vU66vYOEOJ6yfu7ygmcf0XySqrLNc+7KAzlpsVwESN3J
	/V/gw5vjd11jw0k1zFPAyzg47gKXjHEGE3mUv/M0uX9h+IjYlhwjYyh4y8/uBogDInTUR0
	JHAhj+cHxJLw++0gJzXA94jOJJQjxH1sw+5MwybiC50e8tGe8PSEJTRnyXgziac8cwF5fC
	/D1yMa/DgReD2KQzB2w+tZ6udqau48SjXiWvMXlplssCrsVs6MG7osOM1vk+OfFkDQ7rEu
	BRYoxLDO6IGDeAytnvsPUIaiK/6shzgVNuNMaQbFGGWiUzTgL7owAq372peEPw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvdhK4FgVzGMk;
	Wed,  5 Jun 2024 20:04:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455K414S011736;
	Wed, 5 Jun 2024 20:04:01 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455K41wc011733;
	Wed, 5 Jun 2024 20:04:01 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 20:04:01 GMT
Message-Id: <202406052004.455K41wc011733@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: f6d434f110fd - main - nvmf: Rescan all namespaces if
  the changed NS log page is too large
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: f6d434f110fd95e346f18fb09a6f91f36b528d2d
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=f6d434f110fd95e346f18fb09a6f91f36b528d2d

commit f6d434f110fd95e346f18fb09a6f91f36b528d2d
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 19:52:43 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 19:52:43 +0000

    nvmf: Rescan all namespaces if the changed NS log page is too large
    
    Previously this just punted with a warning message.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45460
---
 sys/dev/nvmf/host/nvmf.c     | 49 ++++++++++++++++++++++++++++++++++++++++++++
 sys/dev/nvmf/host/nvmf_aer.c |  2 +-
 sys/dev/nvmf/host/nvmf_var.h |  1 +
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
index 086df5f637c9..1e7fce42b2a3 100644
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -804,6 +804,55 @@ nvmf_rescan_ns(struct nvmf_softc *sc, uint32_t nsid)
 	free(data, M_NVMF);
 }
 
+static void
+nvmf_purge_namespaces(struct nvmf_softc *sc, uint32_t first_nsid,
+    uint32_t next_valid_nsid)
+{
+	struct nvmf_namespace *ns;
+
+	for (uint32_t nsid = first_nsid; nsid < next_valid_nsid; nsid++)
+	{
+		/* XXX: Needs locking around sc->ns[]. */
+		ns = sc->ns[nsid - 1];
+		if (ns != NULL) {
+			nvmf_destroy_ns(ns);
+			sc->ns[nsid - 1] = NULL;
+
+			nvmf_sim_rescan_ns(sc, nsid);
+		}
+	}
+}
+
+static bool
+nvmf_rescan_ns_cb(struct nvmf_softc *sc, uint32_t nsid,
+    const struct nvme_namespace_data *data, void *arg)
+{
+	uint32_t *last_nsid = arg;
+
+	/* Check for any gaps prior to this namespace. */
+	nvmf_purge_namespaces(sc, *last_nsid + 1, nsid);
+	*last_nsid = nsid;
+
+	nvmf_rescan_ns_1(sc, nsid, data);
+	return (true);
+}
+
+void
+nvmf_rescan_all_ns(struct nvmf_softc *sc)
+{
+	uint32_t last_nsid;
+
+	last_nsid = 0;
+	if (!nvmf_scan_active_namespaces(sc, nvmf_rescan_ns_cb, &last_nsid))
+		return;
+
+	/*
+	 * Check for any namespace devices after the last active
+	 * namespace.
+	 */
+	nvmf_purge_namespaces(sc, last_nsid + 1, sc->cdata->nn + 1);
+}
+
 int
 nvmf_passthrough_cmd(struct nvmf_softc *sc, struct nvme_pt_command *pt,
     bool admin)
diff --git a/sys/dev/nvmf/host/nvmf_aer.c b/sys/dev/nvmf/host/nvmf_aer.c
index 4c950f1518d0..2f7f177d0421 100644
--- a/sys/dev/nvmf/host/nvmf_aer.c
+++ b/sys/dev/nvmf/host/nvmf_aer.c
@@ -62,7 +62,7 @@ nvmf_handle_changed_namespaces(struct nvmf_softc *sc,
 	 * probably just rescan the entire set of namespaces.
 	 */
 	if (ns_list->ns[0] == 0xffffffff) {
-		device_printf(sc->dev, "too many changed namespaces\n");
+		nvmf_rescan_all_ns(sc);
 		return;
 	}
 
diff --git a/sys/dev/nvmf/host/nvmf_var.h b/sys/dev/nvmf/host/nvmf_var.h
index e0f6d33d2a73..2fa0216baab8 100644
--- a/sys/dev/nvmf/host/nvmf_var.h
+++ b/sys/dev/nvmf/host/nvmf_var.h
@@ -148,6 +148,7 @@ int	nvmf_init_ivars(struct nvmf_ivars *ivars, struct nvmf_handoff_host *hh);
 void	nvmf_free_ivars(struct nvmf_ivars *ivars);
 void	nvmf_disconnect(struct nvmf_softc *sc);
 void	nvmf_rescan_ns(struct nvmf_softc *sc, uint32_t nsid);
+void	nvmf_rescan_all_ns(struct nvmf_softc *sc);
 int	nvmf_passthrough_cmd(struct nvmf_softc *sc, struct nvme_pt_command *pt,
     bool admin);
 

From nobody Wed Jun  5 20:04:02 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvdhM14Vjz5M3KG;
	Wed, 05 Jun 2024 20:04:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvdhL59Rbz4jKj;
	Wed,  5 Jun 2024 20:04:02 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717617842;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=HJAFgsvxrSHwNkZL9Y0egHHd3wSsFr5GorsuzGIPNlY=;
	b=ueHzZQt9ro3Vev9UZcDpLFivPfsCKqeraGSNdI2ODg1Pk1F/QPuWJu6mtN33qmiEWcLUYz
	AAKmlZ90oEcf/EKVAduBa5+F9+jBng01YeiW7d8HtqzEqcMcLrQHAxfLO81w5ApebDrvOl
	OVdbDBKiyPUajjzD0f4pzEfeSImu7hFymSOeK4jL4DO9BeViZ7pme4QIwi1qpsoUI7+uW3
	iHY5S4zkWfEqYUITZrpASd7FLT65uig3yeKqaSamozrC3M+HxUxYPeT8T2LPQFMg54Sq+I
	x2497k64BIBFX0OByna9dLKzzWSIj9MnkfLauvJGMzccwdQKtZyGjI/XTzgM5g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717617842; a=rsa-sha256; cv=none;
	b=P0Ju5Ebo9HQtlvF8ufsxQLAowIWFH7pPnYMq6JjaJYV+JzAKMOpqjvSM/WMxMg6UaMOBuQ
	c0kwI5F+6QbADthPtMUmDhkT5nuPI6TMH2bEreFj5YEeM/bAZXbLsRh78mvXMnEjh3afrL
	4lkMN+Z3BvZHCFH+C0NmaFpiHlOJsx98V3sQw5DWi9hz9+QQgJw8BvVcKoUR959Qp4+45w
	CVVFSnZVDUG0l+w9jC+Sru9b4sJcHG8lzj5uuPeZUg6KG9bIFFE0t7DpINKQ4Vet9b9mpA
	D1gXgyOd0LXkNx85vU4hBIrL0h2pTc/JX7dsCUNkwowcwfu3hTAoDikUjt0yMw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717617842;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=HJAFgsvxrSHwNkZL9Y0egHHd3wSsFr5GorsuzGIPNlY=;
	b=mupCYKNr+BqWF5OsUXjwWuWoAV+LLNLf/VosdYL+IMg7TpfE4JiY5zBCerM1NC+UB/8hFv
	eI/ej6F45ox8Ra/+D0hMrqTl9cVWUNDSB+ipkUdd4/wVMdKwiNr/sHTujGcT5Ng0CLwAaJ
	cUO2OXeIqHbkP3yXb5F1GMI3RiSRYiIoQWk/1qkxAOYgUFhL99Y3YB3Jr866jwIqYiXNvb
	RR+T2nd3DTl9Tx0HB9i/OY48TSgn/XUGJ7q9goXApcp66MX8d/9TVa+0kERei8OYPjFPFb
	wwRgcdPAuGOSBsxzV8Gk5+JFVw+lbKyljknO7Iubpzfpq54RnAhOSV3qg9enwQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvdhL4nCTzGHL;
	Wed,  5 Jun 2024 20:04:02 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455K42T6011778;
	Wed, 5 Jun 2024 20:04:02 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455K420i011775;
	Wed, 5 Jun 2024 20:04:02 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 20:04:02 GMT
Message-Id: <202406052004.455K420i011775@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: e140f85dc194 - main - nvmf: Rescan namespaces after
  reconnecting
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: e140f85dc1941ecdfb35f49f0d7f97b24e2a54ea
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=e140f85dc1941ecdfb35f49f0d7f97b24e2a54ea

commit e140f85dc1941ecdfb35f49f0d7f97b24e2a54ea
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 19:53:08 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 19:53:08 +0000

    nvmf: Rescan namespaces after reconnecting
    
    While a host was disconnected from a remote controller, namespaces
    might have been added, removed, or altered properties.  Rescan the
    namespaces after reconnecting to detect any such changes.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45461
---
 sys/dev/nvmf/host/nvmf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
index 1e7fce42b2a3..9684170c1de9 100644
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -685,6 +685,8 @@ nvmf_reconnect_host(struct nvmf_softc *sc, struct nvmf_handoff_host *hh)
 			nvmf_reconnect_ns(sc->ns[i]);
 	}
 	nvmf_reconnect_sim(sc);
+
+	nvmf_rescan_all_ns(sc);
 out:
 	sx_xunlock(&sc->connection_lock);
 	nvmf_free_ivars(&ivars);

From nobody Wed Jun  5 20:04:03 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvdhN0Jrjz5M3Mg;
	Wed, 05 Jun 2024 20:04:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvdhM5zmWz4jHb;
	Wed,  5 Jun 2024 20:04:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717617843;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=4o++ehul8RtFicrGyxP+rNauncusG1yCJkw85m+vLV0=;
	b=q3/OYQ1412nqkPctkGPgUOW3HQNa2CY7JynFjtpURnkL43uSLUhqczKgZvnHpKEWDxQIVO
	4lKa0iMqAsID/0BQIE5xKe0JfGVpyUwDxxqL6hSI5ZV/w6ode1dE83vpXtMqL5+IFOKof0
	omfVAmApWZZc1w9pXbgEHIj1SfN6NXpp8+HbyxS8RLxjmY/dJPRblxNQEAUtiA8KPyOjuG
	M6u4huRLZ4PJ8tARKvhzY/h55izaKxCpBf1OULPYCGm3I9NnZXPIK7Z5pK/HwraEfubtcu
	Ho3Ve3UtgmZsutoPq3HBXLWL0rGfOFqj3tOspQCqcVc8uSzA9WR9KX5ublbHOg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717617843; a=rsa-sha256; cv=none;
	b=h9UiqwVQYDYNk5kvhhzK/r+eXaCbVVfnVX7OpRC/evHoRwggBN5mmFWtaL50BcvYGl1uvJ
	Pzyc1vCMyP50mXslos15wwsh3OhhZylLedpkLPSmJ55l5kGn8y0lt8oNE8Isxi7Ww8pynI
	XsIo6nkLsK/+iUxD7+5/xhFl77sZ7btukUSD5RpC+Ig5C4eV0EFb7KtHzc1jzhcc5kZzoz
	lAi3vXInWuX04fXkIVFlTAK1WBwTV6+Fg1I/37JNhU6KvqxEeEmflZcMWUr8ZvzNxWm1Hw
	eBlZ16SgSbzE4iAxU/mVaGGtgit65gu/F5bkLFxqzKCkKhX+yJBC6N0gw0MnLw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717617843;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=4o++ehul8RtFicrGyxP+rNauncusG1yCJkw85m+vLV0=;
	b=mjMYFARAgHGwLcECe8LtIBfgTeNy6KTSfOWgeqtYAhIiPREzWWIYepvr4QolL28MVabUGR
	ram88dBvjv0kstUG8d1F1UWTkC12+NOaYoVo6pHzGlSSbfL7e0T8GrW8foC8FsZU+Kh8qY
	V1Pb5wI+8tckx0uscexJ0FwUNt5AlA6EWP16wEe6RhTX+2Zwe1jCdE36tkvn5OBDtjrxN9
	yBajCM+Huz2X5sBO+kcnzod934uevAOtAxn0OJUXUCE8YU5cscurhuf03i1Jf5IOY58D0x
	XofQVTy6dYx++FN6ptURPCK4uPTP05dhlqmSDKI5mlCZ/y220UveD58Fu6agig==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvdhM5YfyzG9n;
	Wed,  5 Jun 2024 20:04:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455K43Yo011833;
	Wed, 5 Jun 2024 20:04:03 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455K43i6011830;
	Wed, 5 Jun 2024 20:04:03 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 20:04:03 GMT
Message-Id: <202406052004.455K43i6011830@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: aacaeeee8ecd - main - nvmf: Permit failing I/O requests
  while disconnected
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: aacaeeee8ecd7084a33b2d8e140aad37b3b0eddc
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=aacaeeee8ecd7084a33b2d8e140aad37b3b0eddc

commit aacaeeee8ecd7084a33b2d8e140aad37b3b0eddc
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 19:54:15 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 19:59:07 +0000

    nvmf: Permit failing I/O requests while disconnected
    
    Add a kern.nvmf.fail_on_disconnection sysctl similar to the
    kern.iscsi.fail_on_disconnection sysctl.  This causes pending I/O
    requests to fail with an error if an association is disconnected
    instead of requeueing to be retried once the association is
    reconnected.  As with iSCSI, the default is to queue and retry
    operations.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45308
---
 share/man/man4/nvmf.4        | 24 +++++++++++++++++++++++-
 sys/dev/nvmf/host/nvmf.c     |  5 +++++
 sys/dev/nvmf/host/nvmf_ns.c  | 25 ++++++++++++++++++++-----
 sys/dev/nvmf/host/nvmf_sim.c | 10 ++++++++--
 sys/dev/nvmf/host/nvmf_var.h |  3 +++
 5 files changed, 59 insertions(+), 8 deletions(-)

diff --git a/share/man/man4/nvmf.4 b/share/man/man4/nvmf.4
index 8afbb4d9daaf..298365acefa9 100644
--- a/share/man/man4/nvmf.4
+++ b/share/man/man4/nvmf.4
@@ -3,7 +3,7 @@
 .\"
 .\" Copyright (c) 2024 Chelsio Communications, Inc.
 .\"
-.Dd May 2, 2024
+.Dd June 5, 2024
 .Dt NVMF 4
 .Os
 .Sh NAME
@@ -65,6 +65,28 @@ disk driver.
 Associations require a supported transport such as
 .Xr nvmf_tcp 4
 for associations using TCP/IP.
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va kern.nvmf.fail_on_disconnection
+Determines the behavior when an association's connection is interrupted.
+By default, input/output operations are suspended while a host is disconnected.
+This includes operations pending at the time the association's connection was
+interrupted as well as new requests submitted while the host is disconnected.
+Once a new association is established, suspended I/O requests are retried.
+When set to 1, input/output operations fail with
+.Er EIO
+while a host is disconnected and
+.Xr nda 4
+peripherals are destroyed after the first failed I/O request.
+Note that any destroyed
+.Xr nda 4
+peripherals will be recreated after a new association is established.
+.El
 .Sh SEE ALSO
 .Xr nda 4 ,
 .Xr nvme 4 ,
diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
index 9684170c1de9..c309836ed8a8 100644
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -15,6 +15,7 @@
 #include <sys/module.h>
 #include <sys/mutex.h>
 #include <sys/sx.h>
+#include <sys/sysctl.h>
 #include <sys/taskqueue.h>
 #include <dev/nvme/nvme.h>
 #include <dev/nvmf/nvmf.h>
@@ -23,6 +24,10 @@
 
 static struct cdevsw nvmf_cdevsw;
 
+bool nvmf_fail_disconnect = false;
+SYSCTL_BOOL(_kern_nvmf, OID_AUTO, fail_on_disconnection, CTLFLAG_RWTUN,
+    &nvmf_fail_disconnect, 0, "Fail I/O requests on connection failure");
+
 MALLOC_DEFINE(M_NVMF, "nvmf", "NVMe over Fabrics host");
 
 static void	nvmf_disconnect_task(void *arg, int pending);
diff --git a/sys/dev/nvmf/host/nvmf_ns.c b/sys/dev/nvmf/host/nvmf_ns.c
index 0727ca960a57..8381cc4aec54 100644
--- a/sys/dev/nvmf/host/nvmf_ns.c
+++ b/sys/dev/nvmf/host/nvmf_ns.c
@@ -84,13 +84,22 @@ nvmf_ns_biodone(struct bio *bio)
 	ns = bio->bio_dev->si_drv1;
 
 	/* If a request is aborted, resubmit or queue it for resubmission. */
-	if (bio->bio_error == ECONNABORTED) {
+	if (bio->bio_error == ECONNABORTED && !nvmf_fail_disconnect) {
 		bio->bio_error = 0;
 		bio->bio_driver2 = 0;
 		mtx_lock(&ns->lock);
 		if (ns->disconnected) {
-			TAILQ_INSERT_TAIL(&ns->pending_bios, bio, bio_queue);
-			mtx_unlock(&ns->lock);
+			if (nvmf_fail_disconnect) {
+				mtx_unlock(&ns->lock);
+				bio->bio_error = ECONNABORTED;
+				bio->bio_flags |= BIO_ERROR;
+				bio->bio_resid = bio->bio_bcount;
+				biodone(bio);
+			} else {
+				TAILQ_INSERT_TAIL(&ns->pending_bios, bio,
+				    bio_queue);
+				mtx_unlock(&ns->lock);
+			}
 		} else {
 			mtx_unlock(&ns->lock);
 			nvmf_ns_strategy(bio);
@@ -163,6 +172,7 @@ nvmf_ns_submit_bio(struct nvmf_namespace *ns, struct bio *bio)
 	struct nvme_dsm_range *dsm_range;
 	struct memdesc mem;
 	uint64_t lba, lba_count;
+	int error;
 
 	dsm_range = NULL;
 	memset(&cmd, 0, sizeof(cmd));
@@ -201,10 +211,15 @@ nvmf_ns_submit_bio(struct nvmf_namespace *ns, struct bio *bio)
 
 	mtx_lock(&ns->lock);
 	if (ns->disconnected) {
-		TAILQ_INSERT_TAIL(&ns->pending_bios, bio, bio_queue);
+		if (nvmf_fail_disconnect) {
+			error = ECONNABORTED;
+		} else {
+			TAILQ_INSERT_TAIL(&ns->pending_bios, bio, bio_queue);
+			error = 0;
+		}
 		mtx_unlock(&ns->lock);
 		free(dsm_range, M_NVMF);
-		return (0);
+		return (error);
 	}
 
 	req = nvmf_allocate_request(nvmf_select_io_queue(ns->sc), &cmd,
diff --git a/sys/dev/nvmf/host/nvmf_sim.c b/sys/dev/nvmf/host/nvmf_sim.c
index 00dad07889d1..71bb71dd4063 100644
--- a/sys/dev/nvmf/host/nvmf_sim.c
+++ b/sys/dev/nvmf/host/nvmf_sim.c
@@ -40,7 +40,10 @@ nvmf_ccb_done(union ccb *ccb)
 		return;
 
 	if (nvmf_cqe_aborted(&ccb->nvmeio.cpl)) {
-		ccb->ccb_h.status = CAM_REQUEUE_REQ;
+		if (nvmf_fail_disconnect)
+			ccb->ccb_h.status = CAM_DEV_NOT_THERE;
+		else
+			ccb->ccb_h.status = CAM_REQUEUE_REQ;
 		xpt_done(ccb);
 	} else if (ccb->nvmeio.cpl.status != 0) {
 		ccb->ccb_h.status = CAM_NVME_STATUS_ERROR;
@@ -106,7 +109,10 @@ nvmf_sim_io(struct nvmf_softc *sc, union ccb *ccb)
 	mtx_lock(&sc->sim_mtx);
 	if (sc->sim_disconnected) {
 		mtx_unlock(&sc->sim_mtx);
-		nvmeio->ccb_h.status = CAM_REQUEUE_REQ;
+		if (nvmf_fail_disconnect)
+			nvmeio->ccb_h.status = CAM_DEV_NOT_THERE;
+		else
+			nvmeio->ccb_h.status = CAM_REQUEUE_REQ;
 		xpt_done(ccb);
 		return;
 	}
diff --git a/sys/dev/nvmf/host/nvmf_var.h b/sys/dev/nvmf/host/nvmf_var.h
index 2fa0216baab8..cf88d2f7b01e 100644
--- a/sys/dev/nvmf/host/nvmf_var.h
+++ b/sys/dev/nvmf/host/nvmf_var.h
@@ -140,6 +140,9 @@ extern driver_t nvme_nvmf_driver;
 MALLOC_DECLARE(M_NVMF);
 #endif
 
+/* If true, I/O requests will fail while the host is disconnected. */
+extern bool nvmf_fail_disconnect;
+
 /* nvmf.c */
 void	nvmf_complete(void *arg, const struct nvme_completion *cqe);
 void	nvmf_io_complete(void *arg, size_t xfered, int error);

From nobody Wed Jun  5 20:04:04 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvdhP1Ryyz5M3Ml;
	Wed, 05 Jun 2024 20:04:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvdhP05y3z4jQ8;
	Wed,  5 Jun 2024 20:04:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717617845;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=fKTjLDKvCJ66V9sz/J9lGIlKD3JVaVf2Ves/hsniPWA=;
	b=s0vAHAywlGgUvlJxpGQog/DVRQ4lCEBrimtPVUhuE/XDZukqT4t7om0NkyUq8g6y5TX9ZT
	4gPwqDmTWeOdV2kRL4j/+r4gptWjit7gd+bArmuVZORgNxYx3nG5Z2anDC673mazOT6dtK
	AiiPzpsm7cosBXlqGVxWNGdSfYY+wX7LS0FO22ZIx53QfOhcpcMDc+EiJknarK/KDq0iiY
	pNhrmICgiFqnDW5DgvUrGYrR3/i4zxngJazXzzcrndxPKWY7FdDmxBYp4DNmFVrTVbjLA3
	ueMsROORJglM+QbIPOReY84BiCO2raLidvImJpLEvHI0lrhTlHTbNdxe5niBGg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717617845; a=rsa-sha256; cv=none;
	b=QjE/IIueje2AT5B4asQDxDUqemS6GR/q4awcsCUAx6P9YDOGeMnjQobDtxbEHi0+fv+xPz
	Iw/W0vTk2shXhyG1dEGJnFbVvWzr+il4KNeQiyxLjSkd9gLgDUuTeRVeKb3wvW0V+T/IDC
	DeZC+B8yLUPfP5+4cfH54WgUAyYeVYqJLCbqzIOG7/1LJc/Tzp5k9vuqAvEImVRRZK3CiP
	/NYKTpld/2iZYc4aQcGBgB1yN5mmg1kQl4YihOSed2qoXytro96MU61rBgwLYa1XitBTj2
	qbM8JI+sjoejkSVxEkDnXt1Icv+duvah0bvoA8mqbhQTw35SsmSJkKrXCbbQlw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717617845;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=fKTjLDKvCJ66V9sz/J9lGIlKD3JVaVf2Ves/hsniPWA=;
	b=wxXbI+LKHYw6CXtUxR24ymybx+qyAFnvmp4CeZw7dAUwaJ++HrMHCjKJyRNnYUd1ARcVRD
	OYxqdlLOygR+b2Pda8rcIK4ysIcXuieQpo9WVUkGGy8nxqF58nHf220CurH5sXyh/Nah92
	G9srdPVLvv5rhCbJSfEK89CbkDky237jK64cRfzmrr9VKp12DBPedNE7kTX/T/cjVpxKrs
	NpVGD5zmD2YTqxfI0I0S1KBsduZYsiCl9WlsLhbxasu77ZfXlhgercZ2Vx87ey3cg1mf1v
	B6wu28RZzlbbBY/z5Q0I9e2FK2+/lB+MdJB+nIP1TcBoED2HD2rEOpnHNx4n2w==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvdhN6qW6zGMl;
	Wed,  5 Jun 2024 20:04:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455K44tF011875;
	Wed, 5 Jun 2024 20:04:04 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455K44Hk011872;
	Wed, 5 Jun 2024 20:04:04 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 20:04:04 GMT
Message-Id: <202406052004.455K44Hk011872@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: John Baldwin <jhb@FreeBSD.org>
Subject: git: f46d4971b5af - main - nvmf: Handle shutdowns more
  gracefully
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jhb
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: f46d4971b5afdfecef3ae5979d7c96e9817aedee
Auto-Submitted: auto-generated

The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=f46d4971b5afdfecef3ae5979d7c96e9817aedee

commit f46d4971b5afdfecef3ae5979d7c96e9817aedee
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-06-05 19:59:28 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-06-05 19:59:28 +0000

    nvmf: Handle shutdowns more gracefully
    
    If an association is disconnected during a clean shutdown, abort all
    pending and future I/O requests with an error to avoid hangs either due
    to filesystem unmounts or a stuck GEOM event.
    
    If an association is connected during a clean shutdown, gracefully
    disconnect from the remote controller and close the open queues.
    
    Reviewed by:    imp
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D45462
---
 sys/dev/nvmf/host/nvmf.c     | 71 ++++++++++++++++++++++++++++++++++++++++++--
 sys/dev/nvmf/host/nvmf_ns.c  | 27 +++++++++++++++--
 sys/dev/nvmf/host/nvmf_sim.c | 16 ++++++++--
 sys/dev/nvmf/host/nvmf_var.h |  7 +++++
 4 files changed, 114 insertions(+), 7 deletions(-)

diff --git a/sys/dev/nvmf/host/nvmf.c b/sys/dev/nvmf/host/nvmf.c
index c309836ed8a8..47cdbe7e47fd 100644
--- a/sys/dev/nvmf/host/nvmf.c
+++ b/sys/dev/nvmf/host/nvmf.c
@@ -8,12 +8,14 @@
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
+#include <sys/eventhandler.h>
 #include <sys/lock.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/memdesc.h>
 #include <sys/module.h>
 #include <sys/mutex.h>
+#include <sys/reboot.h>
 #include <sys/sx.h>
 #include <sys/sysctl.h>
 #include <sys/taskqueue.h>
@@ -31,6 +33,8 @@ SYSCTL_BOOL(_kern_nvmf, OID_AUTO, fail_on_disconnection, CTLFLAG_RWTUN,
 MALLOC_DEFINE(M_NVMF, "nvmf", "NVMe over Fabrics host");
 
 static void	nvmf_disconnect_task(void *arg, int pending);
+static void	nvmf_shutdown_pre_sync(void *arg, int howto);
+static void	nvmf_shutdown_post_sync(void *arg, int howto);
 
 void
 nvmf_complete(void *arg, const struct nvme_completion *cqe)
@@ -528,6 +532,11 @@ nvmf_attach(device_t dev)
 		goto out;
 	}
 
+	sc->shutdown_pre_sync_eh = EVENTHANDLER_REGISTER(shutdown_pre_sync,
+	    nvmf_shutdown_pre_sync, sc, SHUTDOWN_PRI_FIRST);
+	sc->shutdown_post_sync_eh = EVENTHANDLER_REGISTER(shutdown_post_sync,
+	    nvmf_shutdown_post_sync, sc, SHUTDOWN_PRI_FIRST);
+
 	return (0);
 out:
 	if (sc->ns != NULL) {
@@ -698,6 +707,62 @@ out:
 	return (error);
 }
 
+static void
+nvmf_shutdown_pre_sync(void *arg, int howto)
+{
+	struct nvmf_softc *sc = arg;
+
+	if ((howto & RB_NOSYNC) != 0 || SCHEDULER_STOPPED())
+		return;
+
+	/*
+	 * If this association is disconnected, abort any pending
+	 * requests with an error to permit filesystems to unmount
+	 * without hanging.
+	 */
+	sx_xlock(&sc->connection_lock);
+	if (sc->admin != NULL || sc->detaching) {
+		sx_xunlock(&sc->connection_lock);
+		return;
+	}
+
+	for (u_int i = 0; i < sc->cdata->nn; i++) {
+		if (sc->ns[i] != NULL)
+			nvmf_shutdown_ns(sc->ns[i]);
+	}
+	nvmf_shutdown_sim(sc);
+	sx_xunlock(&sc->connection_lock);
+}
+
+static void
+nvmf_shutdown_post_sync(void *arg, int howto)
+{
+	struct nvmf_softc *sc = arg;
+
+	if ((howto & RB_NOSYNC) != 0 || SCHEDULER_STOPPED())
+		return;
+
+	/*
+	 * If this association is connected, disconnect gracefully.
+	 */
+	sx_xlock(&sc->connection_lock);
+	if (sc->admin == NULL || sc->detaching) {
+		sx_xunlock(&sc->connection_lock);
+		return;
+	}
+
+	callout_drain(&sc->ka_tx_timer);
+	callout_drain(&sc->ka_rx_timer);
+
+	nvmf_shutdown_controller(sc);
+	for (u_int i = 0; i < sc->num_io_queues; i++) {
+		nvmf_destroy_qp(sc->io[i]);
+	}
+	nvmf_destroy_qp(sc->admin);
+	sc->admin = NULL;
+	sx_xunlock(&sc->connection_lock);
+}
+
 static int
 nvmf_detach(device_t dev)
 {
@@ -710,6 +775,9 @@ nvmf_detach(device_t dev)
 	sc->detaching = true;
 	sx_xunlock(&sc->connection_lock);
 
+	EVENTHANDLER_DEREGISTER(shutdown_pre_sync, sc->shutdown_pre_sync_eh);
+	EVENTHANDLER_DEREGISTER(shutdown_pre_sync, sc->shutdown_post_sync_eh);
+
 	nvmf_destroy_sim(sc);
 	for (i = 0; i < sc->cdata->nn; i++) {
 		if (sc->ns[i] != NULL)
@@ -1006,9 +1074,6 @@ static device_method_t nvmf_methods[] = {
 	DEVMETHOD(device_probe,     nvmf_probe),
 	DEVMETHOD(device_attach,    nvmf_attach),
 	DEVMETHOD(device_detach,    nvmf_detach),
-#if 0
-	DEVMETHOD(device_shutdown,  nvmf_shutdown),
-#endif
 	DEVMETHOD_END
 };
 
diff --git a/sys/dev/nvmf/host/nvmf_ns.c b/sys/dev/nvmf/host/nvmf_ns.c
index 8381cc4aec54..87cb4fa68001 100644
--- a/sys/dev/nvmf/host/nvmf_ns.c
+++ b/sys/dev/nvmf/host/nvmf_ns.c
@@ -29,6 +29,7 @@ struct nvmf_namespace {
 	u_int	flags;
 	uint32_t lba_size;
 	bool disconnected;
+	bool shutdown;
 
 	TAILQ_HEAD(, bio) pending_bios;
 	struct mtx lock;
@@ -89,7 +90,7 @@ nvmf_ns_biodone(struct bio *bio)
 		bio->bio_driver2 = 0;
 		mtx_lock(&ns->lock);
 		if (ns->disconnected) {
-			if (nvmf_fail_disconnect) {
+			if (nvmf_fail_disconnect || ns->shutdown) {
 				mtx_unlock(&ns->lock);
 				bio->bio_error = ECONNABORTED;
 				bio->bio_flags |= BIO_ERROR;
@@ -211,7 +212,7 @@ nvmf_ns_submit_bio(struct nvmf_namespace *ns, struct bio *bio)
 
 	mtx_lock(&ns->lock);
 	if (ns->disconnected) {
-		if (nvmf_fail_disconnect) {
+		if (nvmf_fail_disconnect || ns->shutdown) {
 			error = ECONNABORTED;
 		} else {
 			TAILQ_INSERT_TAIL(&ns->pending_bios, bio, bio_queue);
@@ -429,6 +430,28 @@ nvmf_reconnect_ns(struct nvmf_namespace *ns)
 	}
 }
 
+void
+nvmf_shutdown_ns(struct nvmf_namespace *ns)
+{
+	TAILQ_HEAD(, bio) bios;
+	struct bio *bio;
+
+	mtx_lock(&ns->lock);
+	ns->shutdown = true;
+	TAILQ_INIT(&bios);
+	TAILQ_CONCAT(&bios, &ns->pending_bios, bio_queue);
+	mtx_unlock(&ns->lock);
+
+	while (!TAILQ_EMPTY(&bios)) {
+		bio = TAILQ_FIRST(&bios);
+		TAILQ_REMOVE(&bios, bio, bio_queue);
+		bio->bio_error = ECONNABORTED;
+		bio->bio_flags |= BIO_ERROR;
+		bio->bio_resid = bio->bio_bcount;
+		biodone(bio);
+	}
+}
+
 void
 nvmf_destroy_ns(struct nvmf_namespace *ns)
 {
diff --git a/sys/dev/nvmf/host/nvmf_sim.c b/sys/dev/nvmf/host/nvmf_sim.c
index 71bb71dd4063..4bf68553cb49 100644
--- a/sys/dev/nvmf/host/nvmf_sim.c
+++ b/sys/dev/nvmf/host/nvmf_sim.c
@@ -40,7 +40,10 @@ nvmf_ccb_done(union ccb *ccb)
 		return;
 
 	if (nvmf_cqe_aborted(&ccb->nvmeio.cpl)) {
-		if (nvmf_fail_disconnect)
+		struct cam_sim *sim = xpt_path_sim(ccb->ccb_h.path);
+		struct nvmf_softc *sc = cam_sim_softc(sim);
+
+		if (nvmf_fail_disconnect || sc->sim_shutdown)
 			ccb->ccb_h.status = CAM_DEV_NOT_THERE;
 		else
 			ccb->ccb_h.status = CAM_REQUEUE_REQ;
@@ -109,7 +112,7 @@ nvmf_sim_io(struct nvmf_softc *sc, union ccb *ccb)
 	mtx_lock(&sc->sim_mtx);
 	if (sc->sim_disconnected) {
 		mtx_unlock(&sc->sim_mtx);
-		if (nvmf_fail_disconnect)
+		if (nvmf_fail_disconnect || sc->sim_shutdown)
 			nvmeio->ccb_h.status = CAM_DEV_NOT_THERE;
 		else
 			nvmeio->ccb_h.status = CAM_REQUEUE_REQ;
@@ -325,6 +328,15 @@ nvmf_reconnect_sim(struct nvmf_softc *sc)
 	xpt_release_simq(sc->sim, 1);
 }
 
+void
+nvmf_shutdown_sim(struct nvmf_softc *sc)
+{
+	mtx_lock(&sc->sim_mtx);
+	sc->sim_shutdown = true;
+	mtx_unlock(&sc->sim_mtx);
+	xpt_release_simq(sc->sim, 1);
+}
+
 void
 nvmf_destroy_sim(struct nvmf_softc *sc)
 {
diff --git a/sys/dev/nvmf/host/nvmf_var.h b/sys/dev/nvmf/host/nvmf_var.h
index cf88d2f7b01e..adf6d8bde3d9 100644
--- a/sys/dev/nvmf/host/nvmf_var.h
+++ b/sys/dev/nvmf/host/nvmf_var.h
@@ -9,6 +9,7 @@
 #define	__NVMF_VAR_H__
 
 #include <sys/_callout.h>
+#include <sys/_eventhandler.h>
 #include <sys/_lock.h>
 #include <sys/_mutex.h>
 #include <sys/_sx.h>
@@ -42,6 +43,7 @@ struct nvmf_softc {
 	struct cam_path *path;
 	struct mtx sim_mtx;
 	bool sim_disconnected;
+	bool sim_shutdown;
 
 	struct nvmf_namespace **ns;
 
@@ -82,6 +84,9 @@ struct nvmf_softc {
 
 	u_int num_aer;
 	struct nvmf_aer *aer;
+
+	eventhandler_tag shutdown_pre_sync_eh;
+	eventhandler_tag shutdown_post_sync_eh;
 };
 
 struct nvmf_request {
@@ -187,6 +192,7 @@ struct nvmf_namespace *nvmf_init_ns(struct nvmf_softc *sc, uint32_t id,
     const struct nvme_namespace_data *data);
 void	nvmf_disconnect_ns(struct nvmf_namespace *ns);
 void	nvmf_reconnect_ns(struct nvmf_namespace *ns);
+void	nvmf_shutdown_ns(struct nvmf_namespace *ns);
 void	nvmf_destroy_ns(struct nvmf_namespace *ns);
 bool	nvmf_update_ns(struct nvmf_namespace *ns,
     const struct nvme_namespace_data *data);
@@ -206,6 +212,7 @@ void	nvmf_free_request(struct nvmf_request *req);
 int	nvmf_init_sim(struct nvmf_softc *sc);
 void	nvmf_disconnect_sim(struct nvmf_softc *sc);
 void	nvmf_reconnect_sim(struct nvmf_softc *sc);
+void	nvmf_shutdown_sim(struct nvmf_softc *sc);
 void	nvmf_destroy_sim(struct nvmf_softc *sc);
 void	nvmf_sim_rescan_ns(struct nvmf_softc *sc, uint32_t id);
 

From nobody Wed Jun  5 20:30:37 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvfH50VkNz5M7Hg;
	Wed, 05 Jun 2024 20:30:41 +0000 (UTC)
	(envelope-from se@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)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "smtp.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvfH502GXz4nnh;
	Wed,  5 Jun 2024 20:30:41 +0000 (UTC)
	(envelope-from se@freebsd.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717619441;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
	bh=0kZJAdXndUPlDtx397APW9r192YaSOwSUAy5uW2KlYM=;
	b=TOBWMRNi1FOMtqzdoi6cBwkLLmb6XXUrIULd9KdYi0B4ckHz5fn3iEgshYpszOEzHLtMDJ
	l5FP4pkgvsDfLXkKVtsQNhZNmjoa+VVSbLr0GQvpqndNAOsXKn9kor0zUS7bh9Lg/s2AJS
	nYlImpeLgnUIYib0YP/95WypP+tREsBm5ykbRyG3cXFpFZ8/QJdQa2DNMkA6zwHXsHUqck
	3GO4UWxVokf+rcpQbG2y8Wv8bTSKJbgywjAOhhdKq+pIH13rNlTHRAAqiOfzgyxtU8zEM2
	xN1NGcGQSeV/gnbhCfuGscQMbjBQ/Z/lAs2AvvrO09sdcVfelz3Nbyh1ohutqQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717619441; a=rsa-sha256; cv=none;
	b=m/tz8uzkv4Qv4x6vE2/7jun3zmhVk6PLmooywcY8iUYsj/P4UXVQtdQKjTyHLWHTE3Vpzr
	2aHmyFEQ/PO2jDskW/TQLbLJqwSS9bD3WVYKifnDqfLHa5YXbwczPKBCObQ9VRTCb1ukHn
	uFhC3ojY5xABqQLFkF+chfma7bTpf2OtwAMYBSWyxXY46Yy1S7BuWeZWmQWqQ8SyXceV9a
	ps7adA2dI3N4YXIBpOA/4zDsx8+1Wvf+p9s2f3WFtmj9K5NZc4saNETxdYiwp4foP3CPIe
	v8mCcPAUOmpmVbuBzd+iobVUklBaRKAK+cEQ54nsTklc5Dv3FGFf9cvyQp/SwQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717619441;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:autocrypt:autocrypt;
	bh=0kZJAdXndUPlDtx397APW9r192YaSOwSUAy5uW2KlYM=;
	b=V5/454Xw78ou/jpSWif4ljDoRXBS5bXJgp4B1i68p45n177ra07Ix73ECMnCzhKj4ScZ0x
	YQEM1MTti1XJx1wQrNMTCfQSgAMJBXMjUIp+GG+0uzxq6U8ewj/9sTCIpqQ7UbcjeNHaZL
	ibH96b165if+Pm90GdK+8DcKVjCyfCnAAhcrBtoB1KzLfRBga0rBUKGF0AqHbV/SocQgJv
	+zA0foASM3vFjM3rvQfFgGSUm5yWvJyYaYFx1SHG0vAU3PDkUYi7Oul8sXjLjDwWMD3Ye0
	mZ0z7K3Q+/E+roPxRESw5/zrAxQGCrhjcqJDoNe2z4RTWF1/FjmImlJVC0cFFw==
Received: from [192.168.119.168] (p5dc83c4c.dip0.t-ipconnect.de [93.200.60.76])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	(Authenticated sender: se/mail)
	by smtp.freebsd.org (Postfix) with ESMTPSA id 4VvfH407JQz14wB;
	Wed,  5 Jun 2024 20:30:39 +0000 (UTC)
	(envelope-from se@freebsd.org)
Message-ID: <ad4e777f-6ad0-45f0-870b-d0ecf3bb4842@freebsd.org>
Date: Wed, 5 Jun 2024 22:30:37 +0200
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
From: =?UTF-8?Q?Stefan_E=C3=9Fer?= <se@freebsd.org>
Subject: Re: git: 077f757d72e5 - main - newfs_msdos: align data area to VM
 page boundary by default
To: Konstantin Belousov <kostikbel@gmail.com>,
 Jessica Clarke <jrtc27@freebsd.org>, Shawn Webb <shawn.webb@hardenedbsd.org>
Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
References: <202406021227.452CRx8I007470@gitrepo.freebsd.org>
 <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org>
 <adf5a6cd-e57b-44eb-ae7b-a0233ae6fd4b@FreeBSD.org>
 <Zl-UWbgDf-tnY6WF@kib.kiev.ua>
Content-Language: de-DE, en-US
Autocrypt: addr=se@freebsd.org; keydata=
 xsBNBFVxiRIBCADOLNOZBsqlplHUQ3tG782FNtVT33rQli9EjNt2fhFERHIo4NxHlWBpHLnU
 b0s4L/eItx7au0i7Gegv01A9LUMwOnAc9EFAm4EW3Wmoa6MYrcP7xDClohg/Y69f7SNpEs3x
 YATBy+L6NzWZbJjZXD4vqPgZSDuMcLU7BEdJf0f+6h1BJPnGuwHpsSdnnMrZeIM8xQ8PPUVQ
 L0GZkVojHgNUngJH6e21qDrud0BkdiBcij0M3TCP4GQrJ/YMdurfc8mhueLpwGR2U1W8TYB7
 4UY+NLw0McThOCLCxXflIeF/Y7jSB0zxzvb/H3LWkodUTkV57yX9IbUAGA5RKRg9zsUtABEB
 AAHNJ1N0ZWZhbiBFw59lciAoRnJlZUJTRCkgPHNlQGZyZWVic2Qub3JnPsLAlAQTAQoAPgIb
 AwULCQgHAwUVCgkICwUWAwIBAAIeAQIXgBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJi0bAY
 BQkRFV8GAAoJEEfrte9a/fVEQ5QH/2vbvHK+cHQwMSag2dE+XG2yKhT4QZeW66BUkozyr8Lk
 a5M4MyUEIVGQ4qAJvHmNj06rNbm+2MxjtpSeXUm1fG9Z80Z6XYH06uEGc4dVhA0ymqw482CE
 LmFrJk7S2Z+jkKpacj3jM13CjRgHLmmXfWO7CZYAMW67pSWmZe+lbhvV5Ibe1mircZ9xA9iu
 R1yyBcgz9KqPogFwPdat1TxakMirrSZeIK+5M1rtDggajD71teKuy1OBcklTZ8fmShPvxbcN
 nGydEKgkrTrPufqO6hkdWXd+aV0W+uUi0GBtGi2C1KTLfKdiZ7rZDUAJYKu6yaX0OphEBRTE
 6pVXVrsHvCvOwE0EVXGJEgEIALEj9qCXMZVucjpcd3QxM/TlUr98m5viEd1z4tCnPUyRWcIC
 EVtj2h5xMH+2iB0q1+KWhq+NsWtvScmEmfHnsr7dJ1K677OdpDhKVaJk61eeRulFY1R4yb6C
 1MMxK+WgYB+vvpG0UeyR0M4uBewcPvRsq4yGUHFQKtLAbMdoPTSryJA+ElnmK1vdY+rPcHgi
 OIMBZM7ahsPXC0C9K4e5SP9clGyIoMpbfHXdx9q+Rp3zVtlbhyk3BS/xccu/+9pk9ICXL6GR
 js2sNnJ0wxdU1DsAlC59a5MnSruwiZFwRnkQhr3x6wk97Lg7sLS9jjTnCN7LGlVmSmpOEMy6
 uq1AWfUAEQEAAcLAhgQYAQoAJgIbDBYhBKNx6mWcC+zIK3FTE0frte9a/fVEBQJi0bAYBQkR
 FV8GABQJEEfrte9a/fVECRBH67XvWv31RG6eB/90wdtbV0K+wVHIngodybOFFXGUGd/d0XlS
 E8xK7AB5gJZp5Db+R0n3bt/ZX2WA9RiE+5oTCYSuq4nwb8n4CVDGXLIuLg/j8U7/zZi31pkQ
 +lK3Fos8g1tqmc/tAdwoGJh/VDcEeLt3Xk7c02Cq/zDnr7mOn2Ocq//APKPMLWcFdAkU6D1n
 7W2SOS/tBw47w9nvQyCp+An2cZ5CEL9UUgusITGeoXnknFOnCeXhYWDBcafZ/xheIsAxx21K
 gtTJev3Vk3FTxvi05MDV3Rl/14gpmB9iQSBGGY47MrECsRIo2o0Q3QUlxS1OuXfiL/yewDEH
 a2LZaRRJsgZ6l7xWtKnu
In-Reply-To: <Zl-UWbgDf-tnY6WF@kib.kiev.ua>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Am 05.06.24 um 00:25 schrieb Konstantin Belousov:
> On Tue, Jun 04, 2024 at 08:39:16AM +0200, Stefan Eßer wrote:
>> Am 03.06.24 um 19:25 schrieb Jessica Clarke:
>>> On 2 Jun 2024, at 13:27, Stefan Eßer <se@FreeBSD.org> wrote:
>>>>
>>>> The branch main has been updated by se:
>>>>
>>>> URL: https://cgit.FreeBSD.org/src/commit/?id=077f757d72e561eb84193d8e58f63e96e69b8096
>>>>
>>>> commit 077f757d72e561eb84193d8e58f63e96e69b8096
>>>> Author:     Stefan Eßer <se@FreeBSD.org>
>>>> AuthorDate: 2024-06-02 12:07:52 +0000
>>>> Commit:     Stefan Eßer <se@FreeBSD.org>
>>>> CommitDate: 2024-06-02 12:07:52 +0000
>>>>
>>>>      newfs_msdos: align data area to VM page boundary by default
>> [...]
>>>
>>> Hi,
>>> This has completely broken[1] all of the Linux and macOS cross-build CI
>>> jobs (which pass -DWITH_DISK_IMAGE_TOOLS_BOOTSTRAP). Please either fix
>>> this promptly or back it out until you can do so.
>>>
>>> Jess
>>>
>>> [1] See https://github.com/freebsd/freebsd-src/actions/runs/9338256762
>>
>> Thank you for the report and sorry for the breakage.
>>
>> This should be fixed in commit 41ee91c64f47faaa by skipping the
>> alignment of the data area, if PAGE_SIZE is not defined.
>>
>> An alternative approach would have been to define PAGE_SIZE to a
>> sane default value of 4096 (as used on most current architectures
>> by default), if not set in the build environment.
>>
>> If there is consensus that this would be more appropriate (since
>> it matches what the man page says), I'd revert the latest commit
>> and instead of it commit the following change:
> I believe this is a better approach.
> It does not unexpectedly hide some code.

There is an even simpler solution, which restores identical build
results on FreeBSD, MacOS, and Linux:

Always adjusting to a multiple of the cluster size works for all
page sizes. Adjusting to a granularity of > 4 KB is not required
to fix the buffer cache misalignment, but large clusters are only
useful on very large volumes (i.e., with more than 2000 clusters,
else a smaller cluster would be more efficient).

I have updated the previous review:

	https://reviews.freebsd.org/D45436

index 1bca560a59e1..dcc2bb982efc 100644
--- a/sbin/newfs_msdos/mkfs_msdos.c
+++ b/sbin/newfs_msdos/mkfs_msdos.c
@@ -568,14 +568,7 @@
             x1 += (bpb.bpbBigFATsecs - 1) * bpb.bpbFATs;
         }
         if (set_res) {
-           if (o.align)
-               alignto = bpb.bpbSecPerClust;
-           else
-#ifdef PAGE_SIZE
-               alignto = PAGE_SIZE / bpb.bpbBytesPerSec;
-#else
-               alignto = 1;
-#endif
+           alignto = bpb.bpbSecPerClust;
             if (alignto > 1) {
                 /* align data clusters */

Best regards, STefan

From nobody Wed Jun  5 22:05:43 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvhNl5W6lz5Kxq2;
	Wed, 05 Jun 2024 22:05:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvhNl4VwCz431H;
	Wed,  5 Jun 2024 22:05:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717625143;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=hbzNGL+1+5nlMmC2w+P7YD9ODjhdCMmFeUESseFF9xE=;
	b=j/5x8HiPUiKgNwEtb2dR1GhQmwnVboUynnDNsimVOnVPZvZ0+I55y5OXv1RIdujbIvDXir
	SJH7XKDeI7mX9Ahbt07ZlSvTj9CeB5tEAojHiqb8VKN/8RBSKC7FCwBfFKddrn5xMF+8BP
	3Z4V0O1qz2SQpPM2VZT9gtsECC2N0oXD+3Ua+p0fFY75UV69ISDOq1qS2k3qGl2V3EkfRi
	dChAsesrk3zs+KwoQ31A0f/X4yPqpXD+h90YBYzPqr9XaPlpRx+DGOT9TWRw5ERnRs3mq1
	ILI4LrpfSEgpAeF1I0/1GZnMHLD4epUOCpMYhtOeJf4XJZh78jxNi/Rl8Dp76w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717625143; a=rsa-sha256; cv=none;
	b=a9x+iyogAePoLlFe+rybH4zeumnp+0lX+5mCOPz3EF35lvlo76vG4WUNhMadJUhBzx0b2g
	o6OLUEPTGi80r721ZOd/q518CmCaEVb8nZ+WZEV362zK0CMS0HgW+8jSHOkKl+PXHQc4WO
	l7kbIZYMDZk7ppjQRxPs+t0bn8k1Ft+cT+tek4bMlSZCZqjHtlZfuyrz8qS62WR6yoCeS0
	RCEOJs6a8S/ZkF1QT/BqRNxBKNOmTJnEDt2vzAaRTxixgtwoSLoIVRUTw/1WHVQ/bbmabu
	8biHn1Je1WOCWx8vcKlnRyHvhuhb4Vg50z6GB3pPbPokm9UC4y8xR3JBbCzdJg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717625143;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=hbzNGL+1+5nlMmC2w+P7YD9ODjhdCMmFeUESseFF9xE=;
	b=vXG0p+UXRZzz5vx02Ut8VV/lP3fxCzszG18VAGU0zl926vWxYyor7Tt2mEP/4Z+uAKG9U2
	VNcnWPOFprQ8/zC0/ZKF4rKzCLixY0HLUhPx7DMVIG+u2dFi7gPsuHrJikNOx1re0Is10q
	3OjH49iU6DZDgao6E96vilENQKXuR6LT7lYUdlonWgYoRBRKNQ/jSnqOzlHtnN8crAc9Qz
	uLSIeAaxeo0Fco8QsIcUobRQbl0Cl+CCkHCgNG+kbB4LcuoWkatBgoZrklMSH3ErLKVOlh
	Tya1Gs7jf1qVYozjOAXVLTf+K7SldLAxL7j1K3OoVeyXSxa6nhXcMCzv18q3gA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvhNl45xNzKMm;
	Wed,  5 Jun 2024 22:05:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455M5hmD014777;
	Wed, 5 Jun 2024 22:05:43 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455M5hwJ014774;
	Wed, 5 Jun 2024 22:05:43 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 22:05:43 GMT
Message-Id: <202406052205.455M5hwJ014774@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: "Bjoern A. Zeeb" <bz@FreeBSD.org>
Subject: git: 9e012a9da5df - main - iwn(4): correct debug message:
  "not" to "no"
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: bz
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 9e012a9da5df131b64c2dfd7d9b6645af4ccef0f
Auto-Submitted: auto-generated

The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e012a9da5df131b64c2dfd7d9b6645af4ccef0f

commit 9e012a9da5df131b64c2dfd7d9b6645af4ccef0f
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2024-06-05 22:01:06 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-06-05 22:05:12 +0000

    iwn(4): correct debug message: "not" to "no"
    
    Sponosred by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/dev/iwn/if_iwn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c
index 3b1d879914b6..d2d44d93f948 100644
--- a/sys/dev/iwn/if_iwn.c
+++ b/sys/dev/iwn/if_iwn.c
@@ -7532,7 +7532,7 @@ iwn_addba_request(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap,
 			break;
 	}
 	if (qid == sc->ntxqs) {
-		DPRINTF(sc, IWN_DEBUG_XMIT, "%s: not free aggregation queue\n",
+		DPRINTF(sc, IWN_DEBUG_XMIT, "%s: no free aggregation queue\n",
 		    __func__);
 		return 0;
 	}

From nobody Wed Jun  5 22:18:43 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvhgl3mnpz5L0kL;
	Wed, 05 Jun 2024 22:18:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvhgl3Fq4z44Pf;
	Wed,  5 Jun 2024 22:18:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717625923;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=jV6XFC4pI7cBdlHAHQp8bNCAyfDlj1x381K1GsD+asQ=;
	b=Rzf/aYDWPsHqTVtO+vCNxxTuYt5QLO/ZaBIDkIR91QdgMiOmYo0NZmcOYi65LVmdzUDxl5
	YqUfdoziXyPSLSVRGKvpse0m+9u7Kce+Z1el9o+ECxPKxkTx1cEMaDjrfTX0TbkIUl6f4p
	ZbGqdbLvU6wMSROpibh8CTU6c/8l7rn4EjAJgSdiFw7zA6ziRoM79wCsC2Jad6Q3MG+iKb
	25p27k928r8aLyvwLNbKmqmJySehQ8M4P7yx2P0uzQQYTqwhJefw5EG81NM8fbzBjsBMxc
	iXA0cffVCjIrpiNE/B3UcsVDo4dqG3UUIlg+A8oqJqZNDkwp/T76nlvLUaPQag==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717625923; a=rsa-sha256; cv=none;
	b=doN1TrX7xAwc9Bx7793DIe+ntZ8x0D4LCJe0bObVMYI2h8Bzi6zp7DIXsKdLQhgrKoEaUU
	6H6PWThCgZZVCgZTlXwyo02lIgEukKs3HBBQhUUhMP3/PT+SO3C4lASKNh/u6GoLt5xEGf
	by/JtBOluFhivq7tyXdlWsFTJGoignoGYsNHZ6tjV2VyME9FMfEd2NOnfpgJ6WuwDNdANN
	lZOEPRmpANXDxzaioGLeB8gwYkJayaxLRwjJaedhVcFfFEjY/SLR9Ey9Ugu7RPnoD+PoiK
	Exytm5+Q8NE2dQgpG1kGFJH1SbSa7YhyX9PDefLbHUfJEC0sIznORMCcgz2jlw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717625923;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=jV6XFC4pI7cBdlHAHQp8bNCAyfDlj1x381K1GsD+asQ=;
	b=BJLRm5ZcWNZZpAAAllHCgEZ2m9gWEgcSUKqe7u7pkGkRmlTZtBAVkJhtZVbQRbteFHX9Aq
	iBak3900x7UpOchk6oAY17mQn7+DtsiAF3UiLyNlLIBe96q2bX9ikYM9X3G+Bqtwn7/uLZ
	rRfYkSw8tnIS0Z42zF+gF2lFRfYJhNzh9YYclhlX5eEfOSzx5pXSJozhPHuOIPQM4qhKop
	GXDywpq4KljsymkxPaDPccR+NicXODuAS7T0oK4jCLWPInquvSady1FtHiV7n9wkNKG4o9
	Qly6LY1IURgCBVEDWEekbMqC8PAM1DYUpOReL7OpT4V+iLyzK0rMM1fRM7IjEA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vvhgl2kFdzKnb;
	Wed,  5 Jun 2024 22:18:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 455MIhQ7032459;
	Wed, 5 Jun 2024 22:18:43 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 455MIhld032456;
	Wed, 5 Jun 2024 22:18:43 GMT
	(envelope-from git)
Date: Wed, 5 Jun 2024 22:18:43 GMT
Message-Id: <202406052218.455MIhld032456@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Mark Johnston <markj@FreeBSD.org>
Subject: git: c70c791f0660 - main - drm2: Remove one more implementation
  of ilog2()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: markj
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: c70c791f06601309201f6ca99d39fee83f5dd368
Auto-Submitted: auto-generated

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=c70c791f06601309201f6ca99d39fee83f5dd368

commit c70c791f06601309201f6ca99d39fee83f5dd368
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-06-05 22:18:19 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-06-05 22:18:19 +0000

    drm2: Remove one more implementation of ilog2()
    
    Reviewed by:    dougm
    Fixes:          b0056b31e900 ("libkern: add ilog2 macro")
    Differential Revision:  https://reviews.freebsd.org/D45504
---
 sys/dev/drm2/drm_os_freebsd.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sys/dev/drm2/drm_os_freebsd.h b/sys/dev/drm2/drm_os_freebsd.h
index 0ce0dede6d73..58523a33da2a 100644
--- a/sys/dev/drm2/drm_os_freebsd.h
+++ b/sys/dev/drm2/drm_os_freebsd.h
@@ -297,13 +297,6 @@ get_unaligned_le32(const void *p)
 }
 #endif
 
-static inline unsigned long
-ilog2(unsigned long x)
-{
-
-	return (flsl(x) - 1);
-}
-
 int64_t		timeval_to_ns(const struct timeval *tv);
 struct timeval	ns_to_timeval(const int64_t nsec);
 

From nobody Wed Jun  5 23:42:34 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvkXn0PGgz5MFff;
	Wed, 05 Jun 2024 23:42:49 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvkXm15gsz4F4k;
	Wed,  5 Jun 2024 23:42:48 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=gmail.com header.s=20230601 header.b="S/E7zBeA";
	dmarc=pass (policy=none) header.from=gmail.com;
	spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::42f as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com
Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-702555eb23bso297077b3a.1;
        Wed, 05 Jun 2024 16:42:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1717630966; x=1718235766; darn=freebsd.org;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:from:to:cc:subject:date:message-id:reply-to;
        bh=nFtoAyUPiUCXH7nmY86cSpfWKxW42/JBUi7XrjAE8r4=;
        b=S/E7zBeAu79qCSzNXc6eCTs7R3454o7HOYAE7IRXw4CSChsHy08aOq68VHuCUKdts0
         X71ttyveJMRVjAMo0uEU/tisfWu5mUD6IQ7VZQlAN1gRfVoURXAukDwf+U+J/5unikLw
         g2ZoMoPPY51xVYXLEgKQ1JM1yHQjVxw0D7tHuljx/hImPhDclYdmsusOWoGID8RsfQTZ
         0H6q5mriUK2Ny+HWLXKWBOxmLROCdawKNv8o2bmd/inK/pwMlueQZccu34j7gC/xLX/8
         Am0XrqeYms40miGzar+Qclz0Gg8UcZ3jvGu1mIV1mgfY7lz7kWonGwcr9IcODwpmYjkp
         /uLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717630966; x=1718235766;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
        bh=nFtoAyUPiUCXH7nmY86cSpfWKxW42/JBUi7XrjAE8r4=;
        b=B0Z0XLH5/JU6DJHfxs+RxA5TcUYod9v/2QEnB+yh6uaFK2XeW9oXN0GzEVajHEeJ0O
         Z9DA2dY1+mb3zqfxXpZKrkNOPBjLeJ2evoe9URp6o5YraM+MieZXhGxjERX3acYqAHz4
         AUYUy185cwCzXB/5WjaYDE96tKqja08grPviy5zmRxQ4FBjuezCKK84E5I9PcmZs8HHw
         1BgFUINvuaF+rW056vL40l0tSXOEsDLrSkJeP3sTEmqRXuHJDkFl+MfOtLlGQDJQo29R
         IOSyOjLtPS35TTvw57Su0OkW26Z7STxPcEqRrHYqzLR3Toz4XYpla9pmOgCaqnGaX/lN
         mLXQ==
X-Forwarded-Encrypted: i=1; AJvYcCUIlXtdko/cAKVCgMGkcKr/6JKHiczPtMiQiXoDfho8vHXBXvhpgOMBg0DyHq5EWtbXGXAp0q6BfTPXFdF4Q8Ti4RYKXIOnikLgppL4ve2vPOrAXBWB0J+MZXKJKd1KzbGp6kqcMjWpbaxc3Li6dixeVw==
X-Gm-Message-State: AOJu0YwrirTy+vPAWC+hbKpyVdFbSUsANK+15/fFATbpeRi9+91RHrNM
	rUnHbU/TySO02us9Lp3/CDT65aODZhqn88CfFxVfV1u5pbjxwsiJuCrskA==
X-Google-Smtp-Source: AGHT+IGK+qUG/XfSUWw8KyC86yCUCNrmBh/3QxS6nGf6MMkb05MyiZda8NOg6FPWMpKDTBK6Y3Jhig==
X-Received: by 2002:a05:6a21:1f03:b0:1a7:7358:f108 with SMTP id adf61e73a8af0-1b2b6fdfc5dmr4143045637.24.1717630965866;
        Wed, 05 Jun 2024 16:42:45 -0700 (PDT)
Received: from smtpclient.apple ([162.118.1.182])
        by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-703fd53e0d0sm50424b3a.211.2024.06.05.16.42.45
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 05 Jun 2024 16:42:45 -0700 (PDT)
From: Enji Cooper <yaneurabeya@gmail.com>
Message-Id: <DDB66592-97E1-47FF-8613-831DB0823A7D@gmail.com>
Content-Type: multipart/signed;
	boundary="Apple-Mail=_DBDAF988-3B9B-4D64-AF2B-11B57B8F70DB";
	protocol="application/pgp-signature";
	micalg=pgp-sha256
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD
 systems
Date: Wed, 5 Jun 2024 16:42:34 -0700
In-Reply-To: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
To: =?utf-8?Q?Stefan_E=C3=9Fer?= <se@freebsd.org>
References: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spamd-Bar: -----
X-Spamd-Result: default: False [-5.05 / 15.00];
	SIGNED_PGP(-2.00)[];
	NEURAL_HAM_LONG(-1.00)[-1.000];
	NEURAL_HAM_MEDIUM(-1.00)[-1.000];
	DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
	R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601];
	MIME_GOOD(-0.20)[multipart/signed,multipart/alternative,text/plain];
	R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c];
	NEURAL_SPAM_SHORT(0.05)[0.046];
	RCVD_TLS_LAST(0.00)[];
	TO_DN_EQ_ADDR_SOME(0.00)[];
	TO_MATCH_ENVRCPT_ALL(0.00)[];
	ARC_NA(0.00)[];
	TO_DN_SOME(0.00)[];
	MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:~];
	FREEMAIL_ENVFROM(0.00)[gmail.com];
	FREEMAIL_FROM(0.00)[gmail.com];
	FROM_HAS_DN(0.00)[];
	HAS_ATTACHMENT(0.00)[];
	DWL_DNSWL_NONE(0.00)[gmail.com:dkim];
	MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org];
	RCVD_COUNT_TWO(0.00)[2];
	FROM_EQ_ENVFROM(0.00)[];
	DKIM_TRACE(0.00)[gmail.com:+];
	MID_RHS_MATCH_FROM(0.00)[];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	APPLE_MAILER_COMMON(0.00)[];
	RCPT_COUNT_THREE(0.00)[4];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
	RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::42f:from]
X-Rspamd-Queue-Id: 4VvkXm15gsz4F4k


--Apple-Mail=_DBDAF988-3B9B-4D64-AF2B-11B57B8F70DB
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7"


--Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Jun 3, 2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer <se@freebsd.org> =
wrote:
>=20
> The branch main has been updated by se:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a
>=20
> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
> Author:     Stefan E=C3=9Fer <se@FreeBSD.org>
> AuthorDate: 2024-06-04 06:26:09 +0000
> Commit:     Stefan E=C3=9Fer <se@FreeBSD.org>
> CommitDate: 2024-06-04 06:26:09 +0000
>=20
>    newfs_msdos: fix build on non-FreeBSD systems
>=20
>    Disable data area alignment if the build environment does not =
define
>    PAGE_SIZE (e.g., when building on Linux or macOS).
>=20
>    Reported by:    jrtc27
>    MFC after:      1 week
> ---
> sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
> 1 file changed, 4 insertions(+)
>=20
> diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c
> index 423fbbcadcc5..1bca560a59e1 100644
> --- a/sbin/newfs_msdos/mkfs_msdos.c
> +++ b/sbin/newfs_msdos/mkfs_msdos.c
> @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, =
const struct msdos_options *op)
> 	    if (o.align)
> 		alignto =3D bpb.bpbSecPerClust;
> 	    else
> +#ifdef	PAGE_SIZE
> 		alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec;
> +#else
> +	        alignto =3D 1;
> +#endif
> 	    if (alignto > 1) {
> 		/* align data clusters */
> 		alignment =3D (bpb.bpbResSectors + bpb.bpbBigFATsecs * =
bpb.bpbFATs + rds) %

	I realize this might seem silly, but what about =
sysconf(_SC_PAGE_SIZE) ( =
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html =
) with platforms that don=E2=80=99t have direct access to PAGE_SIZE? =
It=E2=80=99s supported on Linux and MacOS at least.
Cheers,
-Enji=

--Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><br><div><blockquote type=3D"cite"><div>On Jun 3, =
2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer &lt;se@freebsd.org&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div><div>The branch =
main has been updated by se:<br><br>URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a<br><br>commit =
41ee91c64f47faaa8131df3cd8a63bdb60fa486a<br>Author: =
&nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>AuthorDate: 2024-06-04 06:26:09 =
+0000<br>Commit: &nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>CommitDate: 2024-06-04 06:26:09 +0000<br><br> =
&nbsp;&nbsp;&nbsp;newfs_msdos: fix build on non-FreeBSD systems<br><br> =
&nbsp;&nbsp;&nbsp;Disable data area alignment if the build environment =
does not define<br> &nbsp;&nbsp;&nbsp;PAGE_SIZE (e.g., when building on =
Linux or macOS).<br><br> &nbsp;&nbsp;&nbsp;Reported by: =
&nbsp;&nbsp;&nbsp;jrtc27<br> &nbsp;&nbsp;&nbsp;MFC after: =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 week<br>---<br> =
sbin/newfs_msdos/mkfs_msdos.c | 4 ++++<br> 1 file changed, 4 =
insertions(+)<br><br>diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c<br>index 423fbbcadcc5..1bca560a59e1 =
100644<br>--- a/sbin/newfs_msdos/mkfs_msdos.c<br>+++ =
b/sbin/newfs_msdos/mkfs_msdos.c<br>@@ -571,7 +571,11 @@ mkfs_msdos(const =
char *fname, const char *dtype, const struct msdos_options *op)<br> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;if (o.align)<br> <span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>alignto =3D =
bpb.bpbSecPerClust;<br> <span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;else<br>+#ifdef<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>PAGE_SIZE<br> <span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>alignto =3D=
 PAGE_SIZE / bpb.bpbBytesPerSec;<br>+#else<br>+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alignto =3D 1;<br>+#endif<br> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;if (alignto &gt; 1) {<br> <span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>/* align data clusters */<br> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>alignment =3D (bpb.bpbResSectors + bpb.bpbBigFATsecs * =
bpb.bpbFATs + rds) %<br></div></div></blockquote></div><br><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>I realize =
this might seem silly, but what about sysconf(_SC_PAGE_SIZE) (&nbsp;<a =
href=3D"https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf=
.html">https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.=
html</a>&nbsp;) with platforms that don=E2=80=99t have direct access to =
PAGE_SIZE? It=E2=80=99s supported on Linux and MacOS at =
least.</div><div>Cheers,</div><div>-Enji</div></body></html>=

--Apple-Mail=_2177F822-964E-4C5D-AF25-53AE6A5914A7--

--Apple-Mail=_DBDAF988-3B9B-4D64-AF2B-11B57B8F70DB
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZg9+oACgkQGpE5DjPs
NJgtuw/9HG0/1ATJAV4mWm6dO5t41uHH11gAj3ONXPEjG962AFQaYQf8C0p+o0sM
KxsIuA325Uvh20cZTItSkHX5s580Kc+nVl3zt7lbqs8ye1uwbOyf7EaQ2p2tjYwK
/SZrAZ1ac2MHrYjnz+tH1QemCKWzwhFFCRO4rClAh8mN/BoHkIG9gptDn8kMjVTv
K91KpVi7p8R6yWq6GkFbvX18Dz56aJMfvs8wQey1ReHcCwkVaQSo4EZR9Rncj1pM
ajm5m/hy6q5VAsQEWq26qH6ZP09ZjI24g9+PqggFRhCVImDxPKmJlN3UXuIbLMqg
lZPgd/BxTEOw/8gR/Uk2O44IXVdiIZVQbTNZzKZII7bzHAR+s9SiwAupyLuUY/Lu
RX5B1wa9UdoUCxw6HVf40UVy/Ycln763OBNBWjvdmIo3vvLPTzknafNvNlr3w0H9
aXHwKqjKPu6O3LH5uTm1udEGbeHP4pFwLTz0GZPI0fI2nQCTICLVDyXD4SnRR445
/gBNMeI9MIm3RCjTbaONqLjJmYoLCFE7W8NHCbDi1sCOGE+xThKfFL276t+gpPCa
s1IIr6aXV9MiRQIWvDtKbgDQlAdks4qHbIUALAzyTjWUD75IoFcg5us1t3DhLohV
qANBrDpxKgzfDbXBSmXz4L9Xqh58CSbAs1iMvQVnBGkfK4F/H1o=
=ziqq
-----END PGP SIGNATURE-----

--Apple-Mail=_DBDAF988-3B9B-4D64-AF2B-11B57B8F70DB--

From nobody Wed Jun  5 23:46:14 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvkd03MzNz5MGGT;
	Wed, 05 Jun 2024 23:46:28 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvkcz5Nqlz4FWr;
	Wed,  5 Jun 2024 23:46:27 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=gmail.com header.s=20230601 header.b=GJKG7ZBt;
	dmarc=pass (policy=none) header.from=gmail.com;
	spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::62d as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com
Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1f44b441b08so3293775ad.0;
        Wed, 05 Jun 2024 16:46:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1717631186; x=1718235986; darn=freebsd.org;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:from:to:cc:subject:date:message-id:reply-to;
        bh=/KOQhQ4oLQ+r0F0Afq1dLQ34yQPksEtZaj2l9L2bdJ0=;
        b=GJKG7ZBtuy+UKdW0eu/U0x7Nqwoa5r90/44ZHSwUpZhxGiTt3E8h3ZwJh8ppuKrYZ5
         Ux8MIzspuN0y6PMKG+9v5vXuH+EF/l4srWYliyOiUzP2ZNkXUS5xoeZaRdFU2NTKBcRM
         Av8phbzNgDgiecLzcILiUH2OR8vTX8Yka1P5p7NkEoQNYh9aPoWjBgvT4jB/B48J1xGH
         /w+XBdUV0PG/jj02SYSVk/yjUUYKjpIeGRqf+ERPh/0b+AylHoygyUZOsJhM7uM3Ki/A
         ltsttkp/PyCnpPsLBWl96wpNLntCpmJeONkZOCs2LgYoA93FMoKARggIAhD4RYh05ZnD
         T+kw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717631186; x=1718235986;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
        bh=/KOQhQ4oLQ+r0F0Afq1dLQ34yQPksEtZaj2l9L2bdJ0=;
        b=iML731XJGY3cgW0LgLG+DmRsjvWJ+FayaxieMmiiPskmp3uFEZxH6P5gY4KwhqZihh
         glARq+qclCMfyB5413BjdX2CKQsOEy7l131X5IpTvzopS36bdfZl000Ht5M2CBIw/1GW
         qATDyEWT1P+ahd62HMjdeVKoXjmaDJn8loNKQHgyB7iRYF/ao0IZnZx5rEVyIeeGfycf
         tcDmbMIVRLZ8/EMKlyBrWcsMBUD9i+AoptluqLv55nmhG/Od8U+0WX2bV8YhzlHSzFdm
         +ghtQilz69Davkzg7pLLq4XhqR4vbWivbBrIj4sAKNzrpt1BX9Krxac38HhNbZbazl0b
         ds/g==
X-Forwarded-Encrypted: i=1; AJvYcCXSa4QHK1YA3svnf0Uv4z26zWptqK0ZOeG+ifGJNZtZeobO4LoLf8o/EObK3gXj8SUKnPhQqzvtLmlwokqos/XPqBpDKb4nsUTXcw2077Qrv4xoZ0de3w3Y2Qf4WETypA3boNrp5QQWU5XqutR14EzSz+WpmNU6maTIf+rQdxFxcZynimkt+6oRBzs4sGo=
X-Gm-Message-State: AOJu0YzcqK1C0VrEfCkna/ClGIiCv1ibMEkiyNYe05ONNAR8RSnCTh7T
	55mxTUJ7hfnS2M6xKD/zgzpUlwcnTsJRfQf56SbtctQHKhv2PaRNgDYz6g==
X-Google-Smtp-Source: AGHT+IHc8honSZay/iY/xRBEiHKjfg2TXAU4Mgh7cG1e3sRVohHG5gnOPrbAnyqkpFsi8PZSN0IQsw==
X-Received: by 2002:a17:902:e810:b0:1f6:7f45:4d37 with SMTP id d9443c01a7336-1f6a5a7b54emr44960365ad.66.1717631185671;
        Wed, 05 Jun 2024 16:46:25 -0700 (PDT)
Received: from smtpclient.apple ([162.118.1.182])
        by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7d2cb8sm1106535ad.140.2024.06.05.16.46.24
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 05 Jun 2024 16:46:25 -0700 (PDT)
From: Enji Cooper <yaneurabeya@gmail.com>
Message-Id: <85B47B24-68AA-4555-9D70-E89FC296ACA0@gmail.com>
Content-Type: multipart/signed;
	boundary="Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D";
	protocol="application/pgp-signature";
	micalg=pgp-sha256
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD
 systems
Date: Wed, 5 Jun 2024 16:46:14 -0700
In-Reply-To: <yby7q4ygywjeglrngvzdrcwfcdodc2lqw5a4m2lenq4ck7mcet@bror4anr4vny>
Cc: =?utf-8?Q?Stefan_E=C3=9Fer?= <se@freebsd.org>,
 src-committers <src-committers@freebsd.org>,
 dev-commits-src-all@freebsd.org,
 dev-commits-src-main@freebsd.org
To: Shawn Webb <shawn.webb@hardenedbsd.org>
References: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
 <yby7q4ygywjeglrngvzdrcwfcdodc2lqw5a4m2lenq4ck7mcet@bror4anr4vny>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spamd-Bar: -----
X-Spamd-Result: default: False [-5.28 / 15.00];
	SIGNED_PGP(-2.00)[];
	NEURAL_HAM_LONG(-1.00)[-1.000];
	NEURAL_HAM_MEDIUM(-1.00)[-1.000];
	DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
	R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c];
	MIME_GOOD(-0.20)[multipart/signed,multipart/alternative,text/plain];
	R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601];
	NEURAL_HAM_SHORT(-0.18)[-0.183];
	RCVD_TLS_LAST(0.00)[];
	FROM_HAS_DN(0.00)[];
	MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:~];
	TO_DN_SOME(0.00)[];
	RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::62d:from];
	ARC_NA(0.00)[];
	FREEMAIL_ENVFROM(0.00)[gmail.com];
	FREEMAIL_FROM(0.00)[gmail.com];
	HAS_ATTACHMENT(0.00)[];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
	RCPT_COUNT_FIVE(0.00)[5];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	RCVD_COUNT_TWO(0.00)[2];
	FROM_EQ_ENVFROM(0.00)[];
	DKIM_TRACE(0.00)[gmail.com:+];
	MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org];
	APPLE_MAILER_COMMON(0.00)[];
	MID_RHS_MATCH_FROM(0.00)[];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	DWL_DNSWL_NONE(0.00)[gmail.com:dkim]
X-Rspamd-Queue-Id: 4Vvkcz5Nqlz4FWr


--Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC"


--Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Jun 4, 2024, at 8:21=E2=80=AFAM, Shawn Webb =
<shawn.webb@hardenedbsd.org> wrote:
>=20
> On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=C3=9Fer wrote:
>> The branch main has been updated by se:
>>=20
>> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a
>>=20
>> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
>> Author:     Stefan E=C3=9Fer <se@FreeBSD.org>
>> AuthorDate: 2024-06-04 06:26:09 +0000
>> Commit:     Stefan E=C3=9Fer <se@FreeBSD.org>
>> CommitDate: 2024-06-04 06:26:09 +0000
>>=20
>>    newfs_msdos: fix build on non-FreeBSD systems
>>=20
>>    Disable data area alignment if the build environment does not =
define
>>    PAGE_SIZE (e.g., when building on Linux or macOS).
>>=20
>>    Reported by:    jrtc27
>>    MFC after:      1 week
>> ---
>> sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>=20
>> diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c
>> index 423fbbcadcc5..1bca560a59e1 100644
>> --- a/sbin/newfs_msdos/mkfs_msdos.c
>> +++ b/sbin/newfs_msdos/mkfs_msdos.c
>> @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, =
const struct msdos_options *op)
>> 	    if (o.align)
>> 		alignto =3D bpb.bpbSecPerClust;
>> 	    else
>> +#ifdef	PAGE_SIZE
>> 		alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec;
>> +#else
>> +	        alignto =3D 1;
>> +#endif
>=20
> Imagine the following:
>=20
> 1. someone builds FreeBSD on Linux or macOS
> 2. that build is deployed
> 3. FreeBSD is rebuilt on that deployment
>=20
> Could the value of alignto be different on step 1 versus step 3?

Hi Shawn,
	Assuming the tool is built for the host, yes it would run into =
the issues you=E2=80=99re describing. If it=E2=80=99s targeting FreeBSD =
though or an OS that allows direct access to PAGE_SIZE, e.g., NetBSD, it =
will use whatever the OS defines for PAGE_SIZE in the appropriate =
headers.
Cheers,
-Enji=

--Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><br><div><blockquote type=3D"cite"><div>On Jun 4, =
2024, at 8:21=E2=80=AFAM, Shawn Webb &lt;shawn.webb@hardenedbsd.org&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div><meta =
charset=3D"UTF-8"><span style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">On Tue, Jun 04, 2024 at =
06:28:19AM +0000, Stefan E=C3=9Fer wrote:</span><br style=3D"caret-color: =
rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><blockquote type=3D"cite" style=3D"font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; orphans: auto; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;">The branch main has been updated by =
se:<br><br>URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a<br><br>commit =
41ee91c64f47faaa8131df3cd8a63bdb60fa486a<br>Author: =
&nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>AuthorDate: 2024-06-04 06:26:09 =
+0000<br>Commit: &nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>CommitDate: 2024-06-04 06:26:09 =
+0000<br><br>&nbsp;&nbsp;&nbsp;newfs_msdos: fix build on non-FreeBSD =
systems<br><br>&nbsp;&nbsp;&nbsp;Disable data area alignment if the =
build environment does not define<br>&nbsp;&nbsp;&nbsp;PAGE_SIZE (e.g., =
when building on Linux or macOS).<br><br>&nbsp;&nbsp;&nbsp;Reported by: =
&nbsp;&nbsp;&nbsp;jrtc27<br>&nbsp;&nbsp;&nbsp;MFC after: =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 =
week<br>---<br>sbin/newfs_msdos/mkfs_msdos.c | 4 ++++<br>1 file changed, =
4 insertions(+)<br><br>diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c<br>index 423fbbcadcc5..1bca560a59e1 =
100644<br>--- a/sbin/newfs_msdos/mkfs_msdos.c<br>+++ =
b/sbin/newfs_msdos/mkfs_msdos.c<br>@@ -571,7 +571,11 @@ mkfs_msdos(const =
char *fname, const char *dtype, const struct msdos_options *op)<br><span =
class=3D"Apple-tab-span" style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;if =
(o.align)<br><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>alignto =3D bpb.bpbSecPerClust;<br><span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;else<br>+#i=
fdef<span class=3D"Apple-tab-span" style=3D"white-space: pre;">	=
</span>PAGE_SIZE<br><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span><span class=3D"Apple-tab-span" style=3D"white-space: =
pre;">	</span>alignto =3D PAGE_SIZE / =
bpb.bpbBytesPerSec;<br>+#else<br>+<span class=3D"Apple-tab-span" =
style=3D"white-space: pre;">	</span><span =
class=3D"Apple-converted-space">&nbsp;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;alignto =3D 1;<br>+#endif<br></blockquote><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">Imagine the following:</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none;"><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none;"><span =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">1. someone builds FreeBSD on Linux or =
macOS</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">2. that build is =
deployed</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant-caps: =
normal; font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none;"><span style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant-caps: normal; =
font-weight: 400; letter-spacing: normal; text-align: start; =
text-indent: 0px; text-transform: none; white-space: normal; =
word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: =
none; float: none; display: inline !important;">3. FreeBSD is rebuilt on =
that deployment</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none;"><span style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
text-align: start; text-indent: 0px; text-transform: none; white-space: =
normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; =
text-decoration: none; float: none; display: inline !important;">Could =
the value of alignto be different on step 1 versus step 3?</span><br =
style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: =
12px; font-style: normal; font-variant-caps: normal; font-weight: 400; =
letter-spacing: normal; text-align: start; text-indent: 0px; =
text-transform: none; white-space: normal; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: =
none;"></div></blockquote></div><br><div>Hi Shawn,</div><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>Assuming =
the tool is built for the host, yes it would run into the issues =
you=E2=80=99re describing. If it=E2=80=99s targeting FreeBSD though or =
an OS that allows direct access to PAGE_SIZE, e.g., NetBSD, it will use =
whatever the OS defines for PAGE_SIZE in the appropriate =
headers.</div><div>Cheers,</div><div>-Enji</div></body></html>=

--Apple-Mail=_73F0525B-C383-4D28-B2A7-952288DCDFFC--

--Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZg+MYACgkQGpE5DjPs
NJgVZw//f4jLnazWQNSST4wnOzyrxH0FtwtekOFOrpqyYYCXjdC4nxNUBWAPe75J
x+SMcbeG3k3Tq889FYbOc9YYFyOkYxPLf2xPAYSU6Vfu2gy6Q2yIAtsYiugsx1SV
RKLwhBJO1n0E8bABj9VMlrZrfcmxcl+aIa7sS+1m1xMi40kchgRVwjDUId1AcUf+
6XAn9TiRnB6J454CH7c5oErQPgzL6/23354Q50FryC3K/bW+BGg7Ia5AU6Yi7Dhz
P+3RAZ0nz14Is/8tndk71vsqWMbcsUg3L0U8aoHATvPyppjRcX2F8AxOk2JjQq7/
jLO7wBjZLK1RCSDvBLt/DYdCJngkOU3p/mWNQosS5Jpk4hR/QSqFY0VSaJh75Vqb
AU0asmHFWGEvoALFIZwli1NBOSDvTZ7UztnIxRiPbkQCP+SfiwVEC855ULEBXsPD
MvtyMob60+ycsdgm5UXUHsX4IJ16AEPHCLE8KDc1NGNe+iygtHp1yhxi/Gmf9DHf
YbB3hJBYO3Yxr+Nj01CLqreV4SeSxhhcg2mUVCQlu4SaK06aH3ZexnLK7qgGUowh
Xt0lYxxuPV4Q7J11oSueFkUG83hTUnsj8Bp6dORqq0ds/agO0q9kKATdIR92BLE4
6KQXdSJjydHE2GVHq4Jkkrn9XFv9ifOAe0fs3bXp7xDGlB3G5h8=
=lp/s
-----END PGP SIGNATURE-----

--Apple-Mail=_C3569A37-6330-4F13-A50F-F6C776FF059D--

From nobody Wed Jun  5 23:47:06 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvkf06B0nz5MGLm;
	Wed, 05 Jun 2024 23:47:20 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvkf0201yz4Fh3;
	Wed,  5 Jun 2024 23:47:20 +0000 (UTC)
	(envelope-from yaneurabeya@gmail.com)
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=gmail.com header.s=20230601 header.b="nWbR/Zky";
	dmarc=pass (policy=none) header.from=gmail.com;
	spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::636 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com
Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1f67fa9cd73so10950515ad.0;
        Wed, 05 Jun 2024 16:47:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1717631238; x=1718236038; darn=freebsd.org;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:from:to:cc:subject:date:message-id:reply-to;
        bh=9QWTFMPjshKLOrsxXRXQdZtXu3/pnblpBYW77fzrxh8=;
        b=nWbR/Zkyy1FzwWgm6ftjiGdoJT61+lFTltHp2CXKZ0LuT97pKUiBEsbo/Sgg37deQ6
         hkaC9InPkwRO5lLU/ySwEjfZRitEnG6nDW7rl6KMtw7fVzy7GUiWkpU1HBBO4kWuzROK
         Wy2NvYfV4kKhz0VNMp7DSZjzX0a+DqZhFtp+RN8zNQ0vkwNMtHtOXnobi8xpmvWvcBWt
         zpjyixAKPrFUS0amApGY9Ums2y50n5Y1vHCLUOt72rSQZlJx5enrDObk6APm6ikiNEMw
         Nxn7s6uM2TiGlWYfO/CkrjWmgRDilId2HbMBO0V4Llykreute49NVn63U6G+Ks+SXsr6
         AXaA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1717631238; x=1718236038;
        h=references:to:cc:in-reply-to:date:subject:mime-version:message-id
         :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
        bh=9QWTFMPjshKLOrsxXRXQdZtXu3/pnblpBYW77fzrxh8=;
        b=E7XAG1M6F6QnQXMMLWcmdzT7ZhLWx9xfmq8o+OcjO3E98TvhzjGvz7Tbhfr93raVkc
         w5xEHLaoT2Ayqi0D/F13/zAzgKy8+HNbGsXL/GVCxPWfzCNUgWlIjrqYG9xT0uZA/dvz
         cVt1Q23kR+Xl7TdH+3BFK1t3URrL8XRHFkeEmjwdChVnscavLMd06VYFVaJOMtL/UetJ
         O/BM5fA7my3jNTbAijDh8rhX2Cgxec5ZBclQJ9Bv/j1Qd7sgbXAKNWDY0y7MRDjIdsZB
         WjNEBJx2ihnFAEFR34rCMH3ZVsyGcv0GQx3CrntgH9v6lHYMejlwcO0/jC/Btjk/5/tb
         ufNw==
X-Forwarded-Encrypted: i=1; AJvYcCU1X+IXeXYuNwSS47ABAYfh9TaNsp8YEV/Oeg2NuXVQlCY1LExUa6uNiXgIG2N5IbWZngx9cTvwhBzZWCEA45u1jvyuEyoSfuWtVy5A5hnM8UCkrjuZu1kkjcYjbOKD22tXopvzvnKDrKe6gC0Q1F3IOA==
X-Gm-Message-State: AOJu0YzE69cKWZ3TebJ0A2vU3OATmn1mEp0Asdfn39+cDS6NSTbHZ6rg
	BAjY8vPYbfoAqJ56rUEd/gVLb9rxiJW+Zv9rM9EAlpPN6C+k3vTOsIyz1w==
X-Google-Smtp-Source: AGHT+IGq+5CSG2mrFpoiEUblmSfpUE0Xp3ljJB61YZvmZP7G3Tfe/06ni8k3264J4iKvWzrG0i83cQ==
X-Received: by 2002:a17:902:cec9:b0:1eb:7162:82c7 with SMTP id d9443c01a7336-1f6b8ede496mr15815455ad.18.1717631238079;
        Wed, 05 Jun 2024 16:47:18 -0700 (PDT)
Received: from smtpclient.apple ([162.118.1.182])
        by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7d2cb8sm1106535ad.140.2024.06.05.16.47.17
        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 05 Jun 2024 16:47:17 -0700 (PDT)
From: Enji Cooper <yaneurabeya@gmail.com>
Message-Id: <917A072B-D970-428A-B4B2-EA93ADFE67C7@gmail.com>
Content-Type: multipart/signed;
	boundary="Apple-Mail=_ED887DA8-1BF9-458D-91AD-D884882DE5A8";
	protocol="application/pgp-signature";
	micalg=pgp-sha256
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\))
Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD
 systems
Date: Wed, 5 Jun 2024 16:47:06 -0700
In-Reply-To: <DDB66592-97E1-47FF-8613-831DB0823A7D@gmail.com>
Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>,
 "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>,
 "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
To: =?utf-8?Q?Stefan_E=C3=9Fer?= <se@freebsd.org>
References: <202406040628.4546SJ98088668@gitrepo.freebsd.org>
 <DDB66592-97E1-47FF-8613-831DB0823A7D@gmail.com>
X-Mailer: Apple Mail (2.3774.600.62)
X-Spamd-Bar: ----
X-Spamd-Result: default: False [-4.98 / 15.00];
	SIGNED_PGP(-2.00)[];
	NEURAL_HAM_LONG(-1.00)[-1.000];
	NEURAL_HAM_MEDIUM(-1.00)[-1.000];
	DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
	R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601];
	MIME_GOOD(-0.20)[multipart/signed,multipart/alternative,text/plain];
	R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c];
	NEURAL_SPAM_SHORT(0.12)[0.122];
	RCVD_TLS_LAST(0.00)[];
	ARC_NA(0.00)[];
	TO_MATCH_ENVRCPT_ALL(0.00)[];
	TO_DN_EQ_ADDR_SOME(0.00)[];
	TO_DN_SOME(0.00)[];
	MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:~];
	FREEMAIL_ENVFROM(0.00)[gmail.com];
	FREEMAIL_FROM(0.00)[gmail.com];
	FROM_HAS_DN(0.00)[];
	HAS_ATTACHMENT(0.00)[];
	DWL_DNSWL_NONE(0.00)[gmail.com:dkim];
	MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org];
	RCVD_COUNT_TWO(0.00)[2];
	FROM_EQ_ENVFROM(0.00)[];
	DKIM_TRACE(0.00)[gmail.com:+];
	MID_RHS_MATCH_FROM(0.00)[];
	RCVD_VIA_SMTP_AUTH(0.00)[];
	APPLE_MAILER_COMMON(0.00)[];
	RCPT_COUNT_THREE(0.00)[4];
	ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
	RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::636:from]
X-Rspamd-Queue-Id: 4Vvkf0201yz4Fh3


--Apple-Mail=_ED887DA8-1BF9-458D-91AD-D884882DE5A8
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128"


--Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8


> On Jun 5, 2024, at 4:42=E2=80=AFPM, Enji Cooper =
<yaneurabeya@gmail.com> wrote:
>=20
>> On Jun 3, 2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer =
<se@freebsd.org> wrote:
>>=20
>> The branch main has been updated by se:
>>=20
>> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a
>>=20
>> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
>> Author:     Stefan E=C3=9Fer <se@FreeBSD.org>
>> AuthorDate: 2024-06-04 06:26:09 +0000
>> Commit:     Stefan E=C3=9Fer <se@FreeBSD.org>
>> CommitDate: 2024-06-04 06:26:09 +0000
>>=20
>>    newfs_msdos: fix build on non-FreeBSD systems
>>=20
>>    Disable data area alignment if the build environment does not =
define
>>    PAGE_SIZE (e.g., when building on Linux or macOS).
>>=20
>>    Reported by:    jrtc27
>>    MFC after:      1 week
>> ---
>> sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>=20
>> diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c
>> index 423fbbcadcc5..1bca560a59e1 100644
>> --- a/sbin/newfs_msdos/mkfs_msdos.c
>> +++ b/sbin/newfs_msdos/mkfs_msdos.c
>> @@ -571,7 +571,11 @@ mkfs_msdos(const char *fname, const char *dtype, =
const struct msdos_options *op)
>> 	    if (o.align)
>> 		alignto =3D bpb.bpbSecPerClust;
>> 	    else
>> +#ifdef	PAGE_SIZE
>> 		alignto =3D PAGE_SIZE / bpb.bpbBytesPerSec;
>> +#else
>> +	        alignto =3D 1;
>> +#endif
>> 	    if (alignto > 1) {
>> 		/* align data clusters */
>> 		alignment =3D (bpb.bpbResSectors + bpb.bpbBigFATsecs * =
bpb.bpbFATs + rds) %
>=20
> 	I realize this might seem silly, but what about =
sysconf(_SC_PAGE_SIZE) ( =
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.html =
) with platforms that don=E2=80=99t have direct access to PAGE_SIZE? =
It=E2=80=99s supported on Linux and MacOS at least.

Also, POSIX says it could be defined by limits.h: =
https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html . It =
might just be that an extra header is required to make the tool compile =
with the proper PAGE_SIZE prior to this change.
-Enji


--Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><br><div><blockquote type=3D"cite"><div>On Jun 5, =
2024, at 4:42=E2=80=AFPM, Enji Cooper &lt;yaneurabeya@gmail.com&gt; =
wrote:</div><div><meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3Dutf-8"><div style=3D"overflow-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: =
after-white-space;"><br><div><blockquote type=3D"cite"><div>On Jun 3, =
2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer &lt;se@freebsd.org&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div><div>The branch =
main has been updated by se:<br><br>URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb=
60fa486a<br><br>commit =
41ee91c64f47faaa8131df3cd8a63bdb60fa486a<br>Author: =
&nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>AuthorDate: 2024-06-04 06:26:09 =
+0000<br>Commit: &nbsp;&nbsp;&nbsp;&nbsp;Stefan E=C3=9Fer =
&lt;se@FreeBSD.org&gt;<br>CommitDate: 2024-06-04 06:26:09 +0000<br><br> =
&nbsp;&nbsp;&nbsp;newfs_msdos: fix build on non-FreeBSD systems<br><br> =
&nbsp;&nbsp;&nbsp;Disable data area alignment if the build environment =
does not define<br> &nbsp;&nbsp;&nbsp;PAGE_SIZE (e.g., when building on =
Linux or macOS).<br><br> &nbsp;&nbsp;&nbsp;Reported by: =
&nbsp;&nbsp;&nbsp;jrtc27<br> &nbsp;&nbsp;&nbsp;MFC after: =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 week<br>---<br> =
sbin/newfs_msdos/mkfs_msdos.c | 4 ++++<br> 1 file changed, 4 =
insertions(+)<br><br>diff --git a/sbin/newfs_msdos/mkfs_msdos.c =
b/sbin/newfs_msdos/mkfs_msdos.c<br>index 423fbbcadcc5..1bca560a59e1 =
100644<br>--- a/sbin/newfs_msdos/mkfs_msdos.c<br>+++ =
b/sbin/newfs_msdos/mkfs_msdos.c<br>@@ -571,7 +571,11 @@ mkfs_msdos(const =
char *fname, const char *dtype, const struct msdos_options *op)<br> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;if (o.align)<br> <span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>alignto =3D =
bpb.bpbSecPerClust;<br> <span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;else<br>+#ifdef<span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>PAGE_SIZE<br> <span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>alignto =3D=
 PAGE_SIZE / bpb.bpbBytesPerSec;<br>+#else<br>+<span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alignto =3D 1;<br>+#endif<br> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</span> =
&nbsp;&nbsp;&nbsp;if (alignto &gt; 1) {<br> <span class=3D"Apple-tab-span"=
 style=3D"white-space:pre">	</span><span class=3D"Apple-tab-span" =
style=3D"white-space:pre">	</span>/* align data clusters */<br> =
<span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span><span class=3D"Apple-tab-span" style=3D"white-space:pre">	=
</span>alignment =3D (bpb.bpbResSectors + bpb.bpbBigFATsecs * =
bpb.bpbFATs + rds) %<br></div></div></blockquote></div><br><div><span =
class=3D"Apple-tab-span" style=3D"white-space:pre">	</span>I realize =
this might seem silly, but what about sysconf(_SC_PAGE_SIZE) (&nbsp;<a =
href=3D"https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf=
.html">https://pubs.opengroup.org/onlinepubs/9699919799/functions/sysconf.=
html</a>&nbsp;) with platforms that don=E2=80=99t have direct access to =
PAGE_SIZE? It=E2=80=99s supported on Linux and MacOS at =
least.</div></div></div></blockquote><br></div><div>Also, POSIX says it =
could be defined by limits.h:&nbsp;<a =
href=3D"https://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html">h=
ttps://pubs.opengroup.org/onlinepubs/7908799/xsh/limits.h.html</a>&nbsp;. =
It might just be that an extra header is required to make the tool =
compile with the proper PAGE_SIZE prior to this =
change.</div><div>-Enji</div><br></body></html>=

--Apple-Mail=_32A48224-E49F-4478-907D-645B6A321128--

--Apple-Mail=_ED887DA8-1BF9-458D-91AD-D884882DE5A8
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename=signature.asc
Content-Type: application/pgp-signature;
	name=signature.asc
Content-Description: Message signed with OpenPGP

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkHfexGRJ3gYRdA2gGpE5DjPsNJgFAmZg+PsACgkQGpE5DjPs
NJg1og//fDTssIts3YrVsadzmffYVmuEVW8gZo2bs2176RE2XkFSlasSgecyIv/2
/QQP09IuV21ZpIzd7vnJh0LSRd+6EgUf0AigQxK+x9VVQY6iev+kiEcKk4T/GI1c
sclSoOjxiOfmZXQhTaA8GOnElZkG218ToXgYrrH2ZR+gfJsRYiMgbstdD939rEBY
9N42igKuAfW4e91TnSug3bKUYHyu/6Ai9dG6U9W7nHMhc9V4sRA9jpDhR4ViuJPz
Jaz2jpfVXDVuC0woSYbVOIUkg01RE/f9ZcXWqHsJoQkomjRLw9wQKqv8KXqoCv5T
maY0UxstXlp2bJ3fO2N3tfnO88lTIZSDQK2dDao8i6sFJw2fQqoZRIaSiNq+N4Qr
JY3ffnPWhpC4CoJWbOfvPs8iCEwHgTw95NN0zbgc9Q+CvVLG3eHKhX0ju/AmzFya
npz0FoRBhBRwF+YUOfKnr+hZ6J908Fo0DKcCryn2Py7vFVEPX0bJQu2uurtf/GIT
9TSh6EKZGzwngnkWrI2YMTX/lCxuni2PGPJudIC8I3Mxlyhc06lTw8I5ZAh4qak5
BsNGd7K7sshW0lxSj7ymbRGG+Jku5+/VDzzSguPcAXfM+OXtAdv8D2Vr9aBazndo
6x9aYk8Pbot+TpPlI8KSsxSYUGPahkyXyZfqGTvJ8U6qW4dmR9Y=
=N3S5
-----END PGP SIGNATURE-----

--Apple-Mail=_ED887DA8-1BF9-458D-91AD-D884882DE5A8--

From nobody Thu Jun  6 03:43:41 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvqtj17wGz5Mvr1;
	Thu, 06 Jun 2024 03:43:41 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvqtj0x0Bz4hPg;
	Thu,  6 Jun 2024 03:43:41 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717645421;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=CLOeBszkP+viiOii1Dw1vP0k/JYLJhA5mVauRrtRaMg=;
	b=kHeWxksqgGegT6E+6+9DeAhzZh36o2+rFJ9lJmzPHBvh/lHBsp79u9uEXEd3nNzfyDNA/g
	fxaPXKsMveJWz1ZSzTmWVVYWZAbynrGNuaxR+jyzt2iyy/YdkNTpKb6hW0fwD8OOdQVxj5
	1kaBwUhG/upA1NlnL7nbKJ+cdeZ7YVbi8y8RZC9ds+ngLTj9JFUurk2AAlSnay9cU15oa8
	THs72qzxXHcFQZYZOL1MMmUUyFxmvxbdPormL9m6fuLHvrY8LtkKB1t++UqywUyXTxXRxp
	8OAm6klU4N24aiCfwu3ZomvjcpoKfmExeVYMMoYX6JmvHXEscQBKddnCWn/5lw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717645421; a=rsa-sha256; cv=none;
	b=PuM6kc/JI/3xnuErFhBgYGdx4yEmvVL/fu/+tnbbvNkDQ3fVZ5X3uebLLML8dsa8hvnkLM
	MdAaOkP5Hxqfh5Zl2+xCBSOVnniYEb/h4mphqUu0Eoiz4bWou6KBw3bNS6VJMD2LtzKeBe
	DpRR7X1BwLW4mQ6hBzsinieTIQqYg0DXWnJ2KnMmkmSMvH+GslPydVsOUSczo7gFFZrlYC
	oSX6pie7ONN7URq2++NRg2DhERxWJiW+I+kPnQZSVHBW1LV9FMnAKQfYYV8/tJdxLM8upk
	OLXP7ZTmO9+Oz/5vRbgeBHGTgX2rQslOkmGibSlWEZwo6ojYIQ43Oh0mHD354Q==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717645421;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=CLOeBszkP+viiOii1Dw1vP0k/JYLJhA5mVauRrtRaMg=;
	b=plb2m7udRkzeWVaN6vSOUwE8IF/Pifiojn1oDdxPdzRzxT6uxo6Nj+3RcozSGMm8OkAxoS
	TxQBvY6FhldEMSf4jugbL7G7gPxPWPOcZxgG5SmDLkVbXaeIKKcxjkKknDVfvWfTlpyESM
	QEWPmnUN4bg4vykPMizFeF0FNdZwPDMEfDiGChs6rm32jy4914tQ24dNHGxd/kmV9+uSqv
	JEeT+eXC422EcU3ik2cxYTBkWQcfpPrY6AeFU1mojyEw5Qsbwy54oZtjdHVm/hBRRfGAye
	zzEPHdt/upSWB65uJgUqgC1oKGl8l6iHe4Wg74wgqu8iHLYfpF9bbWBfq7hHGA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vvqtj0Xs0zVyc;
	Thu,  6 Jun 2024 03:43:41 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4563hfxO089312;
	Thu, 6 Jun 2024 03:43:41 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4563hfU2089309;
	Thu, 6 Jun 2024 03:43:41 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 03:43:41 GMT
Message-Id: <202406060343.4563hfU2089309@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ryan Libby <rlibby@FreeBSD.org>
Subject: git: bbf81f46297f - main - pctrie: add combined insert/lookup
  operations
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rlibby
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: bbf81f46297f91ed6b4dde8877f4260c2d1e03f2
Auto-Submitted: auto-generated

The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=bbf81f46297f91ed6b4dde8877f4260c2d1e03f2

commit bbf81f46297f91ed6b4dde8877f4260c2d1e03f2
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-06 02:17:20 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-06 02:17:20 +0000

    pctrie: add combined insert/lookup operations
    
    In several places in code, we do a pctrie lookup followed by a pctrie
    insert.  Provide a few flavors of combined lookup/insert.  This may save
    a portion of the work from walking a large pctrie twice.
    
    The general idea is that while we walk the trie during insert, we also
    do the same kind of tracking work that we do during pctrie_lookup_ge or
    pctrie_lookup_le, and we pass out a pctrie node from where such a lookup
    may continue.
    
    Reviewed by:    dougm (previous version), kib (previous version), markj
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D45394
---
 sys/kern/subr_pctrie.c | 205 +++++++++++++++++++++++++++++++++++++++++++++----
 sys/sys/pctrie.h       | 113 ++++++++++++++++++++++++++-
 2 files changed, 298 insertions(+), 20 deletions(-)

diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c
index 76f4ee17a8ca..4017f98c207d 100644
--- a/sys/kern/subr_pctrie.c
+++ b/sys/kern/subr_pctrie.c
@@ -260,13 +260,32 @@ pctrie_node_size(void)
 	return (sizeof(struct pctrie_node));
 }
 
+enum pctrie_insert_neighbor_mode {
+	PCTRIE_INSERT_NEIGHBOR_NONE,
+	PCTRIE_INSERT_NEIGHBOR_LT,
+	PCTRIE_INSERT_NEIGHBOR_GT,
+};
+
 /*
- * Looks for where to insert the key-value pair into the trie.  Completes the
- * insertion if it replaces a null leaf; otherwise, returns insertion location
- * to caller.  Panics if the key already exists.
+ * Look for where to insert the key-value pair into the trie.  Complete the
+ * insertion if it replaces a null leaf.  Return the insertion location if the
+ * insertion needs to be completed by the caller; otherwise return NULL.
+ *
+ * If the key is already present in the trie, populate *found_out as if by
+ * pctrie_lookup().
+ *
+ * With mode PCTRIE_INSERT_NEIGHBOR_GT or PCTRIE_INSERT_NEIGHBOR_LT, set
+ * *neighbor_out to the lowest level node we encounter during the insert lookup
+ * that is a parent of the next greater or lesser entry.  The value is not
+ * defined if the key was already present in the trie.
+ *
+ * Note that mode is expected to be a compile-time constant, and this procedure
+ * is expected to be inlined into callers with extraneous code optimized out.
  */
-void *
-pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val)
+static __always_inline void *
+pctrie_insert_lookup_compound(struct pctrie *ptree, uint64_t *val,
+    uint64_t **found_out, struct pctrie_node **neighbor_out,
+    enum pctrie_insert_neighbor_mode mode)
 {
 	uint64_t index;
 	struct pctrie_node *node, *parent;
@@ -290,18 +309,44 @@ pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val)
 					    pctrie_toleaf(val), PCTRIE_LOCKED);
 				return (NULL);
 			}
-			if (*pctrie_toval(node) == index)
-				panic("%s: key %jx is already present",
-				    __func__, (uintmax_t)index);
+			if (*pctrie_toval(node) == index) {
+				*found_out = pctrie_toval(node);
+				return (NULL);
+			}
 			break;
 		}
 		if (pctrie_keybarr(node, index, &slot))
 			break;
+		/*
+		 * Descend.  If we're tracking the next neighbor and this node
+		 * contains a neighboring entry in the right direction, record
+		 * it.
+		 */
+		if (mode == PCTRIE_INSERT_NEIGHBOR_LT) {
+			if ((node->pn_popmap & ((1 << slot) - 1)) != 0)
+				*neighbor_out = node;
+		} else if (mode == PCTRIE_INSERT_NEIGHBOR_GT) {
+			if ((node->pn_popmap >> slot) > 1)
+				*neighbor_out = node;
+		}
 		parent = node;
 		node = pctrie_node_load(&node->pn_child[slot], NULL,
 		    PCTRIE_LOCKED);
 	}
 
+	/*
+	 * The caller will split this node.  If we're tracking the next
+	 * neighbor, record the old node if the old entry is in the right
+	 * direction.
+	 */
+	if (mode == PCTRIE_INSERT_NEIGHBOR_LT) {
+		if (*pctrie_toval(node) < index)
+			*neighbor_out = node;
+	} else if (mode == PCTRIE_INSERT_NEIGHBOR_GT) {
+		if (*pctrie_toval(node) > index)
+			*neighbor_out = node;
+	}
+
 	/*
 	 * 'node' must be replaced in the tree with a new branch node, with
 	 * children 'node' and 'val'. Return the place that points to 'node'
@@ -311,6 +356,68 @@ pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val)
 	    (smr_pctnode_t *)&ptree->pt_root);
 }
 
+/*
+ * Wrap pctrie_insert_lookup_compound to implement a strict insertion.  Panic
+ * if the key already exists, and do not look for neighboring entries.
+ */
+void *
+pctrie_insert_lookup_strict(struct pctrie *ptree, uint64_t *val)
+{
+	void *parentp;
+	uint64_t *found;
+
+	found = NULL;
+	parentp = pctrie_insert_lookup_compound(ptree, val, &found, NULL,
+	    PCTRIE_INSERT_NEIGHBOR_NONE);
+	if (__predict_false(found != NULL))
+		panic("%s: key %jx is already present", __func__,
+		    (uintmax_t)*val);
+	return (parentp);
+}
+
+/*
+ * Wrap pctrie_insert_lookup_compound to implement find-or-insert.  Do not look
+ * for neighboring entries.
+ */
+void *
+pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val,
+    uint64_t **found_out)
+{
+	*found_out = NULL;
+	return (pctrie_insert_lookup_compound(ptree, val, found_out, NULL,
+	    PCTRIE_INSERT_NEIGHBOR_NONE));
+}
+
+/*
+ * Wrap pctrie_insert_lookup_compound to implement find or insert and find next
+ * greater entry.  Find a subtree that contains the next entry greater than the
+ * newly-inserted or to-be-inserted entry.
+ */
+void *
+pctrie_insert_lookup_gt(struct pctrie *ptree, uint64_t *val,
+    uint64_t **found_out, struct pctrie_node **neighbor_out)
+{
+	*found_out = NULL;
+	*neighbor_out = NULL;
+	return (pctrie_insert_lookup_compound(ptree, val, found_out,
+	    neighbor_out, PCTRIE_INSERT_NEIGHBOR_GT));
+}
+
+/*
+ * Wrap pctrie_insert_lookup_compound to implement find or insert and find next
+ * lesser entry.  Find a subtree that contains the next entry less than the
+ * newly-inserted or to-be-inserted entry.
+ */
+void *
+pctrie_insert_lookup_lt(struct pctrie *ptree, uint64_t *val,
+    uint64_t **found_out, struct pctrie_node **neighbor_out)
+{
+	*found_out = NULL;
+	*neighbor_out = NULL;
+	return (pctrie_insert_lookup_compound(ptree, val, found_out,
+	    neighbor_out, PCTRIE_INSERT_NEIGHBOR_LT));
+}
+
 /*
  * Uses new node to insert key-value pair into the trie at given location.
  */
@@ -422,10 +529,10 @@ pctrie_lookup_unlocked(struct pctrie *ptree, uint64_t index, smr_t smr)
  *
  * Requires that access be externally synchronized by a lock.
  */
-uint64_t *
-pctrie_lookup_ge(struct pctrie *ptree, uint64_t index)
+static __inline uint64_t *
+pctrie_lookup_ge_node(struct pctrie_node *node, uint64_t index)
 {
-	struct pctrie_node *node, *succ;
+	struct pctrie_node *succ;
 	uint64_t *m;
 	int slot;
 
@@ -442,7 +549,6 @@ pctrie_lookup_ge(struct pctrie *ptree, uint64_t index)
 	 * "succ".  If "succ" is not NULL, then that lookup is guaranteed to
 	 * succeed.
 	 */
-	node = pctrie_root_load(ptree, NULL, PCTRIE_LOCKED);
 	succ = NULL;
 	for (;;) {
 		if (pctrie_isleaf(node)) {
@@ -505,23 +611,55 @@ pctrie_lookup_ge(struct pctrie *ptree, uint64_t index)
 	return (pctrie_toval(succ));
 }
 
+uint64_t *
+pctrie_lookup_ge(struct pctrie *ptree, uint64_t index)
+{
+	return (pctrie_lookup_ge_node(
+	    pctrie_root_load(ptree, NULL, PCTRIE_LOCKED), index));
+}
+
+uint64_t *
+pctrie_subtree_lookup_gt(struct pctrie_node *node, uint64_t index)
+{
+	if (node == NULL || index + 1 == 0)
+		return (NULL);
+	return (pctrie_lookup_ge_node(node, index + 1));
+}
+
+#ifdef INVARIANTS
+void
+pctrie_subtree_lookup_gt_assert(struct pctrie_node *node, uint64_t index,
+    struct pctrie *ptree, uint64_t *res)
+{
+	uint64_t *expected;
+
+	if (index + 1 == 0)
+		expected = NULL;
+	else
+		expected = pctrie_lookup_ge(ptree, index + 1);
+	KASSERT(res == expected,
+	    ("pctrie subtree lookup gt result different from root lookup: "
+	    "ptree %p, index %ju, subtree %p, found %p, expected %p", ptree,
+	    (uintmax_t)index, node, res, expected));
+}
+#endif
+
 /*
  * Returns the value with the greatest index that is less than or equal to the
  * specified index, or NULL if there are no such values.
  *
  * Requires that access be externally synchronized by a lock.
  */
-uint64_t *
-pctrie_lookup_le(struct pctrie *ptree, uint64_t index)
+static __inline uint64_t *
+pctrie_lookup_le_node(struct pctrie_node *node, uint64_t index)
 {
-	struct pctrie_node *node, *pred;
+	struct pctrie_node *pred;
 	uint64_t *m;
 	int slot;
 
 	/*
-	 * Mirror the implementation of pctrie_lookup_ge, described above.
+	 * Mirror the implementation of pctrie_lookup_ge_node, described above.
 	 */
-	node = pctrie_root_load(ptree, NULL, PCTRIE_LOCKED);
 	pred = NULL;
 	for (;;) {
 		if (pctrie_isleaf(node)) {
@@ -560,6 +698,39 @@ pctrie_lookup_le(struct pctrie *ptree, uint64_t index)
 	return (pctrie_toval(pred));
 }
 
+uint64_t *
+pctrie_lookup_le(struct pctrie *ptree, uint64_t index)
+{
+	return (pctrie_lookup_le_node(
+	    pctrie_root_load(ptree, NULL, PCTRIE_LOCKED), index));
+}
+
+uint64_t *
+pctrie_subtree_lookup_lt(struct pctrie_node *node, uint64_t index)
+{
+	if (node == NULL || index == 0)
+		return (NULL);
+	return (pctrie_lookup_le_node(node, index - 1));
+}
+
+#ifdef INVARIANTS
+void
+pctrie_subtree_lookup_lt_assert(struct pctrie_node *node, uint64_t index,
+    struct pctrie *ptree, uint64_t *res)
+{
+	uint64_t *expected;
+
+	if (index == 0)
+		expected = NULL;
+	else
+		expected = pctrie_lookup_le(ptree, index - 1);
+	KASSERT(res == expected,
+	    ("pctrie subtree lookup lt result different from root lookup: "
+	    "ptree %p, index %ju, subtree %p, found %p, expected %p", ptree,
+	    (uintmax_t)index, node, res, expected));
+}
+#endif
+
 /*
  * Remove the specified index from the tree, and return the value stored at
  * that index.  If the index is not present, return NULL.
diff --git a/sys/sys/pctrie.h b/sys/sys/pctrie.h
index 38b297899592..06b9fca79528 100644
--- a/sys/sys/pctrie.h
+++ b/sys/sys/pctrie.h
@@ -47,6 +47,16 @@ name##_PCTRIE_LOOKUP_UNLOCKED(struct pctrie *ptree, uint64_t key)	\
 	    key, (smr)));						\
 }									\
 
+#ifdef INVARIANTS
+void		pctrie_subtree_lookup_gt_assert(struct pctrie_node *node,
+		    uint64_t key, struct pctrie *ptree, uint64_t *res);
+void		pctrie_subtree_lookup_lt_assert(struct pctrie_node *node,
+		    uint64_t key, struct pctrie *ptree, uint64_t *res);
+#else
+#define	pctrie_subtree_lookup_gt_assert(node, key, ptree, res)
+#define	pctrie_subtree_lookup_lt_assert(node, key, ptree, res)
+#endif
+
 #define	PCTRIE_DEFINE(name, type, field, allocfn, freefn)		\
 									\
 CTASSERT(sizeof(((struct type *)0)->field) == sizeof(uint64_t));	\
@@ -73,14 +83,14 @@ name##_PCTRIE_PTR2VAL(struct type *ptr)					\
 	return &ptr->field;						\
 }									\
 									\
-static __inline int							\
+static __inline __unused int						\
 name##_PCTRIE_INSERT(struct pctrie *ptree, struct type *ptr)		\
 {									\
 	struct pctrie_node *parent;					\
 	void *parentp;							\
 	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\
 									\
-	parentp = pctrie_insert_lookup(ptree, val);			\
+	parentp = pctrie_insert_lookup_strict(ptree, val);		\
 	if (parentp == NULL)						\
 		return (0);						\
 	parent = allocfn(ptree);					\
@@ -90,6 +100,92 @@ name##_PCTRIE_INSERT(struct pctrie *ptree, struct type *ptr)		\
 	return (0);							\
 }									\
 									\
+static __inline __unused int						\
+name##_PCTRIE_FIND_OR_INSERT(struct pctrie *ptree, struct type *ptr,	\
+    struct type **found_out_opt)					\
+{									\
+	struct pctrie_node *parent;					\
+	void *parentp;							\
+	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\
+	uint64_t *found;						\
+									\
+	parentp = pctrie_insert_lookup(ptree, val, &found);		\
+	if (found != NULL) {						\
+		if (found_out_opt != NULL)				\
+			*found_out_opt = name##_PCTRIE_VAL2PTR(found);	\
+		return (EEXIST);					\
+	}								\
+	if (parentp == NULL)						\
+		return (0);						\
+	parent = allocfn(ptree);					\
+	if (__predict_false(parent == NULL))				\
+		return (ENOMEM);					\
+	pctrie_insert_node(parentp, parent, val);			\
+	return (0);							\
+}									\
+									\
+static __inline __unused int						\
+name##_PCTRIE_INSERT_LOOKUP_GE(struct pctrie *ptree, struct type *ptr,	\
+    struct type **found_out)						\
+{									\
+	struct pctrie_node *parent, *neighbor;				\
+	void *parentp;							\
+	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\
+	uint64_t *found;						\
+									\
+	parentp = pctrie_insert_lookup_gt(ptree, val, &found,		\
+	    &neighbor);							\
+	if (__predict_false(found != NULL)) {				\
+		*found_out = name##_PCTRIE_VAL2PTR(found);		\
+		return (EEXIST);					\
+	}								\
+	if (parentp != NULL) {						\
+		parent = allocfn(ptree);				\
+		if (__predict_false(parent == NULL)) {			\
+			*found_out = NULL;				\
+			return (ENOMEM);				\
+		}							\
+		if (neighbor == parentp)				\
+			neighbor = parent;				\
+		pctrie_insert_node(parentp, parent, val);		\
+	}								\
+	found = pctrie_subtree_lookup_gt(neighbor, *val);		\
+	*found_out = name##_PCTRIE_VAL2PTR(found);			\
+	pctrie_subtree_lookup_gt_assert(neighbor, *val, ptree, found);	\
+	return (0);							\
+}									\
+									\
+static __inline __unused int						\
+name##_PCTRIE_INSERT_LOOKUP_LE(struct pctrie *ptree, struct type *ptr,	\
+    struct type **found_out)						\
+{									\
+	struct pctrie_node *parent, *neighbor;				\
+	void *parentp;							\
+	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\
+	uint64_t *found;						\
+									\
+	parentp = pctrie_insert_lookup_lt(ptree, val, &found,		\
+	    &neighbor);							\
+	if (__predict_false(found != NULL)) {				\
+		*found_out = name##_PCTRIE_VAL2PTR(found);		\
+		return (EEXIST);					\
+	}								\
+	if (parentp != NULL) {						\
+		parent = allocfn(ptree);				\
+		if (__predict_false(parent == NULL)) {			\
+			*found_out = NULL;				\
+			return (ENOMEM);				\
+		}							\
+		if (neighbor == parentp)				\
+			neighbor = parent;				\
+		pctrie_insert_node(parentp, parent, val);		\
+	}								\
+	found = pctrie_subtree_lookup_lt(neighbor, *val);		\
+	*found_out = name##_PCTRIE_VAL2PTR(found);			\
+	pctrie_subtree_lookup_lt_assert(neighbor, *val, ptree, found);	\
+	return (0);							\
+}									\
+									\
 static __inline __unused struct type *					\
 name##_PCTRIE_LOOKUP(struct pctrie *ptree, uint64_t key)		\
 {									\
@@ -155,7 +251,14 @@ name##_PCTRIE_REMOVE_LOOKUP(struct pctrie *ptree, uint64_t key)		\
 	return name##_PCTRIE_VAL2PTR(val);				\
 }
 
-void		*pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val);
+void		*pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val,
+		    uint64_t **found_out);
+void		*pctrie_insert_lookup_gt(struct pctrie *ptree, uint64_t *val,
+		    uint64_t **found_out, struct pctrie_node **neighbor_out);
+void		*pctrie_insert_lookup_lt(struct pctrie *ptree, uint64_t *val,
+		    uint64_t **found_out, struct pctrie_node **neighbor_out);
+void		*pctrie_insert_lookup_strict(struct pctrie *ptree,
+		    uint64_t *val);
 void		pctrie_insert_node(void *parentp,
 		    struct pctrie_node *parent, uint64_t *val);
 uint64_t	*pctrie_lookup(struct pctrie *ptree, uint64_t key);
@@ -169,6 +272,10 @@ struct pctrie_node *pctrie_reclaim_resume(struct pctrie_node **pnode);
 uint64_t	*pctrie_remove_lookup(struct pctrie *ptree, uint64_t index,
 		    struct pctrie_node **killnode);
 uint64_t	*pctrie_replace(struct pctrie *ptree, uint64_t *newval);
+uint64_t	*pctrie_subtree_lookup_gt(struct pctrie_node *node,
+		    uint64_t key);
+uint64_t	*pctrie_subtree_lookup_lt(struct pctrie_node *node,
+		    uint64_t key);
 size_t		pctrie_node_size(void);
 int		pctrie_zone_init(void *mem, int size, int flags);
 

From nobody Thu Jun  6 03:43:42 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvqtk3BF7z5MvsT;
	Thu, 06 Jun 2024 03:43:42 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvqtk20bkz4hq3;
	Thu,  6 Jun 2024 03:43:42 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717645422;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=6mIyLcUwazqOAbqk6Q5K/4ujyDrAO1FVC2cHTeonxQc=;
	b=b/PTBwe50Z32sibVoEXnDpnKbdv0BqDp29KPZHHLFeLAeenUnKhCttxLvFpm4oF+smmKtf
	YXjPIMMIPLZHhEautVF2tcgBlRQqdJCVuINDLfm/t8r7tomUjbCgpzPj6OGha36VVQaRGJ
	SdUtecC8fx9x/7DCa1EvBH5vQ8Kzk/dhWXG/XzlEscUsPS/tkJAeCKElPl/6V17cMnXFfe
	1D5/7FTyB29wbbOhNob+MYj/XzA+66TieQIYG18EoIxQk9ozVijdMiutjNKXn0+xDI+h2r
	HihADjndYy496IdUfYkAqCutJDWnZwyZOM2hAaIQDJBLLzoXi87EdTVE5MmB6g==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717645422; a=rsa-sha256; cv=none;
	b=K8Iw0UFAL2MqJ63yKvnKjhOudM7PSQ3f35JYjcO+SmyjXKl2R9eP1L512SQ1kI/K9y6quI
	9L3uwCrzn+bypwWk7kcx/m+750P+EhFdbiKn21WLZMHs3r+JF0PxqlkTsAlC7nJfh39Pxw
	Y56rjtRqg2JgKGXjHPhfIweFS+26d+CcbrmaHbVU15ykVjTPJ44QfIhtOwtHS4dTWRl9yO
	TD8wP5ZpyV91E07DWaVGVVOGupw/gHvJ8Y05z3p0sX8U6j8W2SbDqmYlXS/hGFKtjsou2x
	1da1RcFl+lL24kYJGO8XvDFnJrMnfFNXsxxQqlT/+I3XduGXx65bDpTM1rGAsg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717645422;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=6mIyLcUwazqOAbqk6Q5K/4ujyDrAO1FVC2cHTeonxQc=;
	b=rArk9xXsshF9ThYjMHf0ClCcUAK+R/3CnPshvPV3t/Uib9G5CXmQNesMBIeVaAPRjJcV6K
	hiKHZLtcIg1t0GR14VA10TpvtNz1vQgiKiuLNgelCDH+ucztkFr/rPFMJ1QvF9YtHCC0Gk
	slCnZMYVCm3Ml0mZ4fdqCftFdtmCT91nryok05EDFzM/owMm/T7w9n/BMW9nzb9DkmDO0N
	IKFLP5goBJW1/ZQvxO0JHI6zz8BWZ0T8IKZ79aTFFBil9ZkMLhqOka845Hz96qexh5j2aH
	Dd0YEbuxWGDFquMFYLe6ElvWlnWPAJAroSva2ncX8JnQcRr390ccLP77CCwMXA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vvqtk1c1DzV5D;
	Thu,  6 Jun 2024 03:43:42 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4563hg1Q089365;
	Thu, 6 Jun 2024 03:43:42 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4563hg37089362;
	Thu, 6 Jun 2024 03:43:42 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 03:43:42 GMT
Message-Id: <202406060343.4563hg37089362@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ryan Libby <rlibby@FreeBSD.org>
Subject: git: 780666c09bf9 - main - getblk: reduce time under bufobj
  lock
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rlibby
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 780666c09bf97d6e92b995b831c511b9ee37872c
Auto-Submitted: auto-generated

The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=780666c09bf97d6e92b995b831c511b9ee37872c

commit 780666c09bf97d6e92b995b831c511b9ee37872c
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-06 03:21:22 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-06 03:21:22 +0000

    getblk: reduce time under bufobj lock
    
    Use the new pctrie combined insert/lookup facility to reduce work and
    time under the bufobj interlock when associating a buf with a vnode.
    
    We now do one lookup in the dirty tree and one combined lookup/insert in
    the clean tree instead of one lookup in dirty, two in clean, and then an
    insert in clean.  We also avoid touching the possibly unrelated buf at
    the tail of the queue.
    
    Also correct an issue where the actual order of the tail queue depended
    on the insertion order due to sign issues.
    
    Reviewed by:    kib (previous version), dougm, markj
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D45395
---
 sys/kern/vfs_bio.c  |  38 ++++++++----------
 sys/kern/vfs_subr.c | 111 +++++++++++++++++++++++++++++++++++++++-------------
 sys/sys/buf.h       |   2 +-
 3 files changed, 100 insertions(+), 51 deletions(-)

diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 4d5e3a014050..4f1df9711dec 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -4231,35 +4231,29 @@ newbuf_unlocked:
 		}
 
 		/*
-		 * This code is used to make sure that a buffer is not
-		 * created while the getnewbuf routine is blocked.
-		 * This can be a problem whether the vnode is locked or not.
-		 * If the buffer is created out from under us, we have to
-		 * throw away the one we just created.
 		 *
-		 * Note: this must occur before we associate the buffer
-		 * with the vp especially considering limitations in
-		 * the splay tree implementation when dealing with duplicate
-		 * lblkno's.
-		 */
-		BO_LOCK(bo);
-		if (gbincore(bo, blkno)) {
-			BO_UNLOCK(bo);
-			bp->b_flags |= B_INVAL;
-			bufspace_release(bufdomain(bp), maxsize);
-			brelse(bp);
-			goto loop;
-		}
-
-		/*
 		 * Insert the buffer into the hash, so that it can
 		 * be found by incore.
+		 *
+		 * We don't hold the bufobj interlock while allocating the new
+		 * buffer.  Consequently, we can race on buffer creation.  This
+		 * can be a problem whether the vnode is locked or not.  If the
+		 * buffer is created out from under us, we have to throw away
+		 * the one we just created.
 		 */
 		bp->b_lblkno = blkno;
 		bp->b_blkno = d_blkno;
 		bp->b_offset = offset;
-		bgetvp(vp, bp);
-		BO_UNLOCK(bo);
+		error = bgetvp(vp, bp);
+		if (error != 0) {
+			KASSERT(error == EEXIST,
+			    ("getblk: unexpected error %d from bgetvp",
+			    error));
+			bp->b_flags |= B_INVAL;
+			bufspace_release(bufdomain(bp), maxsize);
+			brelse(bp);
+			goto loop;
+		}
 
 		/*
 		 * set B_VMIO bit.  allocbuf() the buffer bigger.  Since the
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 8f0b00a87cb5..398eda7ed897 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -2697,12 +2697,12 @@ buf_vlist_remove(struct buf *bp)
 }
 
 /*
- * Add the buffer to the sorted clean or dirty block list.
- *
- * NOTE: xflags is passed as a constant, optimizing this inline function!
+ * Add the buffer to the sorted clean or dirty block list.  Return zero on
+ * success, EEXIST if a buffer with this identity already exists, or another
+ * error on allocation failure.
  */
-static void
-buf_vlist_add(struct buf *bp, struct bufobj *bo, b_xflags_t xflags)
+static inline int
+buf_vlist_find_or_add(struct buf *bp, struct bufobj *bo, b_xflags_t xflags)
 {
 	struct bufv *bv;
 	struct buf *n;
@@ -2713,30 +2713,69 @@ buf_vlist_add(struct buf *bp, struct bufobj *bo, b_xflags_t xflags)
 	    ("buf_vlist_add: bo %p does not allow bufs", bo));
 	KASSERT((xflags & BX_VNDIRTY) == 0 || (bo->bo_flag & BO_DEAD) == 0,
 	    ("dead bo %p", bo));
-	KASSERT((bp->b_xflags & (BX_VNDIRTY|BX_VNCLEAN)) == 0,
-	    ("buf_vlist_add: Buf %p has existing xflags %d", bp, bp->b_xflags));
-	bp->b_xflags |= xflags;
+	KASSERT((bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) == xflags,
+	    ("buf_vlist_add: b_xflags %#x not set on bp %p", xflags, bp));
+
 	if (xflags & BX_VNDIRTY)
 		bv = &bo->bo_dirty;
 	else
 		bv = &bo->bo_clean;
 
-	/*
-	 * Keep the list ordered.  Optimize empty list insertion.  Assume
-	 * we tend to grow at the tail so lookup_le should usually be cheaper
-	 * than _ge. 
-	 */
-	if (bv->bv_cnt == 0 ||
-	    bp->b_lblkno > TAILQ_LAST(&bv->bv_hd, buflists)->b_lblkno)
-		TAILQ_INSERT_TAIL(&bv->bv_hd, bp, b_bobufs);
-	else if ((n = BUF_PCTRIE_LOOKUP_LE(&bv->bv_root, bp->b_lblkno)) == NULL)
+	error = BUF_PCTRIE_INSERT_LOOKUP_LE(&bv->bv_root, bp, &n);
+	if (n == NULL) {
+		KASSERT(error != EEXIST,
+		    ("buf_vlist_add: EEXIST but no existing buf found: bp %p",
+		    bp));
+	} else {
+		KASSERT((uint64_t)n->b_lblkno <= (uint64_t)bp->b_lblkno,
+		    ("buf_vlist_add: out of order insert/lookup: bp %p n %p",
+		    bp, n));
+		KASSERT((n->b_lblkno == bp->b_lblkno) == (error == EEXIST),
+		    ("buf_vlist_add: inconsistent result for existing buf: "
+		    "error %d bp %p n %p", error, bp, n));
+	}
+	if (error != 0)
+		return (error);
+
+	/* Keep the list ordered. */
+	if (n == NULL) {
+		KASSERT(TAILQ_EMPTY(&bv->bv_hd) ||
+		    (uint64_t)bp->b_lblkno <
+		    (uint64_t)TAILQ_FIRST(&bv->bv_hd)->b_lblkno,
+		    ("buf_vlist_add: queue order: "
+		    "%p should be before first %p",
+		    bp, TAILQ_FIRST(&bv->bv_hd)));
 		TAILQ_INSERT_HEAD(&bv->bv_hd, bp, b_bobufs);
-	else
+	} else {
+		KASSERT(TAILQ_NEXT(n, b_bobufs) == NULL ||
+		    (uint64_t)bp->b_lblkno <
+		    (uint64_t)TAILQ_NEXT(n, b_bobufs)->b_lblkno,
+		    ("buf_vlist_add: queue order: "
+		    "%p should be before next %p",
+		    bp, TAILQ_NEXT(n, b_bobufs)));
 		TAILQ_INSERT_AFTER(&bv->bv_hd, n, bp, b_bobufs);
-	error = BUF_PCTRIE_INSERT(&bv->bv_root, bp);
-	if (error)
-		panic("buf_vlist_add:  Preallocated nodes insufficient.");
+	}
+
 	bv->bv_cnt++;
+	return (0);
+}
+
+/*
+ * Add the buffer to the sorted clean or dirty block list.
+ *
+ * NOTE: xflags is passed as a constant, optimizing this inline function!
+ */
+static void
+buf_vlist_add(struct buf *bp, struct bufobj *bo, b_xflags_t xflags)
+{
+	int error;
+
+	KASSERT((bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) == 0,
+	    ("buf_vlist_add: Buf %p has existing xflags %d", bp, bp->b_xflags));
+	bp->b_xflags |= xflags;
+	error = buf_vlist_find_or_add(bp, bo, xflags);
+	if (error)
+		panic("buf_vlist_add: error=%d", error);
 }
 
 /*
@@ -2775,26 +2814,42 @@ gbincore_unlocked(struct bufobj *bo, daddr_t lblkno)
 /*
  * Associate a buffer with a vnode.
  */
-void
+int
 bgetvp(struct vnode *vp, struct buf *bp)
 {
 	struct bufobj *bo;
+	int error;
 
 	bo = &vp->v_bufobj;
-	ASSERT_BO_WLOCKED(bo);
+	ASSERT_BO_UNLOCKED(bo);
 	VNASSERT(bp->b_vp == NULL, bp->b_vp, ("bgetvp: not free"));
 
 	CTR3(KTR_BUF, "bgetvp(%p) vp %p flags %X", bp, vp, bp->b_flags);
 	VNASSERT((bp->b_xflags & (BX_VNDIRTY|BX_VNCLEAN)) == 0, vp,
 	    ("bgetvp: bp already attached! %p", bp));
 
-	vhold(vp);
-	bp->b_vp = vp;
-	bp->b_bufobj = bo;
 	/*
-	 * Insert onto list for new vnode.
+	 * Add the buf to the vnode's clean list unless we lost a race and find
+	 * an existing buf in either dirty or clean.
 	 */
-	buf_vlist_add(bp, bo, BX_VNCLEAN);
+	bp->b_vp = vp;
+	bp->b_bufobj = bo;
+	bp->b_xflags |= BX_VNCLEAN;
+	error = EEXIST;
+	BO_LOCK(bo);
+	if (BUF_PCTRIE_LOOKUP(&bo->bo_dirty.bv_root, bp->b_lblkno) == NULL)
+		error = buf_vlist_find_or_add(bp, bo, BX_VNCLEAN);
+	BO_UNLOCK(bo);
+	if (__predict_true(error == 0)) {
+		vhold(vp);
+		return (0);
+	}
+	if (error != EEXIST)
+		panic("bgetvp: buf_vlist_add error: %d", error);
+	bp->b_vp = NULL;
+	bp->b_bufobj = NULL;
+	bp->b_xflags &= ~BX_VNCLEAN;
+	return (error);
 }
 
 /*
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index cee9547912a6..832cfaa617a5 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -603,7 +603,7 @@ void	vfs_unbusy_pages(struct buf *);
 int	vmapbuf(struct buf *, void *, size_t, int);
 void	vunmapbuf(struct buf *);
 void	brelvp(struct buf *);
-void	bgetvp(struct vnode *, struct buf *);
+int	bgetvp(struct vnode *, struct buf *) __result_use_check;
 void	pbgetbo(struct bufobj *bo, struct buf *bp);
 void	pbgetvp(struct vnode *, struct buf *);
 void	pbrelbo(struct buf *);

From nobody Thu Jun  6 04:22:00 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvrkw6LJnz5N1Wf;
	Thu, 06 Jun 2024 04:22:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvrkw5q7cz4ml6;
	Thu,  6 Jun 2024 04:22:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717647720;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=09lVgKJ6g+PwhwtXD7ktTuEHB0jfB9WbEBGYFwMi+fY=;
	b=SKzQuf5v8btV67L+Rw1A9H2kirRaZb1Izk3HyJh+/IMqY1xHui5mxpU062itXXsgv87Y+K
	gPMaNEx5iNChgmtgtXgnENCOfnhXgENJvxwRYrHDpK3kMtLqZs2qnsX4UZA6Z59hbC9aPu
	Ec2QKZmscAri2Z6zFa7DH+Q9Of49S1PLyJXLrY0USIMsAqaYNIc816ikUqrAIwjap9FBtb
	oog4EevoKCaIupR2EB+rlX/qfUIng6YSxY1vrAXb+clUc6qjBUgmF0IBVbEocLo4v+ZjIe
	V2Gah7SNTe12y22AwL0V0qPjbTVRxic83zpapFyveCkyztyRaVq6TjahQdRvLw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717647720; a=rsa-sha256; cv=none;
	b=ZsFtKHLcDOkk6UAlAIkwOrPB/ZPAkEOY6ybX3DZPTXoqefbBJgqawMzPjfd7IBYttUWpRl
	hpch/owPdqsa4kiNgxCCYC92WaF6ujJBBZcHIh3a92HLnvvF3ecwP5AqXEaeiKj79xImqf
	CLnkP+fP3ZZ/X3eFe9MupO4yyjMSscPi7iXrosjiZCI+Rnh1yEcjDb2KuZ2bk6DF7/16QE
	idzw37LxJm9tsjHq1U3DCZZk1hP053NkJY8C/8SO25qAcCnys8o7x10YcRkxeEgtMDv0GD
	bCxmqwLpJcRhwPlJFC7cVj8PudIlkbYnXs17vjkKaJXjHeztdASoYtkgArltvQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717647720;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=09lVgKJ6g+PwhwtXD7ktTuEHB0jfB9WbEBGYFwMi+fY=;
	b=VVpNojYojj5rfFV8EXv5CW7kLdtDNKxYFKJKHmKUt6oUrLMThCfzDCfB5j23jClISRNjv5
	6PpzJuhBzPwWuPdFHX4IwLjn0JYq0MIKUjn5uLoDATeLlqAujoUTAFrHmczRAVwBEx5+OY
	AT68VqoAgUqWTwv+QoyEC/U1tcUIXuweQUWSljV8v89ssmsU2cexGSk3EATUG0X+chfoFm
	ed9+EeK5niahhSdddYIswe0z1S8NrAGz+xlFvNzy0vZPoGZpqO9hPVn4iHRP1SjHoEKVdl
	KK6h3k63X++i/cJe4OXoldlp9o6L7pfltsQkZXvIbpxwK1+JrJTo8pb7PArklw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vvrkw5QJtzWm4;
	Thu,  6 Jun 2024 04:22:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4564M0QN054104;
	Thu, 6 Jun 2024 04:22:00 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4564M0hw054101;
	Thu, 6 Jun 2024 04:22:00 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 04:22:00 GMT
Message-Id: <202406060422.4564M0hw054101@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Zhenlei Huang <zlei@FreeBSD.org>
Subject: git: 215a18d502cb - main - if_enc(4): Prefer the boolean
  form when calling bpf_peers_present()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: zlei
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 215a18d502cba2cf57251e82a84484219f2c432a
Auto-Submitted: auto-generated

The branch main has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=215a18d502cba2cf57251e82a84484219f2c432a

commit 215a18d502cba2cf57251e82a84484219f2c432a
Author:     Zhenlei Huang <zlei@FreeBSD.org>
AuthorDate: 2024-06-06 04:20:26 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-06-06 04:20:26 +0000

    if_enc(4): Prefer the boolean form when calling bpf_peers_present()
    
    No functional change intended.
    
    MFC after:      1 week
---
 sys/net/if_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c
index 971afdabfff6..eaac0a843189 100644
--- a/sys/net/if_enc.c
+++ b/sys/net/if_enc.c
@@ -217,7 +217,7 @@ enc_bpftap(struct ifnet *ifp, struct mbuf *m, const struct secasvar *sav,
 	else if (hhook_type == HHOOK_TYPE_IPSEC_OUT &&
 	    (enc & V_bpf_mask_out) == 0)
 		return;
-	if (bpf_peers_present(ifp->if_bpf) == 0)
+	if (!bpf_peers_present(ifp->if_bpf))
 		return;
 	hdr.af = af;
 	hdr.spi = sav->spi;

From nobody Thu Jun  6 05:15:13 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VvswK5PQ0z5N8sp;
	Thu, 06 Jun 2024 05:15:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VvswK3FpTz4sTk;
	Thu,  6 Jun 2024 05:15:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717650913;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3qn057cKIdKszlee69Ul854DelqENKPEcGjWfkrOQE8=;
	b=Zknyi9uRYySM+dwyEfVaZJS1sl3a/ywh3slnVXwO/NRK4376QLC/Ci16RWgFjJot5RHIUv
	8/3fSZt1K1lX2uy/r8sQ4L89Fda6y65GA8FkVQ8oVNJ+O/3TPYjihL6/4EJxGgZR4fYI4o
	09hi+KoVj7JWDpN+18QHT0lbfCRF+YSypfY1UAI8RrxAkYXoNtgC51vqvq3x/+J56fVWhp
	SSolo4YE52FTZzqmAJ70ZCs/OJT4GxjkSw4DNoDinoKmBoviwTpJHXkQc55eX5+3r7pIdz
	ZvaKf2JAY4TnteurQh0jUflxtSFjD/rlmFZ6R5xk20FYQJPkY7tg6Fb7cPdsVw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717650913; a=rsa-sha256; cv=none;
	b=shIxo4wEa9/KbY60taLfmtsVM311vmhbBNxSO2AtMIaS/LaSWH8VpWKTvKfbZKSL6q69Fg
	OVZomXFCMKvwS2ixwuzFBIGZFx6zpYXG6vkHIbsl/UHN/l85+O/LZQC6kNLqPg+OclCEOY
	3ZRDgYLVlKj00pxvVxnGfif7CCPTOaoZ5gFC4wqp+UeUrafrwcAr5oep26wqGvWgAOmgzx
	VQ8SxdTTA7aljSd0gk002IvxLIlZE/mmhfBrVQy16UYiLUcFn61xiD4GLp5hoYB2MK62yj
	nXAI1CWPb30hO7dJ1MEEMH3/0YHDcQRpxEK4OVWH99QaI4J4S8If8t3ooBBXgg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717650913;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3qn057cKIdKszlee69Ul854DelqENKPEcGjWfkrOQE8=;
	b=yNl0Gw/gTbimVgkfSLTR41+FRoenzREkLJuKcnqIjGm0b/YotfidWV79OBukD3CgVDUtnc
	V1RAOZWmGq8XqTcPzs7q8CiGZgSmTu4ADFp0E9tK1D0yvNBvXRzzLMlPy0tSEmmPP3Tdt/
	5LbIm25iTNYoHyEEB2FVI03L2M8hJ5ljAaab3mTtZs5uEZwnhRK5s+pAftk7d8THJ5mXtG
	I9Ichk4G31bTydFLzbrhTpL1t2IU7Eyby5kPG0ol+vCztMhsKmyiDLitiX83F2qtysaXhM
	YVUKFMODBPMe+i9/SRiDQumOzFcXUZ6Gul8Pc/vwY4NCaLktPPRS//IPFdNirQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VvswK2nVczY3s;
	Thu,  6 Jun 2024 05:15:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4565FD2w042123;
	Thu, 6 Jun 2024 05:15:13 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4565FDRl042120;
	Thu, 6 Jun 2024 05:15:13 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 05:15:13 GMT
Message-Id: <202406060515.4565FDRl042120@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Konstantin Belousov <kib@FreeBSD.org>
Subject: git: 9c5d7e4a0c02 - main - pmap: move the
  smp_targeted_tlb_shutdown pointer stuff to amd64 pmap.h
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kib
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 9c5d7e4a0c02bc45b61f565586da2abcc65d70fa
Auto-Submitted: auto-generated

The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=9c5d7e4a0c02bc45b61f565586da2abcc65d70fa

commit 9c5d7e4a0c02bc45b61f565586da2abcc65d70fa
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-06-06 05:03:14 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-06-06 05:15:08 +0000

    pmap: move the smp_targeted_tlb_shutdown pointer stuff to amd64 pmap.h
    
    Fixes:  bec000c9c1ef409989685bb03ff0532907befb4aESC
    Sponsored by:   The FreeBSD Foundation
---
 sys/amd64/include/pmap.h | 27 +++++++++++++++++++++++++++
 sys/vm/pmap.h            | 27 ---------------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index 591244e19b7c..273693e1f782 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -542,6 +542,33 @@ pmap_get_pcid(pmap_t pmap)
 }
 #endif /* sys/pcpu.h */
 
+/*
+ * Invalidation request.  PCPU pc_smp_tlb_op uses u_int instead of the
+ * enum to avoid both namespace and ABI issues (with enums).
+ */
+enum invl_op_codes {
+	INVL_OP_TLB               = 1,
+	INVL_OP_TLB_INVPCID       = 2,
+	INVL_OP_TLB_INVPCID_PTI   = 3,
+	INVL_OP_TLB_PCID          = 4,
+	INVL_OP_PGRNG             = 5,
+	INVL_OP_PGRNG_INVPCID     = 6,
+	INVL_OP_PGRNG_PCID        = 7,
+	INVL_OP_PG                = 8,
+	INVL_OP_PG_INVPCID        = 9,
+	INVL_OP_PG_PCID           = 10,
+	INVL_OP_CACHE             = 11,
+};
+
+typedef void (*smp_invl_local_cb_t)(struct pmap *, vm_offset_t addr1,
+    vm_offset_t addr2);
+typedef void (*smp_targeted_tlb_shootdown_t)(pmap_t, vm_offset_t, vm_offset_t,
+    smp_invl_local_cb_t, enum invl_op_codes);
+
+void smp_targeted_tlb_shootdown_native(pmap_t, vm_offset_t, vm_offset_t,
+    smp_invl_local_cb_t, enum invl_op_codes);
+extern smp_targeted_tlb_shootdown_t smp_targeted_tlb_shootdown;
+
 #endif /* _KERNEL */
 
 /* Return various clipped indexes for a given VA */
diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h
index c8ca6279031c..9101201287b2 100644
--- a/sys/vm/pmap.h
+++ b/sys/vm/pmap.h
@@ -167,33 +167,6 @@ void		 pmap_unwire(pmap_t pmap, vm_offset_t start, vm_offset_t end);
 void		 pmap_zero_page(vm_page_t);
 void		 pmap_zero_page_area(vm_page_t, int off, int size);
 
-/*
- * Invalidation request.  PCPU pc_smp_tlb_op uses u_int instead of the
- * enum to avoid both namespace and ABI issues (with enums).
- */
-enum invl_op_codes {
-	INVL_OP_TLB               = 1,
-	INVL_OP_TLB_INVPCID       = 2,
-	INVL_OP_TLB_INVPCID_PTI   = 3,
-	INVL_OP_TLB_PCID          = 4,
-	INVL_OP_PGRNG             = 5,
-	INVL_OP_PGRNG_INVPCID     = 6,
-	INVL_OP_PGRNG_PCID        = 7,
-	INVL_OP_PG                = 8,
-	INVL_OP_PG_INVPCID        = 9,
-	INVL_OP_PG_PCID           = 10,
-	INVL_OP_CACHE             = 11,
-};
-typedef void (*smp_invl_local_cb_t)(struct pmap *, vm_offset_t addr1,
-    vm_offset_t addr2);
-typedef void (*smp_targeted_tlb_shootdown_t)(pmap_t, vm_offset_t, vm_offset_t,
-    smp_invl_local_cb_t, enum invl_op_codes);
-
-extern void
-smp_targeted_tlb_shootdown_native(pmap_t, vm_offset_t, vm_offset_t,
-    smp_invl_local_cb_t, enum invl_op_codes);
-extern smp_targeted_tlb_shootdown_t smp_targeted_tlb_shootdown;
-
 #define	pmap_resident_count(pm)	((pm)->pm_stats.resident_count)
 #define	pmap_wired_count(pm)	((pm)->pm_stats.wired_count)
 

From nobody Thu Jun  6 06:33:00 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvvf50fZyz5LPPK;
	Thu, 06 Jun 2024 06:33:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvvf5088dz43B3;
	Thu,  6 Jun 2024 06:33:01 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717655581;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=O9G1YZszObCKa8zsgIMqzJNuWsc7VTPajixynjstB+A=;
	b=RqPnwFR4H6VRO5Jqa8l+gThRNqaQOpQH0jENHmAX0pPdIT3qYkJBXDAjM/fIVlRAIEWZg5
	b3ZN4mzlDvEctEUsoadLsS5wn0YDzh+2dERhVgB7gGV3gRRD5pFsPwF69nuceNQx/KIl+c
	J3D/oCYIpqQxPiXY0OEnlNpMjru9wkqrLg0Av/3IolkHpuMGWdXnrbu8bNryMkYO7Tg/tR
	Ma29pnOG20k4YmCrgLMfKr7H6Ce48kAOuM95IYGWPtOCOWLXAS9+LzyWd1zZANHHenVKWY
	FJBD2SQ2fntiZuCgUre23DQyHnbNgBJNaeRpYry2dwKaLafYORgoyrtR939xVg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717655581; a=rsa-sha256; cv=none;
	b=UmbvkIdPVHp4fEhWBz5u8Z3Fx1U5mO75MjTzSICH0wd1gCcfRkaeoteZy7K0VNRQTsHtOL
	ikFB3MYs41Jlb7qJ1bREd0FFuhYtPwWqNS93C2hTdjUeoNPU41lTpTo+nk6LvAysMm9lnw
	/bH+VOfYHCmLnrCF+ShDwyJck+L2xY+y3b7J0vchFse3gpayPdZZyRntYATs5hWM1zp6WD
	d2n8wHxvJyy3rxF4u6YCqfz8Ocmz/Vz/vSdNdPv0hj3uA27/qKJ+9Ve3v7stpUxoE0aQNM
	qeCZp0yGGQAH8vJmbY7ly8/XQKQjRyEVP4Gqyp9hFORCrF1X5gu6kvts30FEeQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717655581;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=O9G1YZszObCKa8zsgIMqzJNuWsc7VTPajixynjstB+A=;
	b=bOqw21KI+jUrVEBEcmX/IQ7v5DQb9BFfqc8N5MP/kjz/hezlRKBev7uBSemAWRBnp+z4cY
	ptdii/OMapnYaizI+zEcxcyfbRYxanpnZG6ZZzccrmd434yKMqlJpcMjsCVra0gkADEJo+
	xzCF9ck4yCMsOimB/8cCDuop0BhLGL14VVWEgMPH9eqp4F0t+WheI8Cmt7nxceLHsEN5cH
	2wgRGRECJ+Z2lyVN3FFlKrxt9+vZWdEMjh5fpL4YTX75h2I/2R0a9xW+uRBMSRf968oBWR
	j7eUNT5eVFC0fpoz/WFpr/vNah2SqDYIKcNPcoa2i66F+hAsfHZyr9FliNahvw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vvvf46s1CzbYd;
	Thu,  6 Jun 2024 06:33:00 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4566X0pH077020;
	Thu, 6 Jun 2024 06:33:00 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4566X0ZB077017;
	Thu, 6 Jun 2024 06:33:00 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 06:33:00 GMT
Message-Id: <202406060633.4566X0ZB077017@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Michael Tuexen <tuexen@FreeBSD.org>
Subject: git: 86c9325d341f - main - tcp: simplify stack switching
  protocol
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: tuexen
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 86c9325d341fc3f39543bcfaf7c3bb3ceeacbe5d
Auto-Submitted: auto-generated

The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=86c9325d341fc3f39543bcfaf7c3bb3ceeacbe5d

commit 86c9325d341fc3f39543bcfaf7c3bb3ceeacbe5d
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-06-06 06:29:05 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-06-06 06:29:05 +0000

    tcp: simplify stack switching protocol
    
    Before this patch, a stack (tfb) accepts a tcpcb (tp), if the
    tp->t_state is TCPS_CLOSED or tfb->tfb_tcp_handoff_ok is not NULL
    and tfb->tfb_tcp_handoff_ok(tp) returns 0.
    After this patch, the only check is tfb->tfb_tcp_handoff_ok(tp)
    returns 0. tfb->tfb_tcp_handoff_ok must always be provided.
    For existing TCP stacks (FreeBSD, RACK and BBR) there is no
    functional change. However, the logic is simpler.
    
    Reviewed by:            lstewart, peter_lei_ieee_.org, rrs
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D45253
---
 share/man/man9/tcp_functions.9 | 45 ++++++++++++++----------------------------
 sys/netinet/tcp_subr.c         | 12 +++++------
 sys/netinet/tcp_usrreq.c       | 27 ++++++-------------------
 sys/netinet/tcp_var.h          | 11 ++++-------
 4 files changed, 30 insertions(+), 65 deletions(-)

diff --git a/share/man/man9/tcp_functions.9 b/share/man/man9/tcp_functions.9
index eb9b299eae9e..1e0616e03a9f 100644
--- a/share/man/man9/tcp_functions.9
+++ b/share/man/man9/tcp_functions.9
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd March 10, 2017
+.Dd June 6, 2024
 .Dt TCP_FUNCTIONS 9
 .Os
 .Sh NAME
@@ -176,9 +176,10 @@ struct tcp_function_block {
 			    uint32_t, u_int);
 	int	(*tfb_tcp_timer_active)(struct tcpcb *, uint32_t);
 	void	(*tfb_tcp_timer_stop)(struct tcpcb *, uint32_t);
-	/* Optional functions */
+	/* Optional function */
 	void	(*tfb_tcp_rexmit_tmr)(struct tcpcb *);
-	void	(*tfb_tcp_handoff_ok)(struct tcpcb *);
+	/* Mandatory function */
+	int	(*tfb_tcp_handoff_ok)(struct tcpcb *);
 	/* System use */
 	volatile uint32_t tfb_refcnt;
 	uint32_t  tfb_flags;
@@ -261,37 +262,21 @@ However, care must be taken to ensure the retransmit timer leaves the
 TCP control block in a valid state for the remainder of the retransmit
 timer logic.
 .Pp
-A user may select a new TCP stack before calling
-.Xr connect 2
-or
-.Xr listen 2 .
-Optionally, a TCP stack may also allow a user to begin using the TCP stack for
-a connection that is in a later state by setting a non-NULL function pointer in
-the
+A user may select a new TCP stack before calling at any time.
+Therefore, the function pointer
 .Va tfb_tcp_handoff_ok
-field.
-If this field is non-NULL and a user attempts to select that TCP stack after
-calling
-.Xr connect 2
-or
-.Xr listen 2
-for that socket, the kernel will call the function pointed to by the
+field must be non-NULL.
+If a user attempts to select that TCP stack, the kernel will call the function
+pointed to by the
 .Va tfb_tcp_handoff_ok
 field.
 The function should return 0 if the user is allowed to switch the socket to use
-the TCP stack.
-Otherwise, the function should return an error code, which will be returned to
-the user.
-If the
-.Va tfb_tcp_handoff_ok
-field is
-.Dv NULL
-and a user attempts to select the TCP stack after calling
-.Xr connect 2
-or
-.Xr listen 2
-for that socket, the operation will fail and the kernel will return
-.Er EINVAL .
+the TCP stack. In this case, the kernel will call the function pointed to by
+.Va tfb_tcp_fb_init
+if this function pointer is non-NULL and finally perform the stack switch.
+If the user is not allowed to switch the socket, the function should undo any
+changes it made to the connection state configuration and return an error code,
+which will be returned to the user.
 .Pp
 The
 .Va tfb_refcnt
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 7259d3607869..b871d8416b19 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -516,8 +516,7 @@ tcp_switch_back_to_default(struct tcpcb *tp)
 		tfb = NULL;
 	}
 	/* Does the stack accept this connection? */
-	if (tfb != NULL && tfb->tfb_tcp_handoff_ok != NULL &&
-	    (*tfb->tfb_tcp_handoff_ok)(tp)) {
+	if (tfb != NULL && (*tfb->tfb_tcp_handoff_ok)(tp)) {
 		refcount_release(&tfb->tfb_refcnt);
 		tfb = NULL;
 	}
@@ -551,11 +550,9 @@ tcp_switch_back_to_default(struct tcpcb *tp)
 		/* there always should be a default */
 		panic("Can't refer to tcp_def_funcblk");
 	}
-	if (tfb->tfb_tcp_handoff_ok != NULL) {
-		if ((*tfb->tfb_tcp_handoff_ok) (tp)) {
-			/* The default stack cannot say no */
-			panic("Default stack rejects a new session?");
-		}
+	if ((*tfb->tfb_tcp_handoff_ok)(tp)) {
+		/* The default stack cannot say no */
+		panic("Default stack rejects a new session?");
 	}
 	if (tfb->tfb_tcp_fb_init != NULL &&
 	    (*tfb->tfb_tcp_fb_init)(tp, &ptr)) {
@@ -1186,6 +1183,7 @@ register_tcp_functions_as_names(struct tcp_function_block *blk, int wait,
 	if ((blk->tfb_tcp_output == NULL) ||
 	    (blk->tfb_tcp_do_segment == NULL) ||
 	    (blk->tfb_tcp_ctloutput == NULL) ||
+	    (blk->tfb_tcp_handoff_ok == NULL) ||
 	    (strlen(blk->tfb_tcp_block_name) == 0)) {
 		/*
 		 * These functions are required and you
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index f768f42114d4..3bc283c5a9db 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1731,32 +1731,17 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt)
 			INP_WUNLOCK(inp);
 			return (0);
 		}
-		if (tp->t_state != TCPS_CLOSED) {
-			/*
-			 * The user has advanced the state
-			 * past the initial point, we may not
-			 * be able to switch.
-			 */
-			if (blk->tfb_tcp_handoff_ok != NULL) {
-				/*
-				 * Does the stack provide a
-				 * query mechanism, if so it may
-				 * still be possible?
-				 */
-				error = (*blk->tfb_tcp_handoff_ok)(tp);
-			} else
-				error = EINVAL;
-			if (error) {
-				refcount_release(&blk->tfb_refcnt);
-				INP_WUNLOCK(inp);
-				return(error);
-			}
-		}
 		if (blk->tfb_flags & TCP_FUNC_BEING_REMOVED) {
 			refcount_release(&blk->tfb_refcnt);
 			INP_WUNLOCK(inp);
 			return (ENOENT);
 		}
+		error = (*blk->tfb_tcp_handoff_ok)(tp);
+		if (error) {
+			refcount_release(&blk->tfb_refcnt);
+			INP_WUNLOCK(inp);
+			return (error);
+		}
 		/*
 		 * Ensure the new stack takes ownership with a
 		 * clean slate on peak rate threshold.
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 3fdc1f4a9d74..e81ebf301c8e 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -542,13 +542,10 @@ typedef enum {
 #define	TCP_FUNC_OUTPUT_CANDROP	0x02   	/* tfb_tcp_output may ask tcp_drop */
 
 /**
- * Adding a tfb_tcp_handoff_ok function allows the socket
- * option to change stacks to query you even if the
- * connection is in a later stage. You return 0 to
- * say you can take over and run your stack, you return
- * non-zero (an error number) to say no you can't.
- * If the function is undefined you can only change
- * in the early states (before connect or listen).
+ * tfb_tcp_handoff_ok is a mandatory function allowing
+ * to query a stack, if it can take over a tcpcb.
+ * You return 0 to say you can take over and run your stack,
+ * you return non-zero (an error number) to say no you can't.
  *
  * tfb_tcp_fb_init is used to allow the new stack to
  * setup its control block. Among the things it must

From nobody Thu Jun  6 09:08:13 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vvz593CXFz5M80Q;
	Thu, 06 Jun 2024 09:08:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vvz592kr5z4WnZ;
	Thu,  6 Jun 2024 09:08:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717664893;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=uwtr4/21VLh3D5G9eoCaYIeUGg2GeDepcSpUhNGC00E=;
	b=Go5bIEap+YD1Oi1H8xMNkFsmbhdhZEbqH6vId+2tUJ4tq0AEwTVCDmWXwMFzceoyHxUfYD
	tfzdwITkH8kfFTRwuj56ZtViS1bs01kzyGZNZtxfDsC9ya0L6clft4T7Z4FQVM8EgK4qwY
	HufowBGRk3gxtCLFVqJh/cRGtpvWw4Gl6Rcjl9Rdunsab7UYZLSSKcfNEqmzMpyQmHNxNv
	nONBoEKw1ZkLX9kMT5/+UNqYDdtk4024zEiFxi20FddxUq4mHWDl4K+MbCn2vkEE9wlH4I
	aIAkadifm8lKpzI3wLHRYJ4tGKnTJHzqzzJjwx05XH3DbiNCvHLCuMD+AuMTOw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717664893; a=rsa-sha256; cv=none;
	b=jctwg038X/kbE99f/6H7naFUhaNP2UK5s+aAlWCNO7O9CyBZLBBmvm2BY9ZX12lBQnGIys
	/gFpDsI4rAF+fFGbaiDSFEIQwOaZBi/oCn0eT1p3cQB4jNu28KY/NBvqAAKi0jUsJMHujC
	q8+PrakPYhYqcOE+wUjnmO6ylkzGBCbvz0LsokgMgApHKbag7NaE+1pJBAgsroLbAsCs0F
	RkXavM9EAhtjEbdlo4P+eKaeqOeYbjpyIxfzldOBCZJeEktdvTCjbnmPCvgIBLCm58kyM8
	elYjqyCgWKKA+5cLAtMSKZ9xYaGp5oXMPZXw0fJjL3zp4taxLvai7Vt21IgYCA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717664893;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=uwtr4/21VLh3D5G9eoCaYIeUGg2GeDepcSpUhNGC00E=;
	b=T5Qx1Tr4iUi3sOzywOXahtFupcxKY3cnogNYT8KkIXV1ZZ11btThSiD+TLIBGMAR65EMLA
	IXWlff6W9OYu57hseL7lPdZPAMIWM2lU1LbCFmHryrm9ohYisfsn9T2Ufizz5m9i70myRm
	biB24j3TAiEOAOe7+owB/ebsRfFpi5DhFIA1kOdQX5AWCIBNzIxVXIJRSJM+mUArvRgVP/
	+TuQ1PK/AOpopKWUIwsXd33ErTxt9MxEInSEaF4R2KoQrRjscpZUXwYBf0XpAuZLqHN06O
	eS/bk5Pb6MRutW2ZtcNpATYntk84OfXkzBN/bj5vXUXdC0L09ntQhDnkh3nmuA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vvz592LBfzfpQ;
	Thu,  6 Jun 2024 09:08:13 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45698D1G038227;
	Thu, 6 Jun 2024 09:08:13 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45698DEP038224;
	Thu, 6 Jun 2024 09:08:13 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 09:08:13 GMT
Message-Id: <202406060908.45698DEP038224@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Andrew Turner <andrew@FreeBSD.org>
Subject: git: ec69d230933f - main - linux: Allows writing to the
  vdso from the kernel
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: andrew
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: ec69d230933f82c7c142b053882255aa57475463
Auto-Submitted: auto-generated

The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=ec69d230933f82c7c142b053882255aa57475463

commit ec69d230933f82c7c142b053882255aa57475463
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-06-05 18:47:48 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-06-06 09:07:49 +0000

    linux: Allows writing to the vdso from the kernel
    
    We need to write to the vdso in the kernel to perform fixups. Move it
    from .rodata to .data so these can be run.
    
    Reported by:    cy
    Sponsored by:   Arm Ltd
---
 sys/compat/linux/linux_vdso_inc.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/compat/linux/linux_vdso_inc.S b/sys/compat/linux/linux_vdso_inc.S
index af10907f0b60..44cc357b4a4a 100644
--- a/sys/compat/linux/linux_vdso_inc.S
+++ b/sys/compat/linux/linux_vdso_inc.S
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 
-	.section .rodata
+	.section .data
 	.globl _binary_linux_vdso_so_o_start
 _binary_linux_vdso_so_o_start:
 	.incbin "linux_vdso.so.o"

From nobody Thu Jun  6 10:37:43 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw14S1bgGz5Mdsm;
	Thu, 06 Jun 2024 10:37:44 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw14S0zjCz4hql;
	Thu,  6 Jun 2024 10:37:44 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670264;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=4Xc4C/opHxg79qNWfrDX+g7/813eTp3CbvNJd1FGjOw=;
	b=ubikpE4h+Z9peHCc43UvdTIy9h1PbTeXMFG58sIBUjFZrHuEQhPZUOlvWj0SBzdB6uXD+t
	togLAANlql8Sps/sRSDdsWnT7u9FnsAkEfcWp0SND2E4+McnzmtuU35HdNkUp5qtimj883
	2RBo/k9YDwzOdarPHQR7cu85o9g4ZhFNO9T5sGIxKcf6dLkd7sdrF8Fkq7oEkNJnnMvwb4
	SAXLWnMc/6Kf+zHMx3pgr6cBFYn32E+P3sWq2MwhRk9Vs9Me1odgEihog6fb3hXBGdS1Xl
	hMddML1cb88B0n3a9VX9xOJH++DTX2M4Bq7tTLgpNAB8uJr5X+hiUU8B0/hbCQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670264; a=rsa-sha256; cv=none;
	b=QrmDITSXah1B9DHK8ToBSClHI4+v94jgZnYaaVeAX/DZVulbzmc3Bu04tt3jD0jy+obDTY
	+4tQAdLKnJgIiL3JpQpTLOpPTyIwG4y91p0ZFHRnBe8oT2fMrKn1puDrAwOfKm+zecnolK
	55Qb2dyGn8V6xMczXyY1L6pjRqpzY13lBSLXKIGUHoV0ohfuSiS4NOki6aKeYIa6FyaXZP
	z+Fe/PKTBtoaI6mKqc/pu8GaT4Hg2U8yX1p22xv2EpRjfhNHp3PZ5H18dWy8iLsUtAZFuB
	kBMLAWdEMbQkdqZr0ZTOApFTJvI4vSrdrxgvBhKYYfaRNX1zZHuQ9y+lfiYbXA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670264;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=4Xc4C/opHxg79qNWfrDX+g7/813eTp3CbvNJd1FGjOw=;
	b=WButSmaHPFW8levoSY7ppkOLzSDUXtBerUNgA6tLXFiK965BCRm8vwYiaPflGrej1TMVOV
	nwzE+0t+j2oreMw1Nn8KgGqI/rnJSZOIEtRhh+2WPLo3lO3Pma4ZHB6+MbYNxD3KutUlDo
	6qw0invssrPj6eDs3QrMvWSfjhEF+MJDz/HNoZoIMF8OS/fHTlNNpdylPu90je9BkIhB45
	fvg1ldjaOt8UQuGlZ6LIwo3AnRN0V2CvfoTf67oXCRLPNYSzNYRPKuNCoNNUukBBJtzBDc
	Tzr+zIiC58fRwM/IPzQw4jx3TqL0BABMI5ucinAE7oVPan0HpmVjyTPyHoMRSA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw14S0SdtzjLh;
	Thu,  6 Jun 2024 10:37:44 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AbhFF089121;
	Thu, 6 Jun 2024 10:37:43 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Abhkv089118;
	Thu, 6 Jun 2024 10:37:43 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:37:43 GMT
Message-Id: <202406061037.456Abhkv089118@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Stefan =?utf-8?Q?E=C3=9Fer?= <se@FreeBSD.org>
Subject: git: 17e85f59907a - main - newfs_msdos: align to multiple
  of cluster size by default
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: se
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 17e85f59907aecc0c9e812ee094303f6e1fdd845
Auto-Submitted: auto-generated

The branch main has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=17e85f59907aecc0c9e812ee094303f6e1fdd845

commit 17e85f59907aecc0c9e812ee094303f6e1fdd845
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2024-06-06 10:28:02 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2024-06-06 10:28:02 +0000

    newfs_msdos: align to multiple of cluster size by default
    
    A previous commit aligned the start of the data area to a multiple of
    the VM page size, in order to prevent extra buffers to be allocated
    (which failed for 64 KB cluster size without this alignment).
    
    Since a dependency on PAGE_SIZE caused compatibility issues, the
    alignment was made conditional on this macro being defined, in the
    previous commit. This lead to different behavior of this program
    when built on FreeBSD vs. Linux (which does not define PAGE_SIZE).
    
    This commit removes any use of PAGE_SIZE and instead always aligns
    the start of the data area to a multiple of the cluster size.
    
    The -A option is now implied, unless overridden by a specific number
    of reserved sectors with the -r option.
    
    Approved by:    kib
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D45436
---
 sbin/newfs_msdos/mkfs_msdos.c  |  9 +--------
 sbin/newfs_msdos/newfs_msdos.8 | 20 ++++++++------------
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c
index 1bca560a59e1..dcc2bb982efc 100644
--- a/sbin/newfs_msdos/mkfs_msdos.c
+++ b/sbin/newfs_msdos/mkfs_msdos.c
@@ -568,14 +568,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
 	    x1 += (bpb.bpbBigFATsecs - 1) * bpb.bpbFATs;
 	}
 	if (set_res) {
-	    if (o.align)
-		alignto = bpb.bpbSecPerClust;
-	    else
-#ifdef	PAGE_SIZE
-		alignto = PAGE_SIZE / bpb.bpbBytesPerSec;
-#else
-	        alignto = 1;
-#endif
+	    alignto = bpb.bpbSecPerClust;
 	    if (alignto > 1) {
 		/* align data clusters */
 		alignment = (bpb.bpbResSectors + bpb.bpbBigFATsecs * bpb.bpbFATs + rds) %
diff --git a/sbin/newfs_msdos/newfs_msdos.8 b/sbin/newfs_msdos/newfs_msdos.8
index 816b5fc867b4..92e407ab81af 100644
--- a/sbin/newfs_msdos/newfs_msdos.8
+++ b/sbin/newfs_msdos/newfs_msdos.8
@@ -23,7 +23,7 @@
 .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 2, 2024
+.Dd June 6, 2024
 .Dt NEWFS_MSDOS 8
 .Os
 .Sh NAME
@@ -91,13 +91,11 @@ A suffix s, k, m, g (lower or upper case)
 appended to the offset specifies that the
 number is in sectors, kilobytes, megabytes or gigabytes, respectively.
 .It Fl A
-Attempt to cluster align the data area, useful for SD card.
-If neither the
-.Fl A
-nor
+Attempt to cluster align the data area, useful for flash based storage.
+This option is enabled by default, unless a number of reserved sectors
+is specified using the
 .Fl r
-option is used, the number of reserved sectors is set to a value that aligns
-the start of the data area to a multiple of the page size of the host.
+option.
 .It Fl B Ar boot
 Get bootstrap from file.
 .It Fl C Ar create-size
@@ -173,12 +171,10 @@ is 2.
 Number of hidden sectors.
 .It Fl r Ar reserved
 Number of reserved sectors.
-If neither the
-.Fl A
-nor
+If the
 .Fl r
-option is used, the number of reserved sectors is set to a value that aligns
-the start of the data area to a multiple of the page size of the host.
+option is not used, the number of reserved sectors is set to a value that
+aligns the start of the data area to a multiple of the cluster size.
 .It Fl s Ar total
 File system size.
 .It Fl u Ar track-size

From nobody Thu Jun  6 10:39:20 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16K0pLSz5MffQ;
	Thu, 06 Jun 2024 10:39:21 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16K03B4z4j9F;
	Thu,  6 Jun 2024 10:39:21 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670361;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=NPCWgnCoQdm5P3sqkODzYO0PaFhC2ND6XEG17a9AA/c=;
	b=JDGOqyHxR/KK3LcLApMs7H60E0BBo8KmB4s8yxyPENxDdZ1a5piIAZTaf+86p1QIM7ZEn3
	713/QrCVZzvU6W20WbAQUrDzhGN2Grj/jDx1Sfp/vfViBk6dWQacmrFvQoSVoa27PpjvSU
	AukXfe4OjZtixYbi02OQ1gcicFe+GFCgJW8BaX9AD5NiXgYoEHMQXbHwVqn5+XbuXlJ+4L
	0I9NfLE2fHGYjUmvfSn9RVz2DVJQ+MJ50RUhRFucmKrOzJXZ7ifSAAuso4ESJn52jUOYTP
	q9SkEolKQT/Ta/Y217XnlF9kPu/sF/iARj44fKKpixXiwjkhwrtCF3qschoTYg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670361; a=rsa-sha256; cv=none;
	b=TZCdQqkFLxoi9cNLn6Voki4qE4BFyf9o4k3wDfDGD2g8kijJhplmoRqARIfpeSKXNZnx6S
	ApjOdGRUgCku0xibeaVQea2uHlTG1f+2XCmaJRmoqmYUtqJWdYv16an+Unh0zCOxzkueqV
	x5TqkX4nQ4fpQMtAy8zDJa+tTzNCl/mBkokwXYRf9z8tMSvNbSL+iqEn46FpnpidIiK/qd
	asZw2MtgoTaTQ4zjiQbD2Pt9sR9V3qL3AAgsMrwAY58dPBFBQz3jheHNaKu1MOWxfij9B2
	0W4hMrlU1H3J+1Ges1EpbBsTiqRlCwk8lXhO+dRQ59tRIpolCiS2cJ6dNuiT/g==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670361;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=NPCWgnCoQdm5P3sqkODzYO0PaFhC2ND6XEG17a9AA/c=;
	b=gQXCtZjlGgkmMDmjUPmn7WKjPZaU3RJES9N+Da1hqxVfIpJNHDzYwrhJg6PFV88OW8JPpo
	8DRD+yRV07vyjtHpofoSCeOxkAGWyccGh2at+akIzMDKg1Gg52wArTm6PoBhP7C2sYv540
	757/apJnAf9p9HPfGBJjr6hfZgtY+s8ARIXFBUb1VBp7YfqGP17ThP2lynlSNRMJQdCxUS
	0eEg9PNSUGgRABy93KGMOZcPJjvdA5p7F5cRxvYWwGCdnjp+7UhsvfOYyeCguTC/6npuw7
	fu+nXEew0bu91mfKAg/bGrjeVYYrOPtPmGzbWSb0V1gtY7YdrcZGbAhR+bLY1w==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16J6JWMzj4d;
	Thu,  6 Jun 2024 10:39:20 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdKao089528;
	Thu, 6 Jun 2024 10:39:20 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdKYU089525;
	Thu, 6 Jun 2024 10:39:20 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:20 GMT
Message-Id: <202406061039.456AdKYU089525@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 0d7056458db5 - main - mpi3mr: Block devices persist
  despite being offlined during reset
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 0d7056458db5b5dd7fdc5ccd8abab73e3ee76a20
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d7056458db5b5dd7fdc5ccd8abab73e3ee76a20

commit 0d7056458db5b5dd7fdc5ccd8abab73e3ee76a20
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-13 18:03:19 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:14 +0000

    mpi3mr: Block devices persist despite being offlined during reset
    
    The driver removes the drive from the OS if firmware sends 'device added'
    event with hidden bit or inaccessible status.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44421
---
 sys/dev/mpi3mr/mpi3mr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 932d174a6b50..faa8b52bbb50 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -5668,6 +5668,8 @@ static void mpi3mr_rfresh_tgtdevs(struct mpi3mr_softc *sc)
 			if (target->exposed_to_os)
 				mpi3mr_remove_device_from_os(sc, target->dev_handle);
 			mpi3mr_remove_device_from_list(sc, target, true);
+		} else if (target->is_hidden && target->exposed_to_os) {
+				mpi3mr_remove_device_from_os(sc, target->dev_handle);
 		}
 	}
 

From nobody Thu Jun  6 10:39:21 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16L64Ryz5MfcN;
	Thu, 06 Jun 2024 10:39:22 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16L2hVtz4jFb;
	Thu,  6 Jun 2024 10:39:22 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670362;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=81qSseryw60L08p0Qe9FMrD+V8TYiv96rYw6JUE3fnU=;
	b=UbZFIAWl7JMAgd2D3dJr41TnYKO0UG1rBw0NswWP7partLgtgVTs6erEIS9kR7PUp3WYSB
	UlpRsgHIPruSuegOKfsNVfcwpj9n4s4ygD7BRYUmMjyWJy+Yb/4FcbVAodUebzORCiYSiC
	hn8Kd7qG819K/8dS0kDTESMS6RDnRj694js+UKcNCSJuTG8BmoCx6I2rBcWBRw6kr9dT6M
	9ADz9fpZi0ZaHAyzl/NX9r9Hs/RfIbhI3PSgFKTno+L3oMsuaQp69L2H9SzYNSNl/GF1qE
	eLeVcAm2Z4forxNSIFCJZnoW/3ROewvWid46Hm6Jt6sJtbadb54mEv8I4jTOZg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670362; a=rsa-sha256; cv=none;
	b=oqx+VKQUTrcQgLapJ/gqqhyzYXzWbEoHdiJgnG3nBsB6akLX96L/FKuWYaWWAv4v688aWp
	dKQP0MEu4Dh2empWTVU32AWaWfPz/90zIZuLoUvq5iQfdjXysXX6AHJsBYCo78Pu0dXpzK
	5+Fj0NYkgVPAM0bD3R9E5nUSrt75A68JBP9xM60OVCQUAyfn3hFkLMGnyW94mBCjbGVSeW
	Ltz0Vd2PeSVdEnt/GBIPF1n2pL5QSrDihT7ptF7EzclOTN4uRkwu3kYRIOF2p64mgTeTgG
	Joy1yTQ0sODHnLPbbp4t00au/eBYCOZEz3a64MGk0YHdyjJGK7y0A0YnXkS6Jg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670362;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=81qSseryw60L08p0Qe9FMrD+V8TYiv96rYw6JUE3fnU=;
	b=eTvt65FanrqmijBgyUO8FDz+TS9BVj746DBuxtE6+akeTVoBnrzcNWNdsm+Syz5McOTNPe
	P0popuLFbNY/oQ8ulmEaL2EKuKv42lMSwvWupgleH/5+10C7Rk6uvUxsTRISAhdpZhu9Wz
	acIXKb0EBf2uh6/YXZMybRorxUxKZYtByG25qzRe3GkL2IKhLQLgk0jlo6VExewsGnxnoy
	4NcpAvJ+uhskJ6oRQdABHHtOG9Gxt2OpBZrFA0JCZLoOds2Ofmdtm3XPTF9yU4In0MJLpL
	PMCIfAxrdjR0Nn14lZPefRBQD9e6N3zzs0soJHWa10A/VToUDg2z1FaIIxslsQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16L05nkzj4f;
	Thu,  6 Jun 2024 10:39:22 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdLFm089576;
	Thu, 6 Jun 2024 10:39:21 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdLUR089573;
	Thu, 6 Jun 2024 10:39:21 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:21 GMT
Message-Id: <202406061039.456AdLUR089573@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 042808f74707 - main - mpi3mr: Controller state check
  before enabling PEL
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 042808f74707d3ce89e89463d4a03f81df6fd45a
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=042808f74707d3ce89e89463d4a03f81df6fd45a

commit 042808f74707d3ce89e89463d4a03f81df6fd45a
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-14 17:14:53 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:14 +0000

    mpi3mr: Controller state check before enabling PEL
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44422
---
 sys/dev/mpi3mr/mpi3mr_app.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sys/dev/mpi3mr/mpi3mr_app.c b/sys/dev/mpi3mr/mpi3mr_app.c
index 7bd926269018..60ef6765cb76 100644
--- a/sys/dev/mpi3mr/mpi3mr_app.c
+++ b/sys/dev/mpi3mr/mpi3mr_app.c
@@ -1641,6 +1641,18 @@ mpi3mr_pel_enable(struct mpi3mr_softc *sc,
 	struct mpi3mr_ioctl_pel_enable pel_enable;
 	mpi3mr_dprint(sc, MPI3MR_TRACE, "%s() line: %d\n", __func__, __LINE__);
 
+	if (sc->unrecoverable) {
+		device_printf(sc->mpi3mr_dev, "Issue IOCTL: controller is in unrecoverable state\n");
+		return EFAULT;
+	}
+	if (sc->reset_in_progress) {
+		device_printf(sc->mpi3mr_dev, "Issue IOCTL: reset in progress\n");
+		return EAGAIN;
+	}
+	if (sc->block_ioctls) {
+		device_printf(sc->mpi3mr_dev, "Issue IOCTL: IOCTLs are blocked\n");
+		return EAGAIN;
+	}
 
 	if ((data_out_sz != sizeof(pel_enable) || 
 	    (pel_enable.pel_class > MPI3_PEL_CLASS_FAULT))) {

From nobody Thu Jun  6 10:39:23 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16M68BHz5MfwS;
	Thu, 06 Jun 2024 10:39:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16M2RqTz4j4T;
	Thu,  6 Jun 2024 10:39:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670363;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=WBNuN/hSQWjzTxYZt2+JsSzGFs/rX5TuHPrf03+MomY=;
	b=e24DYxwplEKE34feeWxi0KvI4HcuFH+HXTG3ExHQ9dngsvtki0a7iHoaWDCW+6LhY/T7mq
	PPRS2pCE/rkTeNavnsNfUOqxnvwrzcLzdErYe/qUg6aL6f6qp9fd/1DRVr46dfDv2miYsu
	9I6qn1D0k029JD7BylcwSH/+jPdoaxozZN0pL7hJkpk4TvfBL3vyFB4goM5CBK9pZoPakW
	aqH0U8eZ9NiK8T0ArMWXL7r9ixk4uTrfcFuJhZlCNAopc7sKh6WRfsTxSB95THNuUQ/F3P
	IH/r9Pu2uEArqLi8N5pT+Uenc3eGGxIjEmqCK6U8lLR9F+9BTZG8l6unI+eOpg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670363; a=rsa-sha256; cv=none;
	b=WOv2/kKTQuygWeguh7ZZDgsr516ax2syWFmFuZO5ZN+a3ne0468d0rZhwIsuqIf+HEhuMz
	Rcbk6iKiMFVmfDmXuSesORU7ZUw/hFeoPEpCHrIW5isbzVERLSAkPkjp6eUBjET//DLKNB
	vKQ404s403n6eqcREvhvxfnnazdkVwmOCWgFeJt7jzbf6VnlmA9kLeuviv2B8oiDVINH6l
	DP0OxQGb3SLrBzP7PgVOuCafGYR7uh5visz8ng2Yh4wfGQy+j3T9X2JL0qKy+jG8zOai2H
	MbeifXfQQ4oW32Zjvw8FfMHWbt7WHtBLQe0JUiS/KVSJCqWumFE2U13fDASYKw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670363;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=WBNuN/hSQWjzTxYZt2+JsSzGFs/rX5TuHPrf03+MomY=;
	b=Oz6H5+bH2J9tM8gnq+XQ0GDbhOFVrXuERzxXtUhl57+8absCdTrDzoC3pi0URe7t/Ro1e3
	afuM75qzOlwbnK9RcWHiYJa9x+PzmWy6OlUtfOEzV7gXThMw8VX8YefomcHfdPp9K99EoM
	OH5g/NoX3j0zUksXBW0Mt8nNzueuxr8ZkYItJb7/Jc1cYtbi9CYeDlvJdaNbT5KLWoLwoZ
	nCoOreekk31zzT6zagCVfLWZPJsYiVxUyHqPDBvW1CkSh+i1MKEf8Ki2ISmZKQCOnXyanr
	6kcmnmZDLGUQZTZItjqUu6FxDMNOVT6V3mIzIO4IbAZkco7fseW2QEGg+13SHA==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16M189FzjLj;
	Thu,  6 Jun 2024 10:39:23 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdNjm089627;
	Thu, 6 Jun 2024 10:39:23 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdNuD089624;
	Thu, 6 Jun 2024 10:39:23 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:23 GMT
Message-Id: <202406061039.456AdNuD089624@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 701d776c98e0 - main - mpi3mr: poll reply queue and
  add MPI3MR_DEV_REMOVE_HS_COMPLETED flag
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 701d776c98e015160c2d0e3f4fdaf980d1d5dc83
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=701d776c98e015160c2d0e3f4fdaf980d1d5dc83

commit 701d776c98e015160c2d0e3f4fdaf980d1d5dc83
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-14 17:47:06 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:14 +0000

    mpi3mr: poll reply queue and add MPI3MR_DEV_REMOVE_HS_COMPLETED flag
    
    An outstanding IO counter per target check has been added before deleting
    the target from the OS which will poll the reply queue if there are any
    outstanding IOs are found.
    
    A new flag, named "MPI3MR_DEV_REMOVE_HS_COMPLETED," is added. If a remove event
    for a target occurs and before the deletion of the target resource if the add event
    for another target arrives reusing the same target ID then this flag will prevent
    the removal of the target reference. This flag ensures synchronization between the interrupt
    top and bottom half during target removal and addition events.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44423
---
 sys/dev/mpi3mr/mpi3mr.c     | 19 ++++++++-----------
 sys/dev/mpi3mr/mpi3mr.h     |  3 +--
 sys/dev/mpi3mr/mpi3mr_cam.c | 27 ++++++++++++++++++---------
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index faa8b52bbb50..72abe76ad085 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -3477,6 +3477,7 @@ static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_softc *sc,
 {
 	U16 cmd_idx = drv_cmd->host_tag - MPI3MR_HOSTTAG_DEVRMCMD_MIN;
 	struct delayed_dev_rmhs_node *delayed_dev_rmhs = NULL;
+	struct mpi3mr_target *tgtdev = NULL;
 
 	mpi3mr_dprint(sc, MPI3MR_EVENT,
 	    "%s :dev_rmhs_iouctrl_complete:handle(0x%04x), ioc_status(0x%04x), loginfo(0x%08x)\n",
@@ -3497,6 +3498,13 @@ static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_softc *sc,
 		    "%s :dev removal handshake failed after all retries: handle(0x%04x)\n",
 		    __func__, drv_cmd->dev_handle);
 	} else {
+		mtx_lock_spin(&sc->target_lock);
+		TAILQ_FOREACH(tgtdev, &sc->cam_sc->tgt_list, tgt_next) {
+		       if (tgtdev->dev_handle == drv_cmd->dev_handle)
+			       tgtdev->state = MPI3MR_DEV_REMOVE_HS_COMPLETED;
+		}
+		mtx_unlock_spin(&sc->target_lock);
+
 		mpi3mr_dprint(sc, MPI3MR_INFO,
 		    "%s :dev removal handshake completed successfully: handle(0x%04x)\n",
 		    __func__, drv_cmd->dev_handle);
@@ -3604,18 +3612,7 @@ static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_softc *sc, U16 handle,
 	U8 retrycount = 5;
 	struct mpi3mr_drvr_cmd *drv_cmd = cmdparam;
 	struct delayed_dev_rmhs_node *delayed_dev_rmhs = NULL;
-	struct mpi3mr_target *tgtdev = NULL;
 	
-	mtx_lock_spin(&sc->target_lock);
-	TAILQ_FOREACH(tgtdev, &sc->cam_sc->tgt_list, tgt_next) {
-		if ((tgtdev->dev_handle == handle) &&
-		    (iou_rc == MPI3_CTRL_OP_REMOVE_DEVICE)) {
-			tgtdev->state = MPI3MR_DEV_REMOVE_HS_STARTED;
-			break;
-		}
-	}
-	mtx_unlock_spin(&sc->target_lock);
-
 	if (drv_cmd)
 		goto issue_cmd;
 	do {
diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index d93c53b286cb..1cf6718d9047 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -446,8 +446,7 @@ enum mpi3mr_cmd_state {
 
 enum mpi3mr_target_state {
 	MPI3MR_DEV_CREATED = 1,
-	MPI3MR_DEV_REMOVE_HS_STARTED = 2,
-	MPI3MR_DEV_DELETED = 3,
+	MPI3MR_DEV_REMOVE_HS_COMPLETED = 2,
 };
 
 struct mpi3mr_cmd {
diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c
index b842e2a05bda..b8e4e350dfa1 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -1822,6 +1822,17 @@ int mpi3mr_remove_device_from_os(struct mpi3mr_softc *sc, U16 handle)
 
 	target->flags |= MPI3MRSAS_TARGET_INREMOVAL;
 
+	if (mpi3mr_atomic_read(&target->outstanding)) {
+		mpi3mr_dprint(sc, MPI3MR_ERROR, "there are [%2d] outstanding IOs on target: %d"
+			      "Poll reply queue once\n", mpi3mr_atomic_read(&target->outstanding),
+			      target->per_id);
+		mpi3mr_poll_pend_io_completions(sc);
+		if (mpi3mr_atomic_read(&target->outstanding))
+			mpi3mr_dprint(sc, MPI3MR_ERROR, "[%2d] outstanding IOs present on target: %d"
+				      "despite poll\n", mpi3mr_atomic_read(&target->outstanding),
+				      target->per_id);
+	}
+
 	while (mpi3mr_atomic_read(&target->outstanding) && (i < 30)) {
 		i++;
 		if (!(i % 2)) {
@@ -1848,18 +1859,16 @@ out:
 void mpi3mr_remove_device_from_list(struct mpi3mr_softc *sc,
 	struct mpi3mr_target *target, bool must_delete)
 {
+	if ((must_delete == false) &&
+	    (target->state != MPI3MR_DEV_REMOVE_HS_COMPLETED))
+		return;
+
 	mtx_lock_spin(&sc->target_lock);
-	if ((target->state == MPI3MR_DEV_REMOVE_HS_STARTED) ||
-	    (must_delete == true)) {
-		TAILQ_REMOVE(&sc->cam_sc->tgt_list, target, tgt_next);
-		target->state = MPI3MR_DEV_DELETED;
-	}
+	TAILQ_REMOVE(&sc->cam_sc->tgt_list, target, tgt_next);
 	mtx_unlock_spin(&sc->target_lock);
 
-	if (target->state == MPI3MR_DEV_DELETED) {
- 		free(target, M_MPI3MR);
- 		target = NULL;
- 	}
+	free(target, M_MPI3MR);
+	target = NULL;
 	
 	return;
 }

From nobody Thu Jun  6 10:39:24 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16N6P7Dz5MffT;
	Thu, 06 Jun 2024 10:39:24 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16N3LWTz4jL0;
	Thu,  6 Jun 2024 10:39:24 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670364;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Fark+VBbcrVMexKGUMo/ZUu2OzTVgOWrSmZfVGqEHjg=;
	b=f+Fyzo0gRhJvRboAn1VThHzxZVQrV0BqsgawacBBw3BGAgZAQM2fJrD4U/nxdLacHQIF+N
	kfSUYIkrETATpFhV8MgSqxQk+QYTMfD0uRfEUsRJi/XCxnLi8YeUim8YS5VZNk90uTkKnB
	6aXo2AoAuXHGH5t/CG+X2z2EZwxEc5110jUcl2X1vLGZ8dzmlHhlmluELKRTj02jsoD7rG
	Dcv7b7Psr5H2/4zvKinxHJf2pyYJtxllmedu5qENimGy2bfecqYXdO5izSRboxsPVF0zn0
	/kp7zY6vVeNMV1VGoaEfaYnKucHwW82WwHLWsVzjlIUKtO8EY1R85gsGSTamrA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670364; a=rsa-sha256; cv=none;
	b=ceH+PfFhikGfgGzH25f7FTfcHRWfqGeI85v3OXZNQjNx9tBxjr995xT7/yfRVGrY4hSYn/
	USl2ojVd4JDEjY8uuCCNkiwm3vsg+Djv/AsgaBNfm0Zn0scPvQzV3HoPYxggpuwchR+UT9
	EDQaPfLE8Ir+1SAl/THWOGNwfA7lWzlGwtvFFeZOt+Mv4k86jliAUQ7uA2/yYuQPbvRKpb
	8Lh8ILK1A8q5+tDKt9Cnea0+HWwJWY/Xd8bT/1wK2H/w+GEndwU92rTfU+nRn0SwHJ6dCV
	15MRnISSGKMvKGE+GWLCjsC5DOqM7/XFkH1IWYtkdpc58ShcZOaxVukxXlEhHA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670364;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=Fark+VBbcrVMexKGUMo/ZUu2OzTVgOWrSmZfVGqEHjg=;
	b=AppKGdvtxxhNDT6Tez03WYTOnU4TqpuByZM6bqyXMSdjaDNieQ0muzCcE5y1b0nCEwVBNq
	rkIRQGhzkJqnMGe4GxOzbe8eWekpXgU71i6bsOBb0n5afEmHMdr6cA91H67YBNAIVCdDuC
	dLvqCSKDwg0PQqrTQhXnrJ+pQ099J8YDTezzixrC3xusJOxVrJ8vdjvU0jDSSLf3BtRMep
	xqyA2cpwagT3ogCeidcTS2GZrE/8zA5UJjvi+rFOGanGgVC4L9zynxgVp0WBN5PS1Ai5ba
	Gbxi/ZFAoGBHqC8Ip38eB7shjpv9l1we/SXdGS5/XpJH1JH4HolsuuqabqN4Gw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16N2BmCzj6t;
	Thu,  6 Jun 2024 10:39:24 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdObe089691;
	Thu, 6 Jun 2024 10:39:24 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdO0w089688;
	Thu, 6 Jun 2024 10:39:24 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:24 GMT
Message-Id: <202406061039.456AdO0w089688@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 571f1d0638fa - main - mpi3mr: Decrement per controller
  and per target counter post reset
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 571f1d0638fa6b3a08f84118a33e53f941f0820c
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=571f1d0638fa6b3a08f84118a33e53f941f0820c

commit 571f1d0638fa6b3a08f84118a33e53f941f0820c
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-14 18:12:49 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: Decrement per controller and per target counter post reset
    
    Post controller reset, If any device removal events arrive, and if
    there are any outstanding IOs then the driver will unnecessarily wait
    in the loop for 30 seconds before removing the device from the OS.
    
    reset target outstanding IO counter and controller outstanding IO counter
    and remove the redundant wait loop.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44424
---
 sys/dev/mpi3mr/mpi3mr.c     |  2 ++
 sys/dev/mpi3mr/mpi3mr_cam.c | 12 ------------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 72abe76ad085..ba649edbe070 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -5692,6 +5692,8 @@ static void mpi3mr_flush_io(struct mpi3mr_softc *sc)
 			if (cmd->callout_owner) {
 				ccb = (union ccb *)(cmd->ccb);
 				ccb->ccb_h.status = CAM_SCSI_BUS_RESET;
+				mpi3mr_atomic_dec(&sc->fw_outstanding);
+				mpi3mr_atomic_dec(&cmd->targ->outstanding);
 				mpi3mr_cmd_done(sc, cmd);
 			} else {
 				cmd->ccb = NULL;
diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c
index b8e4e350dfa1..4843aa6ea721 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -1802,7 +1802,6 @@ out:
 
 int mpi3mr_remove_device_from_os(struct mpi3mr_softc *sc, U16 handle)
 {
-	U32 i = 0;
 	int retval = 0;
 	struct mpi3mr_target *target;
 
@@ -1833,17 +1832,6 @@ int mpi3mr_remove_device_from_os(struct mpi3mr_softc *sc, U16 handle)
 				      target->per_id);
 	}
 
-	while (mpi3mr_atomic_read(&target->outstanding) && (i < 30)) {
-		i++;
-		if (!(i % 2)) {
-			mpi3mr_dprint(sc, MPI3MR_INFO,
-			    "[%2d]waiting for "
-			    "waiting for outstanding commands to complete on target: %d\n",
-			    i, target->per_id);
-		}
-		DELAY(1000 * 1000);
-	}
-	
 	if (target->exposed_to_os && !sc->reset_in_progress) {
 		mpi3mr_rescan_target(sc, target);
 		mpi3mr_dprint(sc, MPI3MR_INFO,

From nobody Thu Jun  6 10:39:25 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16P607qz5Mfss;
	Thu, 06 Jun 2024 10:39:25 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16P4Bd6z4jJ8;
	Thu,  6 Jun 2024 10:39:25 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670365;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=jHkXpUt7yAaYfhl27i4H6BQ0WpDkkJIeb4Vc8uVWF4s=;
	b=RUMzV98vtylGe1uiDFU+EvE/AkEl2Pov1zjXSWKmOrATL37Fu6U3PXN6tVHSENU/+icRtW
	5hpOqpOLxxPVb82dHfJqnu0tyEF9nQwTBYws2vwsZwGd0wIFS/bveNhE9aSJ4QaMPdIBfw
	fntL5Iv8go2fce45qScL9ebxJsqMbykgX3VeBHZIKwkOvCv7VL3I0Ap4WxilrdwmzOWZWA
	GzmWA6+TJt4/UUpex4+O9EPGRHTJjA9LfL1hTxaXgvS+Rc/RKkoRMDuwuRrQdHtA8oRUp+
	5YjlTMa6Bkl35lEgXPfJD6X5yPg0kIGnevscnojVNEPH7x5gqhJfRxO6KLeRTA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670365; a=rsa-sha256; cv=none;
	b=NtxX0t+gtXomNe2vdqiZHxXzhJbliLJ5RnF5JXvDt+dVRubp2I5I/Ta4wzstJq+r+ag+Xi
	anzX7A1qbWLEcyMPYHkzbY82iHX0i/JtT+BXbbJAIAdz+eWNpRCr6Vfa8G3mxyYQrlqwHb
	uMnGZHRgsLK3vd8PBTaWS70wLrqFQUMrnxD9dY6oBGF5LB/LxUDFSsBDs9vtsFVLVbQIwE
	zSLk1TF2me0LjA5GNM0QNNV71WuCBkO+cL1iV2r4VGo/GLVIGDR5Qs4asJfQCyjHHanVsU
	53tqy6s2VZnAqFCnlvX/v664XhNXtwgR1gjfy37yXNtEfRFiW1NLJncMOwm5Og==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670365;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=jHkXpUt7yAaYfhl27i4H6BQ0WpDkkJIeb4Vc8uVWF4s=;
	b=JXRTcvrqg9HiySJb/NhJGdvEZ6bfBckrWus666gWd2Kl2CnmIczii9iq40xgHrgGIdtipg
	12jp+V4jbYJ6FnaxOPLT7wAR0TGoP3dTBjOSk2Rfm7qpGXxeXGHYRtwi80C4tjMdx69MGu
	nCYDyZxpk/QcSXYepjr+36cn4ofJqK9jCckIPM/S4bDQjL9OCOmABQgk+zPZN/wJKLoM3C
	r8T1GXq18ixY0U7Q8emHLAxMs7VfjLX8W77OR1D1NVfF15ijkQmwhraEcAZ23dSnpw9HcQ
	fgIyI7UuQWnd+en39aUTMr2p0ICXo+PxcGuRFGXw+nMn6MgjDN1Ubl5KbSk13Q==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16P30Kjzj8W;
	Thu,  6 Jun 2024 10:39:25 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdPDh089760;
	Thu, 6 Jun 2024 10:39:25 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdPUG089757;
	Thu, 6 Jun 2024 10:39:25 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:25 GMT
Message-Id: <202406061039.456AdPUG089757@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: eb7a4b35de89 - main - mpi3mr: Update consumer index
  of admin and operational reply queues after every 100 replies
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: eb7a4b35de89a0e22f1fb373df33d79135b68dd8
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=eb7a4b35de89a0e22f1fb373df33d79135b68dd8

commit eb7a4b35de89a0e22f1fb373df33d79135b68dd8
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-14 18:41:07 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: Update consumer index of admin and operational reply queues after every 100 replies
    
    Instead of updating the ConsumerIndex of the Admin and Operational ReplyQueues
    after processing all replies in the queue, it will now be periodically updated
    after processing every 100 replies.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44425
---
 sys/dev/mpi3mr/mpi3mr.c | 14 +++++++++++++-
 sys/dev/mpi3mr/mpi3mr.h |  2 ++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index ba649edbe070..1adc19f49dea 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -4388,6 +4388,7 @@ static int mpi3mr_complete_admin_cmd(struct mpi3mr_softc *sc)
 	U32 num_adm_reply = 0;
 	U64 reply_dma = 0;
 	Mpi3DefaultReplyDescriptor_t *reply_desc;
+	U16 threshold_comps = 0;
 	
 	mtx_lock_spin(&sc->admin_reply_lock);
 	if (sc->admin_in_use == false) {
@@ -4425,6 +4426,11 @@ static int mpi3mr_complete_admin_cmd(struct mpi3mr_softc *sc)
 		if ((reply_desc->ReplyFlags &
 		     MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase)
 			break;
+
+		if (++threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) {
+			mpi3mr_regwrite(sc, MPI3_SYSIF_ADMIN_REPLY_Q_CI_OFFSET, adm_reply_ci);
+			threshold_comps = 0;
+		}
 	} while (1);
 
 	mpi3mr_regwrite(sc, MPI3_SYSIF_ADMIN_REPLY_Q_CI_OFFSET, adm_reply_ci);
@@ -4837,7 +4843,7 @@ int mpi3mr_complete_io_cmd(struct mpi3mr_softc *sc,
 	U32 num_op_replies = 0;
 	U64 reply_dma = 0;
 	Mpi3DefaultReplyDescriptor_t *reply_desc;
-	U16 req_qid = 0;
+	U16 req_qid = 0, threshold_comps = 0;
 
 	mtx_lock_spin(&op_reply_q->q_lock);
 	if (op_reply_q->in_use == false) {
@@ -4882,6 +4888,12 @@ int mpi3mr_complete_io_cmd(struct mpi3mr_softc *sc,
 		if ((reply_desc->ReplyFlags &
 		     MPI3_REPLY_DESCRIPT_FLAGS_PHASE_MASK) != exp_phase)
 			break;
+
+		if (++threshold_comps == MPI3MR_THRESHOLD_REPLY_COUNT) {
+			mpi3mr_regwrite(sc, MPI3_SYSIF_OPER_REPLY_Q_N_CI_OFFSET(op_reply_q->qid), reply_ci);
+			threshold_comps = 0;
+		}
+
 	} while (1);
 
 
diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index 1cf6718d9047..f8f562184aae 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -123,6 +123,8 @@
 #define MPI3MR_OP_REP_Q_QD		1024
 #define MPI3MR_OP_REP_Q_QD_A0		4096
 
+#define MPI3MR_THRESHOLD_REPLY_COUNT	100
+
 #define MPI3MR_CHAINSGE_SIZE	MPI3MR_4K_PGSZ
 
 #define MPI3MR_SGEFLAGS_SYSTEM_SIMPLE_END_OF_LIST	\

From nobody Thu Jun  6 10:39:26 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16R1WbWz5Mfnq;
	Thu, 06 Jun 2024 10:39:27 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16Q5HZYz4j9Q;
	Thu,  6 Jun 2024 10:39:26 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670366;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ECfk9O9WO7B9KlAHmDMsYE/QeC65OdLdXQ7vjomHkfc=;
	b=rezL5fHQvRxyM23xD2oPfPRQe2YYSAB78J4YyEiHjMI0JTXFTPHsmG/FqauSovjS3jPCOu
	WKceokI2s6xlKacwefm/CAdNpRj7f/NobWv9lc6WrIuGs1Vce1C+FCRs0WHKGRP/BjhI6t
	eowbA5tTBrsFAnMjrXxKU2b52nPy/sKDPkzyncpGYC4Tf18vnz0B5GjdXISMyPW2DRh2VR
	Lw7Z2aY8JWwEc0gZ6uR3zYVKraEwWeswfiFjJ3WpQ0g591NVGm2zi4/ACYEfPRFeeEEAK0
	bomvjlR/4w11r2C5mQOtYOhb5kKTg8cok8umfSgLw6JVBUR0rAyEP5KJ5DOdwQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670366; a=rsa-sha256; cv=none;
	b=kctin7OJx3w5buefrbP8gTWs2Rpqi3W7+OoBV5jFa94Taor7gm0Yw6HHYRIYH3lE64MDOD
	tlspXU/GJSVZnCxQUcypEpJg8NBc9i/35yYsV7K0JOR6I4mstN1hlS7Sv54CKPhGRMpRUI
	jAeJacV9tJuwuh5FOnZkjOUvr7BQyr4DOnOe2I1QuOd+nSdi2w5KgVfQ9eoKHRnMeIuOKE
	2jfhuiGl0Acx4sauZUl1OblzCVDpAcBsBLyHAfcUyebx8vtGDABdvF4ipubavT/jUmx6dt
	7hdkXRWUFtquI2UWemTs/YTuZyxE5EE37yu3P+bVCj+a3tPqBN2EcjOBLDdGyQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670366;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ECfk9O9WO7B9KlAHmDMsYE/QeC65OdLdXQ7vjomHkfc=;
	b=ibXsa+RbzEsjTbICi9Du9NtHwj40A+HAZKTGGp3qTFBy57jya4sQciWorH3uyEhML6NDOk
	vtz+raCLAFAsEWJzfAgas47LwFatgWbj+a2pQunpN3/skT13v6+o8D686rJIVdncwgiv7p
	MM2BmRBF4LyylB2odhpeq7TaULoTf4uJxd7Zqv6p6ybAIDDqtaw6XQltC51+zTZXfVKG33
	IP86re8ideVrSaBOHlw8yFvaGqLD95ThIkoRyvNIVGClKmyJmVe2xkbV4sTEyO4QQQCpiB
	5jUD+8YbX0bUDo2NHvI0RQnIN8qY2Jbb9XJLWXhdMNIDeG9GNnQ2uQEkUC/YVg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16Q4qnfzjK0;
	Thu,  6 Jun 2024 10:39:26 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdQ4S089811;
	Thu, 6 Jun 2024 10:39:26 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdQ6L089808;
	Thu, 6 Jun 2024 10:39:26 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:26 GMT
Message-Id: <202406061039.456AdQ6L089808@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 4034d7061a11 - main - mpi3mr: diag fault success
  beyond F000 fault code
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 4034d7061a112b78d60cdb581c2d71f7cfa9f74e
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=4034d7061a112b78d60cdb581c2d71f7cfa9f74e

commit 4034d7061a112b78d60cdb581c2d71f7cfa9f74e
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-19 06:47:57 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: diag fault success beyond F000 fault code
    
    Accept any fault as successful for diagnostic fault reset, not just the 0xF000
    code. print fault information and return.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44426
---
 sys/dev/mpi3mr/mpi3mr.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 1adc19f49dea..916829f4a38f 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -1403,14 +1403,10 @@ mpi3mr_soft_reset_success(U32 ioc_status, U32 ioc_config)
 static inline bool mpi3mr_diagfault_success(struct mpi3mr_softc *sc,
 	U32 ioc_status)
 {
-	U32 fault;
-
 	if (!(ioc_status & MPI3_SYSIF_IOC_STATUS_FAULT))
 		return false;
-	fault = mpi3mr_regread(sc, MPI3_SYSIF_FAULT_OFFSET) & MPI3_SYSIF_FAULT_CODE_MASK;
-	if (fault == MPI3_SYSIF_FAULT_CODE_DIAG_FAULT_RESET)
-		return true;
-	return false;
+	mpi3mr_print_fault_info(sc);
+	return true;
 }
 
 /**

From nobody Thu Jun  6 10:39:27 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16S2kS6z5MfcY;
	Thu, 06 Jun 2024 10:39:28 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16R6L2qz4jG1;
	Thu,  6 Jun 2024 10:39:27 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670367;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=1OCWiQ0tszKxRxoHMnGoAjJ5H34uauvPc5VvLB3B+Qc=;
	b=YZ7IvGEJ6uJ07vAs78LRAjDhRWO+ea71E3GFPY+oE6I9ql3XEWuOhHbdTI7NF/5EzhppkW
	ExLgLE2TMWVKjVJa6GPp9kbVpf6rxecXuvZ8RP8yeMgxHDJx/9d2MRhSxffKlnCEeGjJCm
	oYyB51UArpb4oixFO0TcZ2//oTv8TzUJ7C2zTrjOmcw5BpnmQbkqkXFfi0gkJYMuud4OGM
	gQpBJMlSx5sywNKYsE9mjq16si7KSmhXOUfiAQbeUGKe5BFbMaoKt3KlDkKNwMcrEUGfwL
	G6VD0IB0jXBro+BH7l2OPArlSL3MdZn3nyymedqj4qS8dc4hE5KiiFx+K3S0Dw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670367; a=rsa-sha256; cv=none;
	b=Mahb92iEpvVPYVBhTkShVfagO7lOsdk/qM7FYZG6ogluRfcsJFpluytY35krEo75yEjcWc
	58iJ+cgxJtKZ9mZArYpo8gpnM5H34E8uva3pxd+C15NoBorZ7tH85dKUIFfIbfN3lI8Tw5
	KrPhIAyQVyn2uel8wzEOAwDoTpbYokflziz8f0vM0qoCPgS2bpQ1FSfgIOSik03m5yrRh3
	rtirBJemgY7cn1LORO7VvsLGqcj49u1YVxkEHlM0ggg1qaeQ5RSvm/INwz23ftAk3PyENj
	fuxGJdtTCNm3gKcPEgqj4Tu4S6rwu5/r/2/lJ3MXRSGrmf+TLKkDkN9YF/3wvA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670367;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=1OCWiQ0tszKxRxoHMnGoAjJ5H34uauvPc5VvLB3B+Qc=;
	b=X1GiQmfDTvb1Aeqz0Tz+8XYhkTOl+KCrpX1Pvi41/mwqEpoYt0uOEQHTBqGZTR9hCACnbE
	NMNoeR1szfWkP+hfQeWscNzKsq+B7ZHr9byHx7BmjRdJuFyPhvzuDXRgKog1g/K7JYrbAN
	XwcbMDExZEiL/MXz35fx4M6egWNSq+mGWx/83HKsN4CSkRU3BP1BQmQRBJBps9zjoAKuIK
	De39GPE9XWzoKTfEM8H7GYQr9x6AqqG7pKpt4Wp9oQAwxQ82mwqbhKV+axOYqdHFtxI1vv
	zR3ILjZxXDVs1fCy+qQN9Z0Dj8E9IPOwmw17LqCMIMs9rjgmrnhDxaBacXeV9w==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16R5NXszj6v;
	Thu,  6 Jun 2024 10:39:27 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdRrZ089868;
	Thu, 6 Jun 2024 10:39:27 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdRhx089865;
	Thu, 6 Jun 2024 10:39:27 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:27 GMT
Message-Id: <202406061039.456AdRhx089865@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 3012fa8faef2 - main - mpi3mr: Adding FreeBSD OS Type
  to Fault/Reset Reason Code
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 3012fa8faef262c615672fc90319c777b4e3dffc
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=3012fa8faef262c615672fc90319c777b4e3dffc

commit 3012fa8faef262c615672fc90319c777b4e3dffc
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-19 06:56:44 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: Adding FreeBSD OS Type to Fault/Reset Reason Code
    
    The driver is modified to add FreeBSD OS type in the upper nibble of the
    fault/reset reason code for appropriate qualification of the reason code.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44427
---
 sys/dev/mpi3mr/mpi3mr.c     | 29 +++++++++++++++++++----------
 sys/dev/mpi3mr/mpi3mr.h     |  7 +++++--
 sys/dev/mpi3mr/mpi3mr_cam.c |  2 +-
 3 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 916829f4a38f..c592d5734d38 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -83,7 +83,7 @@ static void mpi3mr_port_enable_complete(struct mpi3mr_softc *sc,
 	struct mpi3mr_drvr_cmd *drvrcmd);
 static void mpi3mr_flush_io(struct mpi3mr_softc *sc);
 static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type,
-	U32 reset_reason);
+	U16 reset_reason);
 static void mpi3mr_dev_rmhs_send_tm(struct mpi3mr_softc *sc, U16 handle,
 	struct mpi3mr_drvr_cmd *cmdparam, U8 iou_rc);
 static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_softc *sc,
@@ -186,7 +186,7 @@ poll_for_command_completion(struct mpi3mr_softc *sc,
  * Return:  None.
  */
 static void
-mpi3mr_trigger_snapdump(struct mpi3mr_softc *sc, U32 reason_code)
+mpi3mr_trigger_snapdump(struct mpi3mr_softc *sc, U16 reason_code)
 {
 	U32 host_diagnostic, timeout = MPI3_SYSIF_DIAG_SAVE_TIMEOUT * 10;
 	
@@ -221,7 +221,7 @@ mpi3mr_trigger_snapdump(struct mpi3mr_softc *sc, U32 reason_code)
  *
  * Return:  None.
  */
-static void mpi3mr_check_rh_fault_ioc(struct mpi3mr_softc *sc, U32 reason_code)
+static void mpi3mr_check_rh_fault_ioc(struct mpi3mr_softc *sc, U16 reason_code)
 {
 	U32 ioc_status;
 
@@ -1167,9 +1167,9 @@ static inline void mpi3mr_clear_resethistory(struct mpi3mr_softc *sc)
  *
  * Return: 0 on success, -1 on failure.
  */
-static int mpi3mr_mur_ioc(struct mpi3mr_softc *sc, U32 reset_reason)
+static int mpi3mr_mur_ioc(struct mpi3mr_softc *sc, U16 reset_reason)
 {
-        U32 ioc_config, timeout, ioc_status;
+	U32 ioc_config, timeout, ioc_status, scratch_pad0;
         int retval = -1;
 
         mpi3mr_dprint(sc, MPI3MR_INFO, "Issuing Message Unit Reset(MUR)\n");
@@ -1178,7 +1178,12 @@ static int mpi3mr_mur_ioc(struct mpi3mr_softc *sc, U32 reset_reason)
                 return retval;
         }
         mpi3mr_clear_resethistory(sc);
-	mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, reset_reason);
+
+	scratch_pad0 = ((MPI3MR_RESET_REASON_OSTYPE_FREEBSD <<
+			MPI3MR_RESET_REASON_OSTYPE_SHIFT) |
+			(sc->facts.ioc_num <<
+			MPI3MR_RESET_REASON_IOCNUM_SHIFT) | reset_reason);
+	mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, scratch_pad0);
 	ioc_config = mpi3mr_regread(sc, MPI3_SYSIF_IOC_CONFIG_OFFSET);
         ioc_config &= ~MPI3_SYSIF_IOC_CONFIG_ENABLE_IOC;
 	mpi3mr_regwrite(sc, MPI3_SYSIF_IOC_CONFIG_OFFSET, ioc_config);
@@ -5761,11 +5766,11 @@ static inline void mpi3mr_set_diagsave(struct mpi3mr_softc *sc)
  * Return: 0 on success, non-zero on failure.
  */
 static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type,
-	U32 reset_reason)
+	U16 reset_reason)
 {
 	int retval = -1;
 	U8 unlock_retry_count = 0;
-	U32 host_diagnostic, ioc_status, ioc_config;
+	U32 host_diagnostic, ioc_status, ioc_config, scratch_pad0;
 	U32 timeout = MPI3MR_RESET_ACK_TIMEOUT * 10;
 
 	if ((reset_type != MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET) &&
@@ -5819,7 +5824,11 @@ static int mpi3mr_issue_reset(struct mpi3mr_softc *sc, U16 reset_type,
 		    unlock_retry_count, host_diagnostic);
 	} while (!(host_diagnostic & MPI3_SYSIF_HOST_DIAG_DIAG_WRITE_ENABLE));
 
-	mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, reset_reason);
+	scratch_pad0 = ((MPI3MR_RESET_REASON_OSTYPE_FREEBSD <<
+			MPI3MR_RESET_REASON_OSTYPE_SHIFT) |
+			(sc->facts.ioc_num <<
+			MPI3MR_RESET_REASON_IOCNUM_SHIFT) | reset_reason);
+	mpi3mr_regwrite(sc, MPI3_SYSIF_SCRATCHPAD0_OFFSET, scratch_pad0);
 	mpi3mr_regwrite(sc, MPI3_SYSIF_HOST_DIAG_OFFSET, host_diagnostic | reset_type);
 	
 	if (reset_type == MPI3_SYSIF_HOST_DIAG_RESET_ACTION_SOFT_RESET) {
@@ -5898,7 +5907,7 @@ inline void mpi3mr_cleanup_event_taskq(struct mpi3mr_softc *sc)
  * Return: 0 on success, non-zero on failure.
  */
 int mpi3mr_soft_reset_handler(struct mpi3mr_softc *sc,
-	U32 reset_reason, bool snapdump)
+	U16 reset_reason, bool snapdump)
 {
 	int retval = 0, i = 0;
 	enum mpi3mr_iocstate ioc_state;
diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index f8f562184aae..f61c5b377b46 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -141,6 +141,9 @@
 #define MAX_MGMT_ADAPTERS 8
 #define MPI3MR_WAIT_BEFORE_CTRL_RESET 5
 
+#define MPI3MR_RESET_REASON_OSTYPE_FREEBSD        0x4
+#define MPI3MR_RESET_REASON_OSTYPE_SHIFT	  28
+#define MPI3MR_RESET_REASON_IOCNUM_SHIFT          20
 
 struct mpi3mr_mgmt_info {
 	uint16_t count;
@@ -961,7 +964,7 @@ void mpi3mr_cleanup_event_taskq(struct mpi3mr_softc *sc);
 void
 mpi3mr_hexdump(void *buf, int sz, int format);
 int mpi3mr_soft_reset_handler(struct mpi3mr_softc *sc,
-	U32 reset_reason, bool snapdump);
+	U16 reset_reason, bool snapdump);
 void
 mpi3mrsas_release_simq_reinit(struct mpi3mr_cam_softc *cam_sc);
 void
@@ -983,6 +986,6 @@ void mpi3mr_set_io_divert_for_all_vd_in_tg(struct mpi3mr_softc *sc,
 enum mpi3mr_iocstate mpi3mr_get_iocstate(struct mpi3mr_softc *sc);
 void mpi3mr_poll_pend_io_completions(struct mpi3mr_softc *sc);
 void int_to_lun(unsigned int lun, U8 *req_lun);
-void trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U32 reset_reason);
+void trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U16 reset_reason);
 void mpi3mr_alloc_ioctl_dma_memory(struct mpi3mr_softc *sc);
 #endif /*MPI3MR_H_INCLUDED*/
diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c
index 4843aa6ea721..da6342063e87 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -454,7 +454,7 @@ void mpi3mr_poll_pend_io_completions(struct mpi3mr_softc *sc)
 }
 
 void
-trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U32 reset_reason)
+trigger_reset_from_watchdog(struct mpi3mr_softc *sc, U8 reset_type, U16 reset_reason)
 {
 	if (sc->reset_in_progress) {
 		mpi3mr_dprint(sc, MPI3MR_INFO, "Another reset is in progress, no need to trigger the reset\n");

From nobody Thu Jun  6 10:39:29 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16V3K4Cz5MfyQ;
	Thu, 06 Jun 2024 10:39:30 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16V04sXz4jTT;
	Thu,  6 Jun 2024 10:39:30 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670370;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3wtVbvyAt2/XVL5CHAgxTYTmMkYx2vyCB6I97AQ3HNU=;
	b=byzso8WZKzSlBdce1+BzXUI3FD89Fk4gDIJiwuYD/sS/AHczpIDOVDPNQ1jDLSo8mUDUDj
	nQ8DH7weC7fa+6q291/JCF4KOJ+zFFx1llZ3kxv5OXhej0j6mHKmRCs78irPBJKQy4PIN4
	X3x4CM6IAuISQWLR3IemOUPxpZ/jQL+BWloACNmtps+bor/1EbEoG5lf5yfm80b9wNVQZY
	XUnOMhYhqYNBz9e3mjzMoAqBlYcSJMk0LtG6aq2tJ8K+q2maYWoraj0kpLjg++/X2IExc8
	BTQy0L1GrpdDLZrspv++0pLCRok5Iat4h9f99DYMAI9U6nGbGMSGOjKdFCDo6Q==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670370; a=rsa-sha256; cv=none;
	b=sS1vo2ZhYeuLDKoUc5QI9M8ERHuV9uIDq0BWAd+ps5XUvK+5Ch/sJKqfM8UbWOqq93oQSA
	qp+bM3dZBEnQHvVXGfD8UF1HESJYd4XZKBtaxqCYMcszbOoWN2vDEjw+en/5K1C6QOjSqx
	rUQOfbsZOjhRF3tw41iiI+HoQSwflQW9jxgA8bROtYPWNlDcsIKR6lBFICsD2U/s2amP4M
	Bw2+mm1ZzotNe5ZG75U3J0bbgup2TkUEMppRocY/YA8fv+kNUqomw2XD2VvFFkjdNWupw6
	wm83REWmUXrG2d1kslGF5e1QcDPsJGPjfY0lXXjP3FlEQDY9uwLM3JlRxyQ2Wg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670370;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=3wtVbvyAt2/XVL5CHAgxTYTmMkYx2vyCB6I97AQ3HNU=;
	b=UMJ2AIJ1P223LJhkrR3LmqtfsXQpEVhPULL/y+nv5UbNnOFuQpT1kbXEUD6/VvXvo7iSpQ
	+3/6MLHGS8rVKZDDioaD1V0lPman3A7c/sbVYrj0z9Rz63EDOSRudAyvXRVShKWVc0Hunp
	eBxkf+PAYz6q2gA2cwBZ2N6HV+9KeaOfXbxdKlwYVIgSSXbYHMsgzCjEs41CXipCywaUyM
	4bb9n1I8/fJeWgVsoGc9YBL2iacm8tmB9iDvhNHgy7OviDk36O70ugEMSOuX/S8jDXflWg
	R0URueWVXtvmDs+ZqnBJHxIrH+YAdjXl7kx6QZCjTwDGhjjoS4QwAX6NKkYL5Q==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16T6kQwzjXt;
	Thu,  6 Jun 2024 10:39:29 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdTVX089964;
	Thu, 6 Jun 2024 10:39:29 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdTEc089961;
	Thu, 6 Jun 2024 10:39:29 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:29 GMT
Message-Id: <202406061039.456AdTEc089961@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 945c3ce49ed1 - main - mpi3mr: copyright year update
  to 2024
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 945c3ce49ed127de6ccd6d55a944d8a58291c315
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=945c3ce49ed127de6ccd6d55a944d8a58291c315

commit 945c3ce49ed127de6ccd6d55a944d8a58291c315
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-19 07:25:04 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: copyright year update to 2024
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44429
---
 sys/dev/mpi3mr/mpi3mr.c     | 2 +-
 sys/dev/mpi3mr/mpi3mr.h     | 2 +-
 sys/dev/mpi3mr/mpi3mr_app.c | 2 +-
 sys/dev/mpi3mr/mpi3mr_app.h | 2 +-
 sys/dev/mpi3mr/mpi3mr_cam.c | 2 +-
 sys/dev/mpi3mr/mpi3mr_cam.h | 2 +-
 sys/dev/mpi3mr/mpi3mr_pci.c | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 99a331c9baf0..5227e8b60435 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -1,7 +1,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Authors: Sumit Saxena <sumit.saxena@broadcom.com>
diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index f61c5b377b46..84d5a8dfd5e7 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -1,7 +1,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (c) 2020-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2020-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Authors: Sumit Saxena <sumit.saxena@broadcom.com>
diff --git a/sys/dev/mpi3mr/mpi3mr_app.c b/sys/dev/mpi3mr/mpi3mr_app.c
index 60ef6765cb76..79da04a74218 100644
--- a/sys/dev/mpi3mr/mpi3mr_app.c
+++ b/sys/dev/mpi3mr/mpi3mr_app.c
@@ -1,7 +1,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (c) 2020-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2020-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Authors: Sumit Saxena <sumit.saxena@broadcom.com>
diff --git a/sys/dev/mpi3mr/mpi3mr_app.h b/sys/dev/mpi3mr/mpi3mr_app.h
index 733aeb0ae53d..b0d62157db3c 100644
--- a/sys/dev/mpi3mr/mpi3mr_app.h
+++ b/sys/dev/mpi3mr/mpi3mr_app.h
@@ -1,7 +1,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (c) 2020-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2020-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Authors: Sumit Saxena <sumit.saxena@broadcom.com>
diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c
index 337ad6cb7336..f8603eec9ae2 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -1,7 +1,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (c) 2020-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2020-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Authors: Sumit Saxena <sumit.saxena@broadcom.com>
diff --git a/sys/dev/mpi3mr/mpi3mr_cam.h b/sys/dev/mpi3mr/mpi3mr_cam.h
index 4f3ce47751e9..3a0526217f86 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.h
+++ b/sys/dev/mpi3mr/mpi3mr_cam.h
@@ -1,7 +1,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (c) 2020-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2020-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Authors: Sumit Saxena <sumit.saxena@broadcom.com>
diff --git a/sys/dev/mpi3mr/mpi3mr_pci.c b/sys/dev/mpi3mr/mpi3mr_pci.c
index 1548d577a726..95bd39c90964 100644
--- a/sys/dev/mpi3mr/mpi3mr_pci.c
+++ b/sys/dev/mpi3mr/mpi3mr_pci.c
@@ -1,7 +1,7 @@
 /*
  * SPDX-License-Identifier: BSD-2-Clause
  *
- * Copyright (c) 2020-2023, Broadcom Inc. All rights reserved. 
+ * Copyright (c) 2020-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Authors: Sumit Saxena <sumit.saxena@broadcom.com>

From nobody Thu Jun  6 10:39:28 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16T2td3z5MfyP;
	Thu, 06 Jun 2024 10:39:29 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16S6jhWz4jTB;
	Thu,  6 Jun 2024 10:39:28 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670368;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=7JJEngyCPTzSPAMZ5xGX9IVHT/KbAxS5TPYfvJDNvgo=;
	b=YgJV3BlOs36PHKydoXChscscFO5TyYpctxkoXATodUBe8NCzkIEXGSlXVa+bT1T2ApBZWj
	yAiYiLLKrSiGFflbDU5A5jj8xGoZNPyG6UxuU8UqIigjginCR+ywhnbbO6NIUr2uhSxBPf
	47WTVq/3W0MvrUVdtLPmZvBGS9Zuq0KLGU/FXEgmDfThv3N14jU5aBSv9hMyBKFA3yCmYL
	w59OLobNv9/9DYBUnrRdiEiwyjEotIm8CYk4X5J4l3gWxT8IPUn7+pZ/nLWKlKMJHbicJ3
	/Dgk3E+EjX1R03gxtEhI2GeZ/NO0Zln3e1kD+oOGyxlZ76AeTKkivmmkXVFS6Q==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670368; a=rsa-sha256; cv=none;
	b=IW6R8iThn9ufqnq3PONU4PL7p0w0MV6So1d3WONEhLA/kHacg8uNCVe+LBAoDW5C12+JAZ
	fZyPaxpUoiwV0iwvxbQskx0EmDZ8hVH6WBl4892PW+8tsNYfepeme2kB1qbYG3wfyTsg/l
	kIsXr26iRddOZ4+AaVBmzvQ1RSn06XpAW5BqJyMafTiyDplycP/OAwTi5CJSZNmJmdaWU1
	Qo1vN4sf6DUBroW9GVbixZQ/Y2LyDZNB8BKR7jGh0eKa3+UvbO7rZcGg9GcZzENdvl6cqu
	grxSk3WV/scVarcyJidRkMVA7o7sqLOODNlbiZvd/9vONMPDhVb88nZ4T7pcfw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670368;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=7JJEngyCPTzSPAMZ5xGX9IVHT/KbAxS5TPYfvJDNvgo=;
	b=QWHTZPv8hlUs0BDqLjHXjeHdZejlio7XR4W/mPfQ06WkR+9dnhjGXlZLr/6JX/FcTT26iW
	zyQui2/LvkNsLrZFEetixnQ1nFplhZnTGhhja3CQ1Pi9MUgWVYk7hBz5KxvVZVfpVP8VRR
	XfytuhLu6BuNXBwZFsz6R8lM4sng6GEpP90Q7CKQNo6DfiMI45KqamYE1g1wgEuzQvS6yy
	ZaWqmhGT99L8/5JLe04gjlQ0LqflQpMiwUdpKFwlQU9W9OV7fRn6ykITRbTAt0jET0BkTX
	X78mB2FBHPfoyPCyrPHjEdgFzp8BOUaK+T/kNmxk+zt8SyQR0UsGvvNHmFtnEQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16S638yzj4g;
	Thu,  6 Jun 2024 10:39:28 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdSp4089913;
	Thu, 6 Jun 2024 10:39:28 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdSID089910;
	Thu, 6 Jun 2024 10:39:28 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:28 GMT
Message-Id: <202406061039.456AdSID089910@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: baabb919345f - main - mpi3mr: mpi headers update to
  latest
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: baabb919345f05e9892c4048a1521e5da1403060
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=baabb919345f05e9892c4048a1521e5da1403060

commit baabb919345f05e9892c4048a1521e5da1403060
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-19 07:23:07 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: mpi headers update to latest
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44428
---
 sys/dev/mpi3mr/mpi/mpi30_api.h       |   4 +-
 sys/dev/mpi3mr/mpi/mpi30_cnfg.h      | 170 +++++++++++++++++++++++++++--------
 sys/dev/mpi3mr/mpi/mpi30_image.h     |  49 +++++-----
 sys/dev/mpi3mr/mpi/mpi30_init.h      |  11 +--
 sys/dev/mpi3mr/mpi/mpi30_ioc.h       |  80 +++++++++--------
 sys/dev/mpi3mr/mpi/mpi30_pci.h       |   5 +-
 sys/dev/mpi3mr/mpi/mpi30_raid.h      |   5 +-
 sys/dev/mpi3mr/mpi/mpi30_sas.h       |   5 +-
 sys/dev/mpi3mr/mpi/mpi30_targ.h      |  10 ++-
 sys/dev/mpi3mr/mpi/mpi30_tool.h      |   8 +-
 sys/dev/mpi3mr/mpi/mpi30_transport.h |  29 +++---
 sys/dev/mpi3mr/mpi/mpi30_type.h      |   5 +-
 sys/dev/mpi3mr/mpi3mr.c              |  26 +++---
 sys/dev/mpi3mr/mpi3mr_cam.c          |   4 +-
 14 files changed, 251 insertions(+), 160 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi/mpi30_api.h b/sys/dev/mpi3mr/mpi/mpi30_api.h
index aa7b54ec470e..0c070672a16b 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_api.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_api.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/sys/dev/mpi3mr/mpi/mpi30_cnfg.h b/sys/dev/mpi3mr/mpi/mpi30_cnfg.h
index d1ae2ebfa372..410ed0471f78 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_cnfg.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_cnfg.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -185,7 +185,7 @@ typedef struct _MPI3_CONFIG_PAGE_HEADER
  *              Common definitions used by Configuration Pages           *
  ****************************************************************************/
 
-/**** Defines for Negotiated Link Rates ****/
+/**** Defines for NegotiatedLinkRates ****/
 #define MPI3_SAS_NEG_LINK_RATE_LOGICAL_MASK                   (0xF0)
 #define MPI3_SAS_NEG_LINK_RATE_LOGICAL_SHIFT                  (4)
 #define MPI3_SAS_NEG_LINK_RATE_PHYSICAL_MASK                  (0x0F)
@@ -486,6 +486,7 @@ typedef struct _MPI3_MAN6_GPIO_ENTRY
 #define MPI3_MAN6_GPIO_EXTINT_PARAM1_FLAGS_SOURCE_GENERIC                     (0x00)
 #define MPI3_MAN6_GPIO_EXTINT_PARAM1_FLAGS_SOURCE_CABLE_MGMT                  (0x10)
 #define MPI3_MAN6_GPIO_EXTINT_PARAM1_FLAGS_SOURCE_ACTIVE_CABLE_OVERCURRENT    (0x20)
+#define MPI3_MAN6_GPIO_EXTINT_PARAM1_FLAGS_ACK_REQUIRED                       (0x02)
 
 #define MPI3_MAN6_GPIO_EXTINT_PARAM1_FLAGS_TRIGGER_MASK                       (0x01)
 #define MPI3_MAN6_GPIO_EXTINT_PARAM1_FLAGS_TRIGGER_EDGE                       (0x00)
@@ -1073,7 +1074,7 @@ typedef struct _MPI3_MAN_PAGE12
 #define MPI3_MAN12_FLAGS_SDATAOUT_TYPE_PUSH_PULL                     (0x0000)
 #define MPI3_MAN12_FLAGS_SDATAOUT_TYPE_OPEN_DRAIN                    (0x0001)
 
-/**** Defines for the SioClkFreq field ****/
+/**** Defines for the SClockFreq field ****/
 #define MPI3_MAN12_SIO_CLK_FREQ_MIN                                  (32)        /* 32 Hz min SIO Clk Freq */
 #define MPI3_MAN12_SIO_CLK_FREQ_MAX                                  (100000)    /* 100 KHz max SIO Clk Freq */
 
@@ -1306,7 +1307,7 @@ typedef struct _MPI3_MAN_PAGE20
 #define MPI3_MAN20_ALLOWEDPERSON_EHBA_ALLOWED                        (0x01)
 #define MPI3_MAN20_ALLOWEDPERSON_EHBA_NOT_ALLOWED                    (0x00)
 
-/**** Defines for the NonpremuimFeatures field ****/
+/**** Defines for the NonpremiumFeatures field ****/
 #define MPI3_MAN20_NONPREMUIM_DISABLE_PD_DEGRADED_MASK               (0x01)
 #define MPI3_MAN20_NONPREMUIM_DISABLE_PD_DEGRADED_ENABLED            (0x00)
 #define MPI3_MAN20_NONPREMUIM_DISABLE_PD_DEGRADED_DISABLED           (0x01)
@@ -1338,6 +1339,23 @@ typedef struct _MPI3_MAN_PAGE21
 #define MPI3_MAN21_FLAGS_SES_VPD_ASSOC_DEFAULT                       (0x00000000)
 #define MPI3_MAN21_FLAGS_SES_VPD_ASSOC_OEM_SPECIFIC                  (0x00000001)
 
+/*****************************************************************************
+ *              Manufacturing Page 22                                        *
+ ****************************************************************************/
+
+typedef struct _MPI3_MAN_PAGE22
+{
+    MPI3_CONFIG_PAGE_HEADER         Header;                                            /* 0x00 */
+    U32                             Reserved08;                                        /* 0x08 */
+    U16                             NumEUI64;                                          /* 0x0C */
+    U16                             Reserved0E;                                        /* 0x0E */
+    U64                             BaseEUI64;                                         /* 0x10 */
+} MPI3_MAN_PAGE22, MPI3_POINTER PTR_MPI3_MAN_PAGE22,
+  Mpi3ManPage22_t, MPI3_POINTER pMpi3ManPage22_t;
+
+/**** Defines for the PageVersion field ****/
+#define MPI3_MAN22_PAGEVERSION                                       (0x00)
+
 /*****************************************************************************
  *              Manufacturing Pages 32-63 (ProductSpecific)                  *
  ****************************************************************************/
@@ -1434,13 +1452,21 @@ typedef struct _MPI3_IO_UNIT_PAGE2
  *              IO Unit Page 3                                               *
  ****************************************************************************/
 
+typedef enum _MPI3_IOUNIT3_THRESHOLD
+{
+    MPI3_IOUNIT3_THRESHOLD_WARNING              = 0,
+    MPI3_IOUNIT3_THRESHOLD_CRITICAL             = 1,
+    MPI3_IOUNIT3_THRESHOLD_FATAL                = 2,
+    MPI3_IOUNIT3_THRESHOLD_LOW                  = 3,
+    MPI3_IOUNIT3_NUM_THRESHOLDS
+} MPI3_IOUNIT3_THRESHOLD;
+
 typedef struct _MPI3_IO_UNIT3_SENSOR
 {
     U16             Flags;                                      /* 0x00 */
     U8              ThresholdMargin;                            /* 0x02 */
     U8              Reserved03;                                 /* 0x03 */
-    U16             Threshold[3];                               /* 0x04 */
-    U16             Reserved0A;                                 /* 0x0A */
+    U16             Threshold[MPI3_IOUNIT3_NUM_THRESHOLDS];     /* 0x04 */
     U32             Reserved0C;                                 /* 0x0C */
     U32             Reserved10;                                 /* 0x10 */
     U32             Reserved14;                                 /* 0x14 */
@@ -1448,6 +1474,7 @@ typedef struct _MPI3_IO_UNIT3_SENSOR
   Mpi3IOUnit3Sensor_t, MPI3_POINTER pMpi3IOUnit3Sensor_t;
 
 /**** Defines for the Flags field ****/
+#define MPI3_IOUNIT3_SENSOR_FLAGS_LOW_THRESHOLD_VALID           (0x0020)
 #define MPI3_IOUNIT3_SENSOR_FLAGS_FATAL_EVENT_ENABLED           (0x0010)
 #define MPI3_IOUNIT3_SENSOR_FLAGS_FATAL_ACTION_ENABLED          (0x0008)
 #define MPI3_IOUNIT3_SENSOR_FLAGS_CRITICAL_EVENT_ENABLED        (0x0004)
@@ -1591,7 +1618,7 @@ typedef struct _MPI3_IO_UNIT_PAGE5
 #define MPI3_IOUNIT5_FLAGS_POWER_CAPABLE_SPINUP            (0x02)
 #define MPI3_IOUNIT5_FLAGS_AUTO_PORT_ENABLE                (0x01)
 
-/**** Defines for the PHY field ****/
+/**** Defines for the Phy field ****/
 #define MPI3_IOUNIT5_PHY_SPINUP_GROUP_MASK                 (0x03)
 
 /*****************************************************************************
@@ -1621,11 +1648,33 @@ typedef struct _MPI3_IO_UNIT_PAGE6
 #define MPI3_IOUNIT8_DIGEST_MAX                   (1)
 #endif  /* MPI3_IOUNIT8_DIGEST_MAX */
 
-typedef union _MPI3_IOUNIT8_DIGEST
+typedef union _MPI3_IOUNIT8_RAW_DIGEST
 {
     U32                             Dword[16];
     U16                             Word[32];
     U8                              Byte[64];
+} MPI3_IOUNIT8_RAW_DIGEST, MPI3_POINTER PTR_MPI3_IOUNIT8_RAW_DIGEST,
+  Mpi3IOUnit8RawDigest_t, MPI3_POINTER pMpi3IOUnit8RawDigest_t;
+
+typedef struct _MPI3_IOUNIT8_METADATA_DIGEST
+{
+    U8                              SlotStatus;                        /* 0x00 */
+    U8                              Reserved01[3];                     /* 0x01 */
+    U32                             Reserved04[3];                     /* 0x04 */
+    MPI3_IOUNIT8_RAW_DIGEST         DigestData;                        /* 0x10 */
+} MPI3_IOUNIT8_METADATA_DIGEST, MPI3_POINTER PTR_MPI3_IOUNIT8_METADATA_DIGEST,
+  Mpi3IOUnit8MetadataDigest_t, MPI3_POINTER pMpi3IOUnit8MetadataDigest_t;
+
+/**** Defines for the SlotStatus field ****/
+#define MPI3_IOUNIT8_METADATA_DIGEST_SLOTSTATUS_UNUSED                 (0x00)
+#define MPI3_IOUNIT8_METADATA_DIGEST_SLOTSTATUS_UPDATE_PENDING         (0x01)
+#define MPI3_IOUNIT8_METADATA_DIGEST_SLOTSTATUS_VALID                  (0x03)
+#define MPI3_IOUNIT8_METADATA_DIGEST_SLOTSTATUS_INVALID                (0x07)
+
+typedef union _MPI3_IOUNIT8_DIGEST
+{
+    MPI3_IOUNIT8_RAW_DIGEST         RawDigest[MPI3_IOUNIT8_DIGEST_MAX];
+    MPI3_IOUNIT8_METADATA_DIGEST    MetadataDigest[MPI3_IOUNIT8_DIGEST_MAX];
 } MPI3_IOUNIT8_DIGEST, MPI3_POINTER PTR_MPI3_IOUNIT8_DIGEST,
   Mpi3IOUnit8Digest_t, MPI3_POINTER pMpi3IOUnit8Digest_t;
 
@@ -1633,8 +1682,9 @@ typedef struct _MPI3_IO_UNIT_PAGE8
 {
     MPI3_CONFIG_PAGE_HEADER         Header;                             /* 0x00 */
     U8                              SBMode;                             /* 0x08 */
-    U8                              SbState;                            /* 0x09 */
-    U16                             Reserved0A;                         /* 0x0A */
+    U8                              SBState;                            /* 0x09 */
+    U8                              Flags;                              /* 0x0A */
+    U8                              Reserved0A;                         /* 0x0B */
     U8                              NumSlots;                           /* 0x0C */
     U8                              SlotsAvailable;                     /* 0x0D */
     U8                              CurrentKeyEncryptionAlgo;           /* 0x0E */
@@ -1642,22 +1692,27 @@ typedef struct _MPI3_IO_UNIT_PAGE8
     MPI3_VERSION_UNION              CurrentSvn;                         /* 0x10 */
     U32                             Reserved14;                         /* 0x14 */
     U32                             CurrentKey[128];                    /* 0x18 */
-    MPI3_IOUNIT8_DIGEST             Digest[MPI3_IOUNIT8_DIGEST_MAX];    /* 0x218 */  /* variable length */
+    MPI3_IOUNIT8_DIGEST             Digest;                             /* 0x218 */  /* variable length */
 } MPI3_IO_UNIT_PAGE8, MPI3_POINTER PTR_MPI3_IO_UNIT_PAGE8,
   Mpi3IOUnitPage8_t, MPI3_POINTER pMpi3IOUnitPage8_t;
 
 /**** Defines for the PageVersion field ****/
-#define MPI3_IOUNIT8_PAGEVERSION                  (0x00)
+#define MPI3_IOUNIT8_PAGEVERSION                                  (0x00)
 
 /**** Defines for the SBMode field ****/
-#define MPI3_IOUNIT8_SBMODE_SECURE_DEBUG          (0x04)
-#define MPI3_IOUNIT8_SBMODE_HARD_SECURE           (0x02)
-#define MPI3_IOUNIT8_SBMODE_CONFIG_SECURE         (0x01)
+#define MPI3_IOUNIT8_SBMODE_SECURE_DEBUG                          (0x04)
+#define MPI3_IOUNIT8_SBMODE_HARD_SECURE                           (0x02)
+#define MPI3_IOUNIT8_SBMODE_CONFIG_SECURE                         (0x01)
 
 /**** Defines for the SBState field ****/
-#define MPI3_IOUNIT8_SBSTATE_SVN_UPDATE_PENDING   (0x04)
-#define MPI3_IOUNIT8_SBSTATE_KEY_UPDATE_PENDING   (0x02)
-#define MPI3_IOUNIT8_SBSTATE_SECURE_BOOT_ENABLED  (0x01)
+#define MPI3_IOUNIT8_SBSTATE_SVN_UPDATE_PENDING                   (0x04)
+#define MPI3_IOUNIT8_SBSTATE_KEY_UPDATE_PENDING                   (0x02)
+#define MPI3_IOUNIT8_SBSTATE_SECURE_BOOT_ENABLED                  (0x01)
+
+/**** Defines for the Flags field ****/
+#define MPI3_IOUNIT8_FLAGS_DIGESTFORM_MASK                        (0x07)
+#define MPI3_IOUNIT8_FLAGS_DIGESTFORM_RAW                         (0x00)
+#define MPI3_IOUNIT8_FLAGS_DIGESTFORM_DIGEST_WITH_METADATA        (0x01)
 
 /*****************************************************************************
  *              IO Unit Page 9                                               *
@@ -1908,6 +1963,38 @@ typedef struct _MPI3_IO_UNIT_PAGE15
 /**** Defines for the NumPowerBudgetData field ****/
 #define MPI3_IOUNIT15_NUMPOWERBUDGETDATA_POWER_BUDGETING_DISABLED   (0x00)
 
+/*****************************************************************************
+ *              IO Unit Page 16                                              *
+ ****************************************************************************/
+
+#ifndef MPI3_IOUNIT16_ERROR_MAX
+#define MPI3_IOUNIT16_ERROR_MAX                                      (1)
+#endif /* MPI3_IOUNIT16_ERROR_MAX */
+
+typedef struct _MPI3_IOUNIT16_ERROR
+{
+    U32                             Offset;                                   /* 0x00 */
+    U32                             Reserved04;                               /* 0x04 */
+    U64                             Count;                                    /* 0x08 */
+    U64                             Timestamp;                                /* 0x10 */
+} MPI3_IOUNIT16_ERROR, MPI3_POINTER PTR_MPI3_IOUNIT16_ERROR,
+  Mpi3IOUnit16Error_t, MPI3_POINTER pMpi3IOUnit16Error_t;
+
+typedef struct _MPI3_IO_UNIT_PAGE16
+{
+    MPI3_CONFIG_PAGE_HEADER         Header;                                   /* 0x00 */
+    U64                             TotalErrorCount;                          /* 0x08 */
+    U32                             Reserved10[3];                            /* 0x10 */
+    U8                              NumErrors;                                /* 0x1C */
+    U8                              MaxErrorsTracked;                         /* 0x1D */
+    U16                             Reserved1E;                               /* 0x1E */
+    MPI3_IOUNIT16_ERROR             Error[MPI3_IOUNIT16_ERROR_MAX];           /* 0x20 */ /* variable length */
+} MPI3_IO_UNIT_PAGE16, MPI3_POINTER PTR_MPI3_IO_UNIT_PAGE16,
+  Mpi3IOUnitPage16_t, MPI3_POINTER pMpi3IOUnitPage16_t;
+
+/**** Defines for the PageVersion field ****/
+#define MPI3_IOUNIT16_PAGEVERSION                                   (0x00)
+
 /*****************************************************************************
  *              IOC Configuration Pages                                      *
  ****************************************************************************/
@@ -1973,7 +2060,8 @@ typedef struct _MPI3_IOC_PAGE2
  *              Driver Configuration Pages                                  *
  ****************************************************************************/
 
-/**** Defines for the Flags field ****/
+/**** Defines for the Flags field  in Driver Pages 10, 20, and 30 ****/
+/****    NOT used in Driver Page 1 Flags field                    ****/
 #define MPI3_DRIVER_FLAGS_ADMINRAIDPD_BLOCKED               (0x0010)
 #define MPI3_DRIVER_FLAGS_OOBRAIDPD_BLOCKED                 (0x0008)
 #define MPI3_DRIVER_FLAGS_OOBRAIDVD_BLOCKED                 (0x0004)
@@ -2006,7 +2094,7 @@ typedef struct _MPI3_ALLOWED_CMD_NVME
 } MPI3_ALLOWED_CMD_NVME, MPI3_POINTER PTR_MPI3_ALLOWED_CMD_NVME,
   Mpi3AllowedCmdNvme_t, MPI3_POINTER pMpi3AllowedCmdNvme_t;
 
-/**** Defines for the CommandFlags field ****/
+/**** Defines for the NVMeCmdFlags field ****/
 #define MPI3_DRIVER_ALLOWEDCMD_NVMECMDFLAGS_SUBQ_TYPE_MASK     (0x80)
 #define MPI3_DRIVER_ALLOWEDCMD_NVMECMDFLAGS_SUBQ_TYPE_IO       (0x00)
 #define MPI3_DRIVER_ALLOWEDCMD_NVMECMDFLAGS_SUBQ_TYPE_ADMIN    (0x80)
@@ -2057,6 +2145,8 @@ typedef struct _MPI3_DRIVER_PAGE0
 #define MPI3_DRIVER0_PAGEVERSION                                    (0x00)
 
 /**** Defines for the BSDOptions field ****/
+#define MPI3_DRIVER0_BSDOPTS_DEVICEEXPOSURE_DISABLE                 (0x00000020)
+#define MPI3_DRIVER0_BSDOPTS_WRITECACHE_DISABLE                     (0x00000010)
 #define MPI3_DRIVER0_BSDOPTS_HEADLESS_MODE_ENABLE                   (0x00000008)
 #define MPI3_DRIVER0_BSDOPTS_DIS_HII_CONFIG_UTIL                    (0x00000004)
 #define MPI3_DRIVER0_BSDOPTS_REGISTRATION_MASK                      (0x00000003)
@@ -2263,14 +2353,6 @@ typedef union _MPI3_SECURITY_NONCE
 } MPI3_SECURITY_NONCE, MPI3_POINTER PTR_MPI3_SECURITY_NONCE,
   Mpi3SecurityNonce_t, MPI3_POINTER pMpi3SecurityNonce_t;
 
-typedef union _MPI3_SECURITY_ROOT_DIGEST
-{
-    U32                             Dword[16];
-    U16                             Word[32];
-    U8                              Byte[64];
-} MPI3_SECURITY_ROOT_DIGEST, MPI3_POINTER PTR_MPI3_SECURITY_ROOT_DIGEST,
-  Mpi3SecurityRootDigest_t, MPI3_POINTER pMpi3SecurityRootDigest_t;
-
 /*****************************************************************************
  *              Security Page 0                                             *
  ****************************************************************************/
@@ -2382,17 +2464,25 @@ typedef struct _MPI3_SECURITY_PAGE1
 #define MPI3_SECURITY2_TRUSTED_ROOT_MAX      1
 #endif  /* MPI3_SECURITY2_TRUSTED_ROOT_MAX */
 
+#ifndef MPI3_SECURITY2_ROOT_LEN
+#define MPI3_SECURITY2_ROOT_LEN      4
+#endif  /* MPI3_SECURITY2_ROOT_LEN */
+
 typedef struct _MPI3_SECURITY2_TRUSTED_ROOT
 {
     U8                              Level;                                        /* 0x00 */
     U8                              HashAlgorithm;                                /* 0x01 */
     U16                             TrustedRootFlags;                             /* 0x02 */
     U32                             Reserved04[3];                                /* 0x04 */
-    MPI3_SECURITY_ROOT_DIGEST       RootDigest;                                   /* 0x10 */
+    U8                              Root[MPI3_SECURITY2_ROOT_LEN];                /* 0x10 */ /* variable length */
 } MPI3_SECURITY2_TRUSTED_ROOT, MPI3_POINTER PTR_MPI3_SECURITY2_TRUSTED_ROOT,
   Mpi3Security2TrustedRoot_t, MPI3_POINTER pMpi3Security2TrustedRoot_t;
 
 /**** Defines for the TrustedRootFlags field ****/
+#define MPI3_SECURITY2_TRUSTEDROOT_TRUSTEDROOTFLAGS_ROOTFORM_MASK                  (0xF000)
+#define MPI3_SECURITY2_TRUSTEDROOT_TRUSTEDROOTFLAGS_ROOTFORM_SHIFT                 (12)
+#define MPI3_SECURITY2_TRUSTEDROOT_TRUSTEDROOTFLAGS_ROOTFORM_DIGEST                (0x0000)
+#define MPI3_SECURITY2_TRUSTEDROOT_TRUSTEDROOTFLAGS_ROOTFORM_DERCERT               (0x1000)
 #define MPI3_SECURITY2_TRUSTEDROOT_TRUSTEDROOTFLAGS_HASHALGOSOURCE_MASK            (0x0006)
 #define MPI3_SECURITY2_TRUSTEDROOT_TRUSTEDROOTFLAGS_HASHALGOSOURCE_SHIFT           (1)
 #define MPI3_SECURITY2_TRUSTEDROOT_TRUSTEDROOTFLAGS_HASHALGOSOURCE_HA_FIELD        (0x0000)
@@ -2407,7 +2497,8 @@ typedef struct _MPI3_SECURITY_PAGE2
     MPI3_SECURITY_NONCE             Nonce;                                         /* 0x50 */
     U32                             Reserved90[3];                                 /* 0x90 */
     U8                              NumRoots;                                      /* 0x9C */
-    U8                              Reserved9D[3];                                 /* 0x9D */
+    U8                              Reserved9D;                                    /* 0x9D */
+    U16                             RootElementSize;                               /* 0x9E */
     MPI3_SECURITY2_TRUSTED_ROOT     TrustedRoot[MPI3_SECURITY2_TRUSTED_ROOT_MAX];  /* 0xA0 */ /* variable length */
 } MPI3_SECURITY_PAGE2, MPI3_POINTER PTR_MPI3_SECURITY_PAGE2,
   Mpi3SecurityPage2_t, MPI3_POINTER pMpi3SecurityPage2_t;
@@ -3052,7 +3143,7 @@ typedef struct _MPI3_SAS_PHY_PAGE4
  *              Common definitions used by PCIe Configuration Pages          *
  ****************************************************************************/
 
-/**** Defines for Negotiated Link Rates ****/
+/**** Defines for NegotiatedLinkRates ****/
 #define MPI3_PCIE_LINK_RETIMERS_MASK                    (0x30)
 #define MPI3_PCIE_LINK_RETIMERS_SHIFT                   (4)
 #define MPI3_PCIE_NEG_LINK_RATE_MASK                    (0x0F)
@@ -3219,8 +3310,8 @@ typedef struct _MPI3_PCIE_IO_UNIT_PAGE1
 #define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_PERST_OVERRIDE_BACKPLANE_ERROR          (0x60000000)
 #define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_REFCLK_OVERRIDE_MASK                    (0x1C000000)
 #define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_REFCLK_OVERRIDE_NONE                    (0x00000000)
-#define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_REFCLK_OVERRIDE_DEASSERT                (0x04000000)
-#define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_REFCLK_OVERRIDE_ASSERT                  (0x08000000)
+#define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_REFCLK_OVERRIDE_ENABLE                  (0x04000000)
+#define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_REFCLK_OVERRIDE_DISABLE                 (0x08000000)
 #define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_REFCLK_OVERRIDE_BACKPLANE_ERROR         (0x0C000000)
 #define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_PARTIAL_CAPACITY_ENABLE                 (0x00000100)
 #define MPI3_PCIEIOUNIT1_CONTROL_FLAGS_LINK_OVERRIDE_DISABLE                   (0x00000080)
@@ -3362,12 +3453,14 @@ typedef struct _MPI3_PCIE_SWITCH_PAGE1
 /**** Defines for the PageVersion field ****/
 #define MPI3_PCIESWITCH1_PAGEVERSION        (0x00)
 
-/**** Defines for the FLAGS field ****/
+/**** Defines for the Flags field ****/
 #define MPI3_PCIESWITCH1_FLAGS_ASPMSTATE_MASK     (0x0C)
 #define MPI3_PCIESWITCH1_FLAGS_ASPMSTATE_SHIFT    (2)
+
 /*** use MPI3_PCIE_ASPM_ENABLE_ defines for ASPMState field values ***/
 #define MPI3_PCIESWITCH1_FLAGS_ASPMSUPPORT_MASK     (0x03)
 #define MPI3_PCIESWITCH1_FLAGS_ASPMSUPPORT_SHIFT    (0)
+
 /*** use MPI3_PCIE_ASPM_SUPPORT_ defines for ASPMSupport field values ***/
 
 /**** Defines for the NegotiatedLinkRate field - use MPI3_PCIE_NEG_LINK_RATE_ defines ****/
@@ -3454,6 +3547,8 @@ typedef struct _MPI3_ENCLOSURE_PAGE0
     U16                             SEPDevHandle;           /* 0x1A */
     U8                              ChassisSlot;            /* 0x1C */
     U8                              Reserved1D[3];          /* 0x1D */
+    U32                             ReceptacleIDs;          /* 0x20 */
+    U32                             Reserved24;             /* 0x24 */
 } MPI3_ENCLOSURE_PAGE0, MPI3_POINTER PTR_MPI3_ENCLOSURE_PAGE0,
   Mpi3EnclosurePage0_t, MPI3_POINTER pMpi3EnclosurePage0_t;
 
@@ -3474,7 +3569,8 @@ typedef struct _MPI3_ENCLOSURE_PAGE0
 #define MPI3_ENCLS0_FLAGS_MNG_IOC_SES                   (0x0001)
 #define MPI3_ENCLS0_FLAGS_MNG_SES_ENCLOSURE             (0x0002)
 
-/**** Defines for the PhysicalPort field - use MPI3_DEVICE0_PHYPORT_ defines ****/
+/**** Defines for the ReceptacleIDs field ****/
+#define MPI3_ENCLS0_RECEPTACLEIDS_NOT_REPORTED          (0x00000000)
 
 /*****************************************************************************
  *              Device Configuration Pages                                   *
@@ -3577,7 +3673,7 @@ typedef struct _MPI3_DEVICE0_PCIE_FORMAT
 #define MPI3_DEVICE0_PCIE_CAP_ASPM_SHIFT                    (6)
 /*** use MPI3_PCIE_ASPM_SUPPORT_  defines for ASPM field values ***/
 
-/**** Defines for the RecoverMethod field ****/
+/**** Defines for the RecoveryInfo field ****/
 #define MPI3_DEVICE0_PCIE_RECOVER_METHOD_MASK               (0xE0)
 #define MPI3_DEVICE0_PCIE_RECOVER_METHOD_NS_MGMT            (0x00)
 #define MPI3_DEVICE0_PCIE_RECOVER_METHOD_FORMAT             (0x20)
diff --git a/sys/dev/mpi3mr/mpi/mpi30_image.h b/sys/dev/mpi3mr/mpi/mpi30_image.h
index 7b953cb3b1a6..917763b3e921 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_image.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_image.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_IMAGE_H
 #define MPI30_IMAGE_H     1
 
@@ -119,12 +118,19 @@ typedef struct _MPI3_COMPONENT_IMAGE_HEADER
 #define MPI3_IMAGE_HEADER_SIGNATURE1_RMC                      (0x20434D52)  /* string "RMC "  */
 #define MPI3_IMAGE_HEADER_SIGNATURE1_SMM                      (0x204D4D53)  /* string "SMM "  */
 #define MPI3_IMAGE_HEADER_SIGNATURE1_PSW                      (0x20575350)  /* string "PSW "  */
-
+#define MPI3_IMAGE_HEADER_SIGNATURE1_CSW                      (0x20575343)  /* string "CSW "  */
 
 /**** Definitions for Signature2 field ****/
 #define MPI3_IMAGE_HEADER_SIGNATURE2_VALUE                    (0x50584546)
 
 /**** Definitions for Flags field ****/
+#define MPI3_IMAGE_HEADER_FLAGS_SIGNED_UEFI_MASK              (0x00000300)
+#define MPI3_IMAGE_HEADER_FLAGS_SIGNED_UEFI_UNSPECIFIED       (0x00000000)
+#define MPI3_IMAGE_HEADER_FLAGS_SIGNED_UEFI_NOT_SIGNED        (0x00000100)
+#define MPI3_IMAGE_HEADER_FLAGS_SIGNED_UEFI_MICROSOFT_SIGNED  (0x00000200)
+#define MPI3_IMAGE_HEADER_FLAGS_CERT_CHAIN_FORMAT_MASK        (0x000000C0)
+#define MPI3_IMAGE_HEADER_FLAGS_CERT_CHAIN_FORMAT_DEVICE_CERT (0x00000000)
+#define MPI3_IMAGE_HEADER_FLAGS_CERT_CHAIN_FORMAT_ALIAS_CERT  (0x00000040)
 #define MPI3_IMAGE_HEADER_FLAGS_DEVICE_KEY_BASIS_MASK         (0x00000030)
 #define MPI3_IMAGE_HEADER_FLAGS_DEVICE_KEY_BASIS_CDI          (0x00000000)
 #define MPI3_IMAGE_HEADER_FLAGS_DEVICE_KEY_BASIS_DI           (0x00000010)
@@ -216,12 +222,14 @@ typedef struct _MPI3_CI_MANIFEST_MPI
 
 /* defines for the ReleaseLevel field */
 #define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_DEV                        (0x00)
+#define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_PRE_PRODUCTION             (0x08)
 #define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_PREALPHA                   (0x10)
 #define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_ALPHA                      (0x20)
 #define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_BETA                       (0x30)
 #define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_RC                         (0x40)
 #define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_GCA                        (0x50)
 #define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_POINT                      (0x60)
+#define MPI3_CI_MANIFEST_MPI_RELEASE_LEVEL_DIAG                       (0xF0)
 
 /* defines for the Flags field */
 #define MPI3_CI_MANIFEST_MPI_FLAGS_DIAG_AUTHORIZATION                 (0x01)
@@ -314,9 +322,9 @@ typedef struct _MPI3_SUPPORTED_DEVICES_DATA
 } MPI3_SUPPORTED_DEVICES_DATA, MPI3_POINTER PTR_MPI3_SUPPORTED_DEVICES_DATA,
   Mpi3SupportedDevicesData_t, MPI3_POINTER pMpi3SupportedDevicesData_t;
 
-#ifndef MPI3_ENCRYPTED_HASH_MAX
-#define MPI3_ENCRYPTED_HASH_MAX                      (1)
-#endif  /* MPI3_ENCRYPTED_HASH_MAX */
+#ifndef MPI3_PUBLIC_KEY_MAX
+#define MPI3_PUBLIC_KEY_MAX                          (1)
+#endif  /* MPI3_PUBLIC_KEY_MAX */
 
 /* Encrypted Hash Entry Format */
 typedef struct _MPI3_ENCRYPTED_HASH_ENTRY
@@ -325,8 +333,10 @@ typedef struct _MPI3_ENCRYPTED_HASH_ENTRY
     U8                      HashAlgorithm;                                  /* 0x01 */
     U8                      EncryptionAlgorithm;                            /* 0x02 */
     U8                      Reserved03;                                     /* 0x03 */
-    U32                     Reserved04;                                     /* 0x04 */
-    U32                     EncryptedHash[MPI3_ENCRYPTED_HASH_MAX];         /* 0x08 */   /* variable length */
+    U16                     PublicKeySize;                                  /* 0x04 */
+    U16                     SignatureSize;                                  /* 0x06 */
+    U32                     PublicKey[MPI3_PUBLIC_KEY_MAX];                 /* 0x08 */     /* variable length */
+    /*                      Signature     - offset of this field must be calculated */     /* variable length */
 } MPI3_ENCRYPTED_HASH_ENTRY, MPI3_POINTER PTR_MPI3_ENCRYPTED_HASH_ENTRY,
   Mpi3EncryptedHashEntry_t, MPI3_POINTER pMpi3EncryptedHashEntry_t;
 
@@ -358,24 +368,9 @@ typedef struct _MPI3_ENCRYPTED_HASH_ENTRY
 #define MPI3_ENCRYPTION_ALGORITHM_ECDSA_P256         (0x07)   /* NIST secp256r1 curve */
 #define MPI3_ENCRYPTION_ALGORITHM_ECDSA_P384         (0x08)   /* NIST secp384r1 curve */
 #define MPI3_ENCRYPTION_ALGORITHM_ECDSA_P521         (0x09)   /* NIST secp521r1 curve */
-
-
-#ifndef MPI3_PUBLIC_KEY_MAX
-#define MPI3_PUBLIC_KEY_MAX                          (1)
-#endif  /* MPI3_PUBLIC_KEY_MAX */
-
-/* Encrypted Key with Hash Entry Format */
-typedef struct _MPI3_ENCRYPTED_KEY_WITH_HASH_ENTRY
-{
-    U8                      HashImageType;                                  /* 0x00 */
-    U8                      HashAlgorithm;                                  /* 0x01 */
-    U8                      EncryptionAlgorithm;                            /* 0x02 */
-    U8                      Reserved03;                                     /* 0x03 */
-    U32                     Reserved04;                                     /* 0x04 */
-    U32                     PublicKey[MPI3_PUBLIC_KEY_MAX];                 /* 0x08 */     /* variable length */
-    /*                      EncryptedHash - offset of this field must be calculated */     /* variable length */
-} MPI3_ENCRYPTED_KEY_WITH_HASH_ENTRY, MPI3_POINTER PTR_MPI3_ENCRYPTED_KEY_WITH_HASH_ENTRY,
-  Mpi3EncryptedKeyWithHashEntry_t, MPI3_POINTER pMpi3EncryptedKeyWithHashEntry_t;
+#define MPI3_ENCRYPTION_ALGORITHM_LMS_HSS            (0x0A)   /* Leighton-Micali Signature (LMS) -
+							       * Hierarchical Signature System (HSS)
+							       */
 
 #ifndef MPI3_ENCRYPTED_HASH_ENTRY_MAX
 #define MPI3_ENCRYPTED_HASH_ENTRY_MAX               (1)
diff --git a/sys/dev/mpi3mr/mpi/mpi30_init.h b/sys/dev/mpi3mr/mpi/mpi30_init.h
index c0ba14909ac1..361fb690fbe6 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_init.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_init.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_INIT_H
 #define MPI30_INIT_H     1
 
@@ -78,7 +77,7 @@ typedef struct _MPI3_SCSI_IO_REQUEST
     U16                     ChangeCount;                    /* 0x08 */
     U16                     DevHandle;                      /* 0x0A */
     U32                     Flags;                          /* 0x0C */
-    U32                     SkipCount;                      /* 0x10 */
+    U32                     IOCUseOnly10;                   /* 0x10 */
     U32                     DataLength;                     /* 0x14 */
     U8                      LUN[8];                         /* 0x18 */
     MPI3_SCSI_IO_CDB_UNION  CDB;                            /* 0x20 */
@@ -91,10 +90,12 @@ typedef struct _MPI3_SCSI_IO_REQUEST
 #define MPI3_SCSIIO_MSGFLAGS_DIVERT_TO_FIRMWARE               (0x40)
 
 /**** Defines for the Flags field ****/
-#define MPI3_SCSIIO_FLAGS_LARGE_CDB                           (0x60000000)
+#define MPI3_SCSIIO_FLAGS_LARGE_CDB_MASK                      (0x60000000)
 #define MPI3_SCSIIO_FLAGS_CDB_16_OR_LESS                      (0x00000000)
 #define MPI3_SCSIIO_FLAGS_CDB_GREATER_THAN_16                 (0x20000000)
 #define MPI3_SCSIIO_FLAGS_CDB_IN_SEPARATE_BUFFER              (0x40000000)
+#define MPI3_SCSIIO_FLAGS_CDB_PRODUCT_SPECIFIC                (0x60000000)
+#define MPI3_SCSIIO_FLAGS_IOC_USE_ONLY_27_MASK                (0x18000000)
 #define MPI3_SCSIIO_FLAGS_TASKATTRIBUTE_MASK                  (0x07000000)
 #define MPI3_SCSIIO_FLAGS_TASKATTRIBUTE_SIMPLEQ               (0x00000000)
 #define MPI3_SCSIIO_FLAGS_TASKATTRIBUTE_HEADOFQ               (0x01000000)
diff --git a/sys/dev/mpi3mr/mpi/mpi30_ioc.h b/sys/dev/mpi3mr/mpi/mpi30_ioc.h
index 77f6be5b2694..2d45a55b89e8 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_ioc.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_ioc.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_IOC_H
 #define MPI30_IOC_H     1
 
@@ -76,17 +75,19 @@ typedef struct _MPI3_IOC_INIT_REQUEST
   Mpi3IOCInitRequest_t, MPI3_POINTER pMpi3IOCInitRequest_t;
 
 /**** Defines for the MsgFlags field ****/
-#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_MASK          (0x03)
-#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_NOT_USED      (0x00)
-#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_SEPARATED     (0x01)
-#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_INLINE        (0x02)
-#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_BOTH          (0x03)
+#define MPI3_IOCINIT_MSGFLAGS_WRITESAMEDIVERT_SUPPORTED     (0x08)
+#define MPI3_IOCINIT_MSGFLAGS_SCSIIOSTATUSREPLY_SUPPORTED   (0x04)
+#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_MASK             (0x03)
+#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_NOT_USED         (0x00)
+#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_SEPARATED        (0x01)
+#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_INLINE           (0x02)
+#define MPI3_IOCINIT_MSGFLAGS_HOSTMETADATA_BOTH             (0x03)
 
 /**** Defines for the WhoInit field ****/
-#define MPI3_WHOINIT_NOT_INITIALIZED                     (0x00)
-#define MPI3_WHOINIT_ROM_BIOS                            (0x02)
-#define MPI3_WHOINIT_HOST_DRIVER                         (0x03)
-#define MPI3_WHOINIT_MANUFACTURER                        (0x04)
+#define MPI3_WHOINIT_NOT_INITIALIZED                        (0x00)
+#define MPI3_WHOINIT_ROM_BIOS                               (0x02)
+#define MPI3_WHOINIT_HOST_DRIVER                            (0x03)
+#define MPI3_WHOINIT_MANUFACTURER                           (0x04)
 
 /**** Defines for the DriverInformationAddress field */
 typedef struct _MPI3_DRIVER_INFO_LAYOUT
@@ -173,6 +174,8 @@ typedef struct _MPI3_IOC_FACTS_DATA
     U16                     MaxIOThrottleGroup;                 /* 0x62 */
     U16                     IOThrottleLow;                      /* 0x64 */
     U16                     IOThrottleHigh;                     /* 0x66 */
+    U32                     DiagFdlSize;                        /* 0x68 */
+    U32                     DiagTtySize;                        /* 0x6C */
 } MPI3_IOC_FACTS_DATA, MPI3_POINTER PTR_MPI3_IOC_FACTS_DATA,
   Mpi3IOCFactsData_t, MPI3_POINTER pMpi3IOCFactsData_t;
 
@@ -183,13 +186,13 @@ typedef struct _MPI3_IOC_FACTS_DATA
 #define MPI3_IOCFACTS_CAPABILITY_INT_COALESCE_MASK            (0x00000600)
 #define MPI3_IOCFACTS_CAPABILITY_INT_COALESCE_FIXED_THRESHOLD (0x00000000)
 #define MPI3_IOCFACTS_CAPABILITY_INT_COALESCE_OUTSTANDING_IO  (0x00000200)
-#define MPI3_IOCFACTS_CAPABILITY_COMPLETE_RESET_CAPABLE       (0x00000100)
-#define MPI3_IOCFACTS_CAPABILITY_SEG_DIAG_TRACE_ENABLED       (0x00000080)
-#define MPI3_IOCFACTS_CAPABILITY_SEG_DIAG_FW_ENABLED          (0x00000040)
-#define MPI3_IOCFACTS_CAPABILITY_SEG_DIAG_DRIVER_ENABLED      (0x00000020)
-#define MPI3_IOCFACTS_CAPABILITY_ADVANCED_HOST_PD_ENABLED     (0x00000010)
-#define MPI3_IOCFACTS_CAPABILITY_RAID_CAPABLE                 (0x00000008)
-#define MPI3_IOCFACTS_CAPABILITY_MULTIPATH_ENABLED            (0x00000002)
+#define MPI3_IOCFACTS_CAPABILITY_COMPLETE_RESET_SUPPORTED     (0x00000100)
+#define MPI3_IOCFACTS_CAPABILITY_SEG_DIAG_TRACE_SUPPORTED     (0x00000080)
+#define MPI3_IOCFACTS_CAPABILITY_SEG_DIAG_FW_SUPPORTED        (0x00000040)
+#define MPI3_IOCFACTS_CAPABILITY_SEG_DIAG_DRIVER_SUPPORTED    (0x00000020)
+#define MPI3_IOCFACTS_CAPABILITY_ADVANCED_HOST_PD_SUPPORTED   (0x00000010)
+#define MPI3_IOCFACTS_CAPABILITY_RAID_SUPPORTED               (0x00000008)
+#define MPI3_IOCFACTS_CAPABILITY_MULTIPATH_SUPPORTED          (0x00000002)
 #define MPI3_IOCFACTS_CAPABILITY_COALESCE_CTRL_SUPPORTED      (0x00000001)
 
 /**** WhoInit values are defined under IOCInit Request Message definition ****/
@@ -234,22 +237,29 @@ typedef struct _MPI3_IOC_FACTS_DATA
 #define MPI3_IOCFACTS_MAX_DATA_LENGTH_NOT_REPORTED            (0x0000)
 
 /**** Defines for the Flags field ****/
-#define MPI3_IOCFACTS_FLAGS_SIGNED_NVDATA_REQUIRED            (0x00010000)
-#define MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_MASK            (0x0000FF00)
-#define MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_SHIFT           (8)
-#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK          (0x00000030)
-#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_NOT_STARTED   (0x00000000)
-#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_IN_PROGRESS   (0x00000010)
-#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_COMPLETE      (0x00000020)
-#define MPI3_IOCFACTS_FLAGS_PERSONALITY_MASK                  (0x0000000F)
-#define MPI3_IOCFACTS_FLAGS_PERSONALITY_EHBA                  (0x00000000)
-#define MPI3_IOCFACTS_FLAGS_PERSONALITY_RAID_DDR              (0x00000002)
+#define MPI3_IOCFACTS_FLAGS_SIGNED_NVDATA_REQUIRED             (0x00010000)
+#define MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_MASK             (0x0000FF00)
+#define MPI3_IOCFACTS_FLAGS_DMA_ADDRESS_WIDTH_SHIFT            (8)
+#define MPI3_IOCFACTS_FLAGS_MAX_REQ_PER_REPLY_QUEUE_LIMIT      (0x00000040)
+#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_MASK           (0x00000030)
+#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_NOT_STARTED    (0x00000000)
+#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_IN_PROGRESS    (0x00000010)
+#define MPI3_IOCFACTS_FLAGS_INITIAL_PORT_ENABLE_COMPLETE       (0x00000020)
+#define MPI3_IOCFACTS_FLAGS_PERSONALITY_MASK                   (0x0000000F)
+#define MPI3_IOCFACTS_FLAGS_PERSONALITY_EHBA                   (0x00000000)
+#define MPI3_IOCFACTS_FLAGS_PERSONALITY_RAID_DDR               (0x00000002)
 
 /**** Defines for the IOThrottleDataLength field ****/
-#define MPI3_IOCFACTS_IO_THROTTLE_DATA_LENGTH_NOT_REQUIRED    (0x0000)
+#define MPI3_IOCFACTS_IO_THROTTLE_DATA_LENGTH_NOT_REQUIRED     (0x0000)
 
-/**** Defines for the IOThrottleDataLength field ****/
-#define MPI3_IOCFACTS_MAX_IO_THROTTLE_GROUP_NOT_REQUIRED      (0x0000)
+/**** Defines for the MaxIOThrottleGroup field ****/
+#define MPI3_IOCFACTS_MAX_IO_THROTTLE_GROUP_NOT_REQUIRED       (0x0000)
+
+/**** Defines for the DiagFdlSize field ****/
+#define MPI3_IOCFACTS_DIAGFDLSIZE_NOT_SUPPORTED                (0x00000000)
+
+/**** Defines for the DiagTtySize field ****/
+#define MPI3_IOCFACTS_DIAGTTYSIZE_NOT_SUPPORTED                (0x00000000)
 
 /*****************************************************************************
  *              Management Passthrough Request Message                      *
@@ -440,9 +450,9 @@ typedef struct _MPI3_EVENT_NOTIFICATION_REQUEST
 } MPI3_EVENT_NOTIFICATION_REQUEST, MPI3_POINTER PTR_MPI3_EVENT_NOTIFICATION_REQUEST,
   Mpi3EventNotificationRequest_t, MPI3_POINTER pMpi3EventNotificationRequest_t;
 
-/**** Defines for the SASBroadcastPrimitiveMasks field - use MPI3_EVENT_PRIMITIVE_ values ****/
+/**** Defines for the SASBroadcastPrimitiveMasks field - use MPI3_EVENT_BROADCAST_PRIMITIVE_ values ****/
 
-/**** Defines for the SASNotifyPrimitiveMasks field - use MPI3_EVENT_NOTIFY_ values ****/
+/**** Defines for the SASNotifyPrimitiveMasks field - use MPI3_EVENT_NOTIFY_PRIMITIVE_ values ****/
 
 /**** Defines for the EventMasks field - use MPI3_EVENT_ values ****/
 
@@ -716,7 +726,7 @@ typedef struct _MPI3_EVENT_SAS_TOPO_PHY_ENTRY
 {
     U16             AttachedDevHandle;      /* 0x00 */
     U8              LinkRate;               /* 0x02 */
-    U8              Status;                 /* 0x03 */
+    U8              PhyStatus;              /* 0x03 */
 } MPI3_EVENT_SAS_TOPO_PHY_ENTRY, MPI3_POINTER PTR_MPI3_EVENT_SAS_TOPO_PHY_ENTRY,
   Mpi3EventSasTopoPhyEntry_t, MPI3_POINTER pMpi3EventSasTopoPhyEntry_t;
 
diff --git a/sys/dev/mpi3mr/mpi/mpi30_pci.h b/sys/dev/mpi3mr/mpi/mpi30_pci.h
index f15dab2a5a9c..008ec7059b76 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_pci.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_pci.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_PCI_H
 #define MPI30_PCI_H     1
 
diff --git a/sys/dev/mpi3mr/mpi/mpi30_raid.h b/sys/dev/mpi3mr/mpi/mpi30_raid.h
index fe2c4baffd3c..85941544e8fe 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_raid.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_raid.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_RAID_H
 #define MPI30_RAID_H     1
 
diff --git a/sys/dev/mpi3mr/mpi/mpi30_sas.h b/sys/dev/mpi3mr/mpi/mpi30_sas.h
index c28de07c9fdd..fc55fba4747f 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_sas.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_sas.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_SAS_H
 #define MPI30_SAS_H     1
 
diff --git a/sys/dev/mpi3mr/mpi/mpi30_targ.h b/sys/dev/mpi3mr/mpi/mpi30_targ.h
index d9aee48a6437..646b5287d502 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_targ.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_targ.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_TARG_H
 #define MPI30_TARG_H     1
 
@@ -191,7 +190,7 @@ typedef struct _MPI3_TARGET_ASSIST_REQUEST
     U16                     QueueTag;                   /* 0x12 */
     U16                     IoIndex;                    /* 0x14 */
     U16                     InitiatorConnectionTag;     /* 0x16 */
-    U32                     SkipCount;                  /* 0x18 */
+    U32                     IOCUseOnly18;               /* 0x18 */
     U32                     DataLength;                 /* 0x1C */
     U32                     PortTransferLength;         /* 0x20 */
     U32                     PrimaryReferenceTag;        /* 0x24 */
@@ -206,6 +205,8 @@ typedef struct _MPI3_TARGET_ASSIST_REQUEST
 #define MPI3_TARGET_ASSIST_MSGFLAGS_METASGL_VALID           (0x80)
 
 /**** Defines for the Flags field ****/
+#define MPI3_TARGET_ASSIST_FLAGS_IOC_USE_ONLY_23_MASK       (0x00800000)
+#define MPI3_TARGET_ASSIST_FLAGS_IOC_USE_ONLY_22_MASK       (0x00400000)
 #define MPI3_TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER          (0x00200000)
 #define MPI3_TARGET_ASSIST_FLAGS_AUTO_STATUS                (0x00100000)
 #define MPI3_TARGET_ASSIST_FLAGS_DATADIRECTION_MASK         (0x000C0000)
@@ -243,6 +244,7 @@ typedef struct _MPI3_TARGET_STATUS_SEND_REQUEST
   Mpi3TargetStatusSendRequest_t, MPI3_POINTER pMpi3TargetStatusSendRequest_t;
 
 /**** Defines for the Flags field ****/
+#define MPI3_TSS_FLAGS_IOC_USE_ONLY_6_MASK              (0x0040)
 #define MPI3_TSS_FLAGS_REPOST_CMD_BUFFER                (0x0020)
 #define MPI3_TSS_FLAGS_AUTO_SEND_GOOD_STATUS            (0x0010)
 
diff --git a/sys/dev/mpi3mr/mpi/mpi30_tool.h b/sys/dev/mpi3mr/mpi/mpi30_tool.h
index 55fb53601863..e11ddf068555 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_tool.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_tool.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_TOOL_H
 #define MPI30_TOOL_H     1
 
@@ -366,6 +365,7 @@ typedef struct _MPI3_DIAG_BUFFER_POST_REQUEST
 #define MPI3_DIAG_BUFFER_TYPE_FW                            (0x02)
 #define MPI3_DIAG_BUFFER_TYPE_DRIVER                        (0x10)
 #define MPI3_DIAG_BUFFER_TYPE_FDL                           (0x20)
+#define MPI3_DIAG_BUFFER_TYPE_TTY                           (0x30)
 #define MPI3_DIAG_BUFFER_MIN_PRODUCT_SPECIFIC               (0xF0)
 #define MPI3_DIAG_BUFFER_MAX_PRODUCT_SPECIFIC               (0xFF)
 
@@ -388,7 +388,7 @@ typedef struct _MPI3_DRIVER_BUFFER_HEADER
 } MPI3_DRIVER_BUFFER_HEADER, MPI3_POINTER PTR_MPI3_DRIVER_BUFFER_HEADER,
   Mpi3DriverBufferHeader_t, MPI3_POINTER pMpi3DriverBufferHeader_t;
 
-/**** Defines for the Type field ****/
+/**** Defines for the Signature field ****/
 #define MPI3_DRIVER_DIAG_BUFFER_HEADER_SIGNATURE_CIRCULAR                (0x43495243)
 
 /**** Defines for the Flags field ****/
diff --git a/sys/dev/mpi3mr/mpi/mpi30_transport.h b/sys/dev/mpi3mr/mpi/mpi30_transport.h
index 436496411309..860c27a2dd42 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_transport.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_transport.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -37,10 +37,8 @@
  *
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
- */
-
-/*
- * Version History
+ *
+ *  Version History
  *  ---------------
  *
  *  Date      Version       Description
@@ -72,7 +70,11 @@
  *  09-02-22  03.00.27.00  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 27.
  *  10-20-22  03.00.27.01  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 27 - Interim Release 1.
  *  12-02-22  03.00.28.00  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 28.
- *  02-24-22  03.00.29.00  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 29.
+ *  02-24-23  03.00.29.00  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 29.
+ *  05-19-23  03.00.30.00  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 30.
+ *  08-18-23  03.00.30.01  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 30 - Interim Release 1.
+ *  11-17-23  03.00.31.00  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 31
+ *  02-16-24  03.00.32.00  Corresponds to Fusion-MPT MPI 3.0 Specification Rev 32
  */
 #ifndef MPI30_TRANSPORT_H
 #define MPI30_TRANSPORT_H     1
@@ -101,7 +103,7 @@ typedef union _MPI3_VERSION_UNION
 /****** Version constants for this revision ****/
 #define MPI3_VERSION_MAJOR                                              (3)
 #define MPI3_VERSION_MINOR                                              (0)
-#define MPI3_VERSION_UNIT                                               (29)
+#define MPI3_VERSION_UNIT                                               (32)
 #define MPI3_VERSION_DEV                                                (0)
 
 /****** DevHandle definitions *****/
@@ -425,15 +427,9 @@ typedef struct _MPI3_STATUS_REPLY_DESCRIPTOR
 } MPI3_STATUS_REPLY_DESCRIPTOR, MPI3_POINTER PTR_MPI3_STATUS_REPLY_DESCRIPTOR,
   Mpi3StatusReplyDescriptor_t, MPI3_POINTER pMpi3StatusReplyDescriptor_t;
 
-/**** Defines for the IOCStatus field ****/
-#define MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_LOGINFOAVAIL               (0x8000)
-#define MPI3_REPLY_DESCRIPT_STATUS_IOCSTATUS_STATUS_MASK                (0x7FFF)
+/**** Use MPI3_IOCSTATUS_ defines for the IOCStatus field ****/
 
-/**** Defines for the IOCLogInfo field ****/
-#define MPI3_REPLY_DESCRIPT_STATUS_IOCLOGINFO_TYPE_MASK                 (0xF0000000)
-#define MPI3_REPLY_DESCRIPT_STATUS_IOCLOGINFO_TYPE_NO_INFO              (0x00000000)
-#define MPI3_REPLY_DESCRIPT_STATUS_IOCLOGINFO_TYPE_SAS                  (0x30000000)
-#define MPI3_REPLY_DESCRIPT_STATUS_IOCLOGINFO_DATA_MASK                 (0x0FFFFFFF)
+/**** Use MPI3_IOCLOGINFO_ defines for the IOCLogInfo field ****/
 
 /*****************************************************************************
  *              Union of Reply Descriptors                                   *
@@ -652,7 +648,6 @@ typedef struct _MPI3_DEFAULT_REPLY
 #define MPI3_FUNCTION_MAX_PRODUCT_SPECIFIC          (0xFF)  /* End of the product-specific range of function codes */
 
 /**** Defines for IOCStatus ****/
-#define MPI3_IOCSTATUS_LOG_INFO_AVAIL_MASK          (0x8000)
 #define MPI3_IOCSTATUS_LOG_INFO_AVAILABLE           (0x8000)
 #define MPI3_IOCSTATUS_STATUS_MASK                  (0x7FFF)
 
diff --git a/sys/dev/mpi3mr/mpi/mpi30_type.h b/sys/dev/mpi3mr/mpi/mpi30_type.h
index 267ede701762..815becadcf25 100644
--- a/sys/dev/mpi3mr/mpi/mpi30_type.h
+++ b/sys/dev/mpi3mr/mpi/mpi30_type.h
@@ -1,7 +1,7 @@
 /*
- * SPDX-License-Identifier: BSD-2-Clause
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  *
- * Copyright (c) 2016-2023, Broadcom Inc. All rights reserved.
+ * Copyright (c) 2016-2024, Broadcom Inc. All rights reserved.
  * Support: <fbsd-storage-driver.pdl@broadcom.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,6 @@
  * Broadcom Inc. (Broadcom) MPI3MR Adapter FreeBSD
  *
  */
-
 #ifndef MPI30_TYPE_H
 #define MPI30_TYPE_H     1
 
diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index c592d5734d38..99a331c9baf0 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -2268,7 +2268,7 @@ mpi3mr_display_ioc_info(struct mpi3mr_softc *sc)
         printf("Capabilities=(");
 
         if (sc->facts.ioc_capabilities &
*** 97 LINES SKIPPED ***

From nobody Thu Jun  6 10:39:30 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16W3T2dz5Mfp1;
	Thu, 06 Jun 2024 10:39:31 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16W1ljCz4jR8;
	Thu,  6 Jun 2024 10:39:31 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670371;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=fLp9K4sKl7AcBplE2B5q/8ZhFDYIlRfKc9zWu5cYIv4=;
	b=t/EZLwqH5RNdxS4FyEmSNF5hXG1zrwz/zMiE7gAz4CCM6xh25X1DWpWyjmtOaMGYJxIrmw
	jQOsSdxoApZWBoiUnkx39CPKH46h0LQK5XYZew7NSNXDIKSnuXW28g6eoEUYuP+YLr74nR
	nRAREH2mZDXhr0GtJcWJijjESGcyfuvFPOySPdblcKF9mCWpeTf5r7g74kAzDTMcfJgwF/
	HQp5Ei6/cCRt6Av/YaxyHLBbr65Mh1ilP09fkUHWynuZQm0XNVZSkmA6Rg2c0IMMnKtP11
	+PmplEjHGMcERHnuhex3Rjxpn+o+yMVgONsMAC8C/8o0QZ2Ql1NmmOtxU8cMDQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670371; a=rsa-sha256; cv=none;
	b=gvp9NY4iCnoWcUOT4uMW+ZKjiIwznXd3iiQe053JBmZT6to0MJVQwAVsZFVjGPpDPfGE6j
	idXAStikQgvSvqw3FjYBkZCt3jEWk4ovABocMM4H+xh3TVWuRFuaEMRB5fd1okr8JiOLXz
	oSZNQXv2qqu4d8iu4Shnq9ToLphbJz291Xpk4CM3JifTsMDtlKKMm/hhysn0LsOIk3WMNY
	wfgZXeHbigF/dURzB7Kvqlf96QXtXavGbGAPvvI+4jykS64HB366Fh9FtJ7upVhbye8obW
	PYq1PKjMSVzatnnwAm8lgDFMAZbePvFwtr7wibeQFxoP5PMsfCdz5soxCQ/VgQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670371;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=fLp9K4sKl7AcBplE2B5q/8ZhFDYIlRfKc9zWu5cYIv4=;
	b=eLE9Bv72qWaSwOcEoEnGCaGUVN7gPcH7X/WG4dXCeUfLzDhtUGqwUM+ZyuiHYIzIe3g+5v
	i+HNcL2XMaRjHdgF1N/mtJM/4F8u1Pc/Tf1Se/a8GfwKRb4OTghcRLmehl+dIe79PlBTmv
	I26H6h6LA5CX/4Ux/gmlo3a5awCN5s1Pz3ugPLxlgHC4PtmzNNBmGen+HBdbWva3HwMUxD
	ive+aISNNc9H/IM1cqtz0cl69z1RldYTE13DT5PS0YnUQW/8GTtCQixXkq307lKl0/u2Hu
	QFzRScWVmcHqUiNaRFGvnQ3JXlt70xfYCs9D0bOUT5PTs7lGzQiV39vB8Tzw0w==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16W0KfTzj8X;
	Thu,  6 Jun 2024 10:39:31 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdUUO090009;
	Thu, 6 Jun 2024 10:39:30 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdUPf090006;
	Thu, 6 Jun 2024 10:39:30 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:30 GMT
Message-Id: <202406061039.456AdUPf090006@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: df595fc43e90 - main - mpi3mr: driver version update
  to 8.10.0.1.0
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: df595fc43e908d8e85601cf6136fbcf0a60fd0f9
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=df595fc43e908d8e85601cf6136fbcf0a60fd0f9

commit df595fc43e908d8e85601cf6136fbcf0a60fd0f9
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-03-19 07:29:01 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: driver version update to 8.10.0.1.0
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44430
---
 sys/dev/mpi3mr/mpi3mr.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index 84d5a8dfd5e7..45f00068021e 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -87,8 +87,8 @@
 #include <sys/kthread.h>
 #include "mpi/mpi30_api.h"
 
-#define MPI3MR_DRIVER_VERSION	"8.6.0.2.0"
-#define MPI3MR_DRIVER_RELDATE	"17th May 2023"
+#define MPI3MR_DRIVER_VERSION	"8.10.0.1.0"
+#define MPI3MR_DRIVER_RELDATE	"19th Mar 2024"
 
 #define MPI3MR_DRIVER_NAME	"mpi3mr"
 

From nobody Thu Jun  6 10:39:32 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16X6bMJz5Mfp8;
	Thu, 06 Jun 2024 10:39:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16X2SDCz4jd1;
	Thu,  6 Jun 2024 10:39:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670372;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=LBWlhWMSoLquoTRBxdHu861Wqboohfyp3cgBF5+Cvng=;
	b=MIYiuGrpt5223eyIwKbUA4EpAuHm9FxAhiziivLHYIDGQiI5hT/+tbBh1tDzXk6goXdVc0
	k2jZjGdj8yhuI69SrKzVm/2qhaFhGK3rTFkmzfF29/VS3dvXnYmAJQ7ojlKXynPcAKdivU
	HxaDBhcoo5M2HUuMdX/9/Q4COtFM3ious1iN7YKw/sIS5nBpec7Wog2hqtwpg46k9D9rI7
	fNr6SohFk8XvSOyvrgmywOHxybkwXcmpzdNIYXHNQPMB1cUz7vgNoh0rTqD/7Xha6G2u6q
	4cyET3A/LZuEyFcNwcAkz3gZ2zmfyTetUh+lnU1G2TaC8Z4lSpFjhlBD1Ct9sA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670372; a=rsa-sha256; cv=none;
	b=XgU6IllG/Xdzebl/eFXRWAVS+0gc4rQPs43k/FClNNHB5FIQ7g/YhSawKDq3q++goVRrCX
	Ze6fksl5xj0JQMZt8tmulzRa18m4MV6jkYAmx4V5Am9LFGDZ6wN/MLK+80btD6jFcdmUqz
	0zLvFf6WRVTJyfyS6nXMr2BDzyBPXgZt0/2EbQlorO+69c+OGM9gAkmqO4FGK+iMYTsNNY
	LoIH5SjTfq7QuUqgsPLFGTIcZcl6TMvzOR90QzZJBMwx9q9vbiXLV9LVWV9RbKhSL/fkMr
	PNx0KLzI7U6UV9H0nxkN8djm9R8Tz5dpKsz2R4+Qw298mhr4jvyqW63e5eWDAw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670372;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=LBWlhWMSoLquoTRBxdHu861Wqboohfyp3cgBF5+Cvng=;
	b=xFxhSh5UyZWRKEJfFGhZ6OU2XruUJnJYoX5wuUHEFEEGjq4XzmduB5xTlar7jEJRRRIgLc
	VAq4Mf5zHrWjy1ateKf5gAshfwtBQnvQvHheivJl2AatCWRmg8qLM+3wRrBeb+VsBRSq12
	1Qud3QW2996bzGDxNME/4jFzScUv2zKXriYfgfBllDBgJWI3ymUjDci0fbqKbH2TkqXV2C
	Ge7uuDePXWIDQq/LdSVlcuEAYEmPI1ZrGGw5uLsktTdENdTrHDvLwG8uLoss6JEvyXHmfP
	VTO1Cr5xxdpTUqkJLsZKxSlTqHv+ZgCuqnWwPQ741PDbZHXJRQJph9zN4Xr93A==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16X1p8jzjZT;
	Thu,  6 Jun 2024 10:39:32 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdW2H090078;
	Thu, 6 Jun 2024 10:39:32 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdWlj090075;
	Thu, 6 Jun 2024 10:39:32 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:32 GMT
Message-Id: <202406061039.456AdWlj090075@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 3f3a15543a67 - main - mpi3mr: Divert large WriteSame
  IOs to firmware if unmap and ndob bits are set
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 3f3a15543a6721100dda0e4219eb48ecbe35731a
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=3f3a15543a6721100dda0e4219eb48ecbe35731a

commit 3f3a15543a6721100dda0e4219eb48ecbe35731a
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-06-06 08:38:52 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:15 +0000

    mpi3mr: Divert large WriteSame IOs to firmware if unmap and ndob bits are set
    
    Firmware advertises the transfer lenght for writesame commands to driver during init.
    So for any writesame IOs with ndob and unmap bit set and transfer lengh is greater
    than the max write same length specified by the firmware, then direct those commands
    to firmware instead of hardware otherwise hardware will break.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44452
---
 sys/dev/mpi3mr/mpi3mr.c     | 16 ++++++++++++++++
 sys/dev/mpi3mr/mpi3mr.h     |  2 ++
 sys/dev/mpi3mr/mpi3mr_cam.c | 35 +++++++++++++++++++++++++++++++++++
 sys/dev/mpi3mr/mpi3mr_cam.h |  1 +
 sys/modules/mpi3mr/Makefile |  3 +++
 5 files changed, 57 insertions(+)

diff --git a/sys/dev/mpi3mr/mpi3mr.c b/sys/dev/mpi3mr/mpi3mr.c
index 5227e8b60435..36e540520e42 100644
--- a/sys/dev/mpi3mr/mpi3mr.c
+++ b/sys/dev/mpi3mr/mpi3mr.c
@@ -2176,6 +2176,8 @@ static int mpi3mr_issue_iocinit(struct mpi3mr_softc *sc)
 	time_in_msec = (now.tv_sec * 1000 + now.tv_usec/1000);
 	iocinit_req.TimeStamp = htole64(time_in_msec);
 
+	iocinit_req.MsgFlags |= MPI3_IOCINIT_MSGFLAGS_WRITESAMEDIVERT_SUPPORTED;
+
 	init_completion(&sc->init_cmds.completion);
 	retval = mpi3mr_submit_admin_cmd(sc, &iocinit_req,
 	    sizeof(iocinit_req));
@@ -3339,6 +3341,19 @@ void mpi3mr_update_device(struct mpi3mr_softc *sc,
 		break;
 	}
 
+	switch (flags & MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_MASK) {
+	case MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_256_LB:
+		tgtdev->ws_len = 256;
+		break;
+	case MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_2048_LB:
+		tgtdev->ws_len = 2048;
+		break;
+	case MPI3_DEVICE0_FLAGS_MAX_WRITE_SAME_NO_LIMIT:
+	default:
+		tgtdev->ws_len = 0;
+		break;
+	}
+
 	switch (tgtdev->dev_type) {
 	case MPI3_DEVICE_DEVFORM_SAS_SATA:
 	{
@@ -5648,6 +5663,7 @@ static void mpi3mr_invalidate_devhandles(struct mpi3mr_softc *sc)
 			target->io_throttle_enabled = 0;
 			target->io_divert = 0;
 			target->throttle_group = NULL;
+			target->ws_len = 0;
 		}
 	}
 	mtx_unlock_spin(&sc->target_lock);
diff --git a/sys/dev/mpi3mr/mpi3mr.h b/sys/dev/mpi3mr/mpi3mr.h
index 45f00068021e..31217f823569 100644
--- a/sys/dev/mpi3mr/mpi3mr.h
+++ b/sys/dev/mpi3mr/mpi3mr.h
@@ -231,6 +231,8 @@ extern char fmt_os_ver[16];
 
 #define MPI3MR_PERIODIC_DELAY	1	/* 1 second heartbeat/watchdog check */
 
+#define	WRITE_SAME_32	0x0d
+
 struct completion {
 	unsigned int done;
 	struct mtx lock;
diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c
index f8603eec9ae2..e3958ed8daf2 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -82,6 +82,7 @@
 #include "mpi3mr.h"
 #include <sys/time.h>			/* XXX for pcpu.h */
 #include <sys/pcpu.h>			/* XXX for PCPU_GET */
+#include <asm/unaligned.h>
 
 #define	smp_processor_id()  PCPU_GET(cpuid)
 
@@ -101,6 +102,37 @@ extern void mpi3mr_add_sg_single(void *paddr, U8 flags, U32 length,
 
 static U32 event_count;
 
+static
+inline void mpi3mr_divert_ws(Mpi3SCSIIORequest_t *req,
+			     struct ccb_scsiio *csio,
+			     U16 ws_len)
+{
+	U8 unmap = 0, ndob = 0;
+	U32 num_blocks = 0;
+	U8 opcode = scsiio_cdb_ptr(csio)[0];
+	U16 service_action = ((scsiio_cdb_ptr(csio)[8] << 8) | scsiio_cdb_ptr(csio)[9]);
+
+
+	if (opcode == WRITE_SAME_16 ||
+	   (opcode == VARIABLE_LEN_CDB &&
+	    service_action == WRITE_SAME_32)) {
+
+		int unmap_ndob_index = (opcode == WRITE_SAME_16) ? 1 : 10;
+
+		unmap = scsiio_cdb_ptr(csio)[unmap_ndob_index] & 0x08;
+		ndob = scsiio_cdb_ptr(csio)[unmap_ndob_index] & 0x01;
+		num_blocks = get_unaligned_be32(scsiio_cdb_ptr(csio) +
+						((opcode == WRITE_SAME_16) ? 10 : 28));
+
+		/* Check conditions for diversion to firmware */
+		if (unmap && ndob && num_blocks > ws_len) {
+			req->MsgFlags |= MPI3_SCSIIO_MSGFLAGS_DIVERT_TO_FIRMWARE;
+			req->Flags = htole32(le32toh(req->Flags) |
+					     MPI3_SCSIIO_FLAGS_DIVERT_REASON_WRITE_SAME_TOO_LARGE);
+		}
+	}
+}
+
 static void mpi3mr_prepare_sgls(void *arg,
 	bus_dma_segment_t *segs, int nsegs, int error)
 {
@@ -1079,6 +1111,9 @@ mpi3mr_action_scsiio(struct mpi3mr_cam_softc *cam_sc, union ccb *ccb)
 		break;
 	}
 
+	if (targ->ws_len)
+		mpi3mr_divert_ws(req, csio, targ->ws_len);
+
 	req->Flags = htole32(mpi_control);
 
 	if (csio->ccb_h.flags & CAM_CDB_POINTER)
diff --git a/sys/dev/mpi3mr/mpi3mr_cam.h b/sys/dev/mpi3mr/mpi3mr_cam.h
index 3a0526217f86..115ce0c4b8d7 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.h
+++ b/sys/dev/mpi3mr/mpi3mr_cam.h
@@ -121,6 +121,7 @@ struct mpi3mr_target {
 	struct mpi3mr_throttle_group_info *throttle_group;
 	uint64_t	q_depth;
 	enum mpi3mr_target_state state;
+	uint16_t	ws_len;
 };
 
 struct mpi3mr_cam_softc {
diff --git a/sys/modules/mpi3mr/Makefile b/sys/modules/mpi3mr/Makefile
index 3f1f63a94ac3..39aa2e3f0ddd 100644
--- a/sys/modules/mpi3mr/Makefile
+++ b/sys/modules/mpi3mr/Makefile
@@ -6,6 +6,9 @@ SRCS=	mpi3mr_pci.c mpi3mr.c mpi3mr_cam.c mpi3mr_app.c
 SRCS+=	opt_cam.h
 SRCS+=	device_if.h bus_if.h pci_if.h
 
+CFLAGS+= -I${SRCTOP}/sys/compat/linuxkpi/common/include
+DEBUG_FLAGS= -g
+
 .include <bsd.kmod.mk>
 
 CWARNFLAGS.mpi3mr_sas.c=		${NO_WUNNEEDED_INTERNAL_DECL}

From nobody Thu Jun  6 10:39:33 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw16Y4kM2z5Mfwf;
	Thu, 06 Jun 2024 10:39:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw16Y40C5z4jPW;
	Thu,  6 Jun 2024 10:39:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717670373;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=liJ+NfwkWcmDTDuPGAh///9oR989W/n7SNGGBPlVka0=;
	b=sxayB6QrzTb8BD3nYZGsLvonOXDtmbhWvFJ569stiSjHmpN67umFFLsJeHSi9p9+CjV3hw
	VMqPjp5CRDrmo125aXjy6Byn2sasJ3hvZVMBHOIF8GU84h+96BGEN3D8hw5DkQMJrTFo7S
	8sJ42dLAG1P8npmnabw2quoNvSZ9vcGbtoIA97JaqQegqoAmF+ePiMdn/I9JYJv5ZGoeG2
	rB+J2EhkXLUpG3cXKkaVPCgtQQDt+b2LvhtYzuUDpAb499KTegLD0fvqRwPyoBpWMDQr6G
	WEkEY76xq/kqXefrXkgnNYaG8AyVwhLpOwU1d9MweT/BNtsKpJChc29PzRslng==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717670373; a=rsa-sha256; cv=none;
	b=DH7weJRcCyZckpGH0OVfsLeGNg59xxrMolgXDVDo9vooVB9QnRk4T4XmxiN9Y259VIKXub
	hyp9vdbWq7YscA4LrWycIrFdPG6fe70lo/wRS3MCm/cccc8HvFUHmzuWUoRv3jLaFFEdFZ
	ctSh77rq8RPHNOsL+0Z1JgCpTjOrZqwzlNypZK4SEiTB6CF0HaJYQLWrl3LnyDNISh+jHK
	t8B6wEkxwhNUmq8opiBZsw4ZAuygJ7Y7O0diSahCpLPheLjx8999XruAg9dXBooyREi9Dr
	txYTEQ1yZ06O3/RgZ8WJh1nfN36Fz5UhtlF6own3V9UHmmi8RKf0rEzx32dljQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717670373;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=liJ+NfwkWcmDTDuPGAh///9oR989W/n7SNGGBPlVka0=;
	b=bGG8L5gpjl2ZBCt1+OsPFNsJphUZx/X5WPer1Uu1cbrZBA7I/ijvQ1lxCVmZKaLlJTMHMa
	dnpac41xVAayj+sZmkY0WDEDMThPNt+vUpxDHMNoppX+JdjGhHb0zrX6vqrlgULfIRDSVs
	ENGRZgiHPwO7bMwUUPkHqU4Iap/IyqLzKyAAYU285Fa72wSxNIJ65g9ySEQit1J6lEzUom
	rujl4lE+hFBWGxLqRpS+1tFR0GahF0sjyynUNZDrnfXLsHQCh680zhhJZgpxy+SbC7qcXN
	0kg3bil/3Xqqt8+NLxKp2tE7c5Q5xr/POdR09RYAMU+IpMsqrCbt9yVStISk5A==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw16Y2wjMzj4h;
	Thu,  6 Jun 2024 10:39:33 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456AdXds090141;
	Thu, 6 Jun 2024 10:39:33 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456AdXZ4090138;
	Thu, 6 Jun 2024 10:39:33 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 10:39:33 GMT
Message-Id: <202406061039.456AdXZ4090138@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Sumit Saxena <ssaxena@FreeBSD.org>
Subject: git: 8d3c3b52423f - main - mpi3mr: Track IO per target
  counter during queue poll with local variable
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: ssaxena
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8d3c3b52423f9740da424aa6dd73a20e694a9e08
Auto-Submitted: auto-generated

The branch main has been updated by ssaxena:

URL: https://cgit.FreeBSD.org/src/commit/?id=8d3c3b52423f9740da424aa6dd73a20e694a9e08

commit 8d3c3b52423f9740da424aa6dd73a20e694a9e08
Author:     Chandrakanth patil <chandrakanth.patil@broadcom.com>
AuthorDate: 2024-06-06 10:28:38 +0000
Commit:     Sumit Saxena <ssaxena@FreeBSD.org>
CommitDate: 2024-06-06 10:39:16 +0000

    mpi3mr: Track IO per target counter during queue poll with local variable
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D44494
---
 sys/dev/mpi3mr/mpi3mr_cam.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c
index e3958ed8daf2..e00d61073d96 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -1839,6 +1839,7 @@ int mpi3mr_remove_device_from_os(struct mpi3mr_softc *sc, U16 handle)
 {
 	int retval = 0;
 	struct mpi3mr_target *target;
+	unsigned int target_outstanding;
 
 	mpi3mr_dprint(sc, MPI3MR_EVENT,
 		"Removing Device (dev_handle: %d)\n", handle);
@@ -1856,16 +1857,17 @@ int mpi3mr_remove_device_from_os(struct mpi3mr_softc *sc, U16 handle)
 
 	target->flags |= MPI3MRSAS_TARGET_INREMOVAL;
 
-	if (mpi3mr_atomic_read(&target->outstanding)) {
-		mpi3mr_dprint(sc, MPI3MR_ERROR, "there are [%2d] outstanding IOs on target: %d"
-			      "Poll reply queue once\n", mpi3mr_atomic_read(&target->outstanding),
-			      target->per_id);
-		mpi3mr_poll_pend_io_completions(sc);
-		if (mpi3mr_atomic_read(&target->outstanding))
-			mpi3mr_dprint(sc, MPI3MR_ERROR, "[%2d] outstanding IOs present on target: %d"
-				      "despite poll\n", mpi3mr_atomic_read(&target->outstanding),
-				      target->per_id);
-	}
+	target_outstanding = mpi3mr_atomic_read(&target->outstanding);
+	if (target_outstanding) {
+		mpi3mr_dprint(sc, MPI3MR_ERROR, "there are [%2d] outstanding IOs on target: %d "
+			      "Poll reply queue once\n", target_outstanding, target->per_id);
+ 		mpi3mr_poll_pend_io_completions(sc);
+		target_outstanding = mpi3mr_atomic_read(&target->outstanding);
+		if (target_outstanding)
+			target_outstanding = mpi3mr_atomic_read(&target->outstanding);
+			mpi3mr_dprint(sc, MPI3MR_ERROR, "[%2d] outstanding IOs present on target: %d "
+				      "despite poll\n", target_outstanding, target->per_id);
+ 	}
 
 	if (target->exposed_to_os && !sc->reset_in_progress) {
 		mpi3mr_rescan_target(sc, target);

From nobody Thu Jun  6 13:46:04 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw5Fm52sBz5MWV6;
	Thu, 06 Jun 2024 13:46:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw5Fm4JmPz3yhq;
	Thu,  6 Jun 2024 13:46:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717681564;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=hkyh062hZ+FNdLxE48NUn+3VUujJ3ZCQcMhEY7/auFA=;
	b=DOW97OgRtaCj7E74TYXiEJQB/RxRlKzp+spHVCRgU7lqyodwvhi7wSL33HqVeoLajiCBpk
	mgObLzulQKpEq676ezb3rxXmwL70D6aP5PYnAVb0mkTGqgjV6bu19tanzWCXSkRxPfkHER
	XDUStROEUETqkEJiPn15XMQ60GcXJuJx3p6ycviJynnirwnVX4PsyxpNx52dgDQJGhrcz0
	pExVcaxS2NVWh4Z33arqeO/I23cCxLIF3I9LutTiaF62pJfZAG4QGxIK62G+ZQ27SlcfN/
	IITSP3OlxUCD52I90tWUWZRjuUIoEwpgQjKl0Nu8q8Jash3dOB2b+7nQMeRklw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717681564; a=rsa-sha256; cv=none;
	b=OlW1uzlnhwkSMXHZoPoHL1XltvIoY5cmgXvrWAt3OQOXypDe7A8vvsJM92HrMbIsjLGLva
	3n8TIQE3TDxgNq+TWVIpUfRS1bKPd4NBrPkq0o2OnFEPLoeuGBd4H3XwYeBif5u+vrKEws
	bd9ryAVXYzwwCKUe58KfPHXHnnr2RmEA9eS2Ka8Qax+NwGwpWQpVlRYBbeb+/BKM1N579K
	xf9ae/zCjMnuJzGivcxKMvOQZNHlYE72FG5qXJeFBYREwMebXkTUbdYnOeWQtI7RRmlhL0
	Js8dCQ9Omc8p2PhqdcBmDYPM6W8iiglnt56YkzoZVbWJ5NLF9E2I2yoxsjGynQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717681564;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=hkyh062hZ+FNdLxE48NUn+3VUujJ3ZCQcMhEY7/auFA=;
	b=ix9tieVyriUht+Z1dBI+ku4r3nr4DIxvn6pIrTio5QqG8IC8U6GgsMQgLBi1BOTcfXq0bW
	75qQtOfROManc9vQXUelGVkgvOKpvO52BubVnAohVRzLQA/JAk+C/99gWFdD07/kcZ9hpS
	RI9HifsY8FruNUFhP5YosXKwFOms5sSMaEe3ZGHRnGUdDlB+/RhPC4/kgNQsiBOERrIw+K
	xOwdRFFUPrJrem6hlnjorL3fB4r6LGMz5vTyPtVVc3kh9sWJ3tlmZGUByOf181+KZynHFO
	+X4IrWOp6cwdCfDc2ytxvKcaROsaQhTYJx6x21G0UuEqc6gXT+WSrHXWYZTTng==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw5Fm3w1VzpG0;
	Thu,  6 Jun 2024 13:46:04 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456Dk4em010590;
	Thu, 6 Jun 2024 13:46:04 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Dk4dL010587;
	Thu, 6 Jun 2024 13:46:04 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 13:46:04 GMT
Message-Id: <202406061346.456Dk4dL010587@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 8ca12190bf66 - main - pf: remove incorrect SUNION2PF()
  macro
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8ca12190bf66990327a11e448821d2a698978f76
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=8ca12190bf66990327a11e448821d2a698978f76

commit 8ca12190bf66990327a11e448821d2a698978f76
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-05 15:28:55 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 13:45:30 +0000

    pf: remove incorrect SUNION2PF() macro
    
    It casts in_addr to pf_addr, which is smaller, so this isn't quite right.
    Replace it with a function that will only read the actual address.
    
    Reported by:    CheriBSD
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sys/netpfil/pf/pf_table.c | 56 +++++++++++++++++++++++++++--------------------
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c
index b3e0da20422c..4d248e40443d 100644
--- a/sys/netpfil/pf/pf_table.c
+++ b/sys/netpfil/pf/pf_table.c
@@ -79,10 +79,6 @@
 		a2 = tmp;			\
 	} while (0)
 
-#define	SUNION2PF(su, af) (((af)==AF_INET) ?	\
-    (struct pf_addr *)&(su)->sin.sin_addr :	\
-    (struct pf_addr *)&(su)->sin6.sin6_addr)
-
 #define	AF_BITS(af)		(((af)==AF_INET)?32:128)
 #define	ADDR_NETWORK(ad)	((ad)->pfra_net < AF_BITS((ad)->pfra_af))
 #define	KENTRY_NETWORK(ke)	((ke)->pfrke_net < AF_BITS((ke)->pfrke_af))
@@ -1044,6 +1040,21 @@ pfr_copyout_astats(struct pfr_astats *as, const struct pfr_kentry *ke,
 	}
 }
 
+static void
+pfr_sockaddr_to_pf_addr(const union sockaddr_union *sa, struct pf_addr *a)
+{
+	switch (sa->sa.sa_family) {
+	case AF_INET:
+		memcpy(&a->v4, &sa->sin.sin_addr, sizeof(a->v4));
+		break;
+	case AF_INET6:
+		memcpy(&a->v6, &sa->sin6.sin6_addr, sizeof(a->v6));
+		break;
+	default:
+		panic("Unknown AF");
+	}
+}
+
 static int
 pfr_walktree(struct radix_node *rn, void *arg)
 {
@@ -1094,18 +1105,14 @@ pfr_walktree(struct radix_node *rn, void *arg)
 			if (w->pfrw_dyn->pfid_acnt4++ > 0)
 				break;
 			pfr_prepare_network(&pfr_mask, AF_INET, ke->pfrke_net);
-			w->pfrw_dyn->pfid_addr4 = *SUNION2PF(&ke->pfrke_sa,
-			    AF_INET);
-			w->pfrw_dyn->pfid_mask4 = *SUNION2PF(&pfr_mask,
-			    AF_INET);
+			pfr_sockaddr_to_pf_addr(&ke->pfrke_sa, &w->pfrw_dyn->pfid_addr4);
+			pfr_sockaddr_to_pf_addr(&pfr_mask, &w->pfrw_dyn->pfid_mask4);
 		} else if (ke->pfrke_af == AF_INET6){
 			if (w->pfrw_dyn->pfid_acnt6++ > 0)
 				break;
 			pfr_prepare_network(&pfr_mask, AF_INET6, ke->pfrke_net);
-			w->pfrw_dyn->pfid_addr6 = *SUNION2PF(&ke->pfrke_sa,
-			    AF_INET6);
-			w->pfrw_dyn->pfid_mask6 = *SUNION2PF(&pfr_mask,
-			    AF_INET6);
+			pfr_sockaddr_to_pf_addr(&ke->pfrke_sa, &w->pfrw_dyn->pfid_addr6);
+			pfr_sockaddr_to_pf_addr(&pfr_mask, &w->pfrw_dyn->pfid_mask6);
 		}
 		break;
 	    }
@@ -2235,7 +2242,7 @@ int
 pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
     sa_family_t af)
 {
-	struct pf_addr		 *addr, *cur, *mask;
+	struct pf_addr		 addr, cur, mask, umask_addr;
 	union sockaddr_union	 uaddr, umask;
 	struct pfr_kentry	*ke, *ke2 = NULL;
 	int			 idx = -1, use_counter = 0;
@@ -2253,7 +2260,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
 		uaddr.sin6.sin6_family = AF_INET6;
 		break;
 	}
-	addr = SUNION2PF(&uaddr, af);
+	pfr_sockaddr_to_pf_addr(&uaddr, &addr);
 
 	if (!(kt->pfrkt_flags & PFR_TFLAG_ACTIVE) && kt->pfrkt_root != NULL)
 		kt = kt->pfrkt_root;
@@ -2273,26 +2280,26 @@ _next_block:
 		return (1);
 	}
 	pfr_prepare_network(&umask, af, ke->pfrke_net);
-	cur = SUNION2PF(&ke->pfrke_sa, af);
-	mask = SUNION2PF(&umask, af);
+	pfr_sockaddr_to_pf_addr(&ke->pfrke_sa, &cur);
+	pfr_sockaddr_to_pf_addr(&umask, &mask);
 
 	if (use_counter) {
 		/* is supplied address within block? */
-		if (!PF_MATCHA(0, cur, mask, counter, af)) {
+		if (!PF_MATCHA(0, &cur, &mask, counter, af)) {
 			/* no, go to next block in table */
 			idx++;
 			use_counter = 0;
 			goto _next_block;
 		}
-		PF_ACPY(addr, counter, af);
+		PF_ACPY(&addr, counter, af);
 	} else {
 		/* use first address of block */
-		PF_ACPY(addr, cur, af);
+		PF_ACPY(&addr, &cur, af);
 	}
 
 	if (!KENTRY_NETWORK(ke)) {
 		/* this is a single IP address - no possible nested block */
-		PF_ACPY(counter, addr, af);
+		PF_ACPY(counter, &addr, af);
 		*pidx = idx;
 		pfr_kstate_counter_add(&kt->pfrkt_match, 1);
 		return (0);
@@ -2312,7 +2319,7 @@ _next_block:
 		/* no need to check KENTRY_RNF_ROOT() here */
 		if (ke2 == ke) {
 			/* lookup return the same block - perfect */
-			PF_ACPY(counter, addr, af);
+			PF_ACPY(counter, &addr, af);
 			*pidx = idx;
 			pfr_kstate_counter_add(&kt->pfrkt_match, 1);
 			return (0);
@@ -2320,9 +2327,10 @@ _next_block:
 
 		/* we need to increase the counter past the nested block */
 		pfr_prepare_network(&umask, AF_INET, ke2->pfrke_net);
-		PF_POOLMASK(addr, addr, SUNION2PF(&umask, af), &pfr_ffaddr, af);
-		PF_AINC(addr, af);
-		if (!PF_MATCHA(0, cur, mask, addr, af)) {
+		pfr_sockaddr_to_pf_addr(&umask, &umask_addr);
+		PF_POOLMASK(&addr, &addr, &umask_addr, &pfr_ffaddr, af);
+		PF_AINC(&addr, af);
+		if (!PF_MATCHA(0, &cur, &mask, &addr, af)) {
 			/* ok, we reached the end of our main block */
 			/* go to next block in table */
 			idx++;

From nobody Thu Jun  6 13:46:05 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw5Fn5WPtz5MWKl;
	Thu, 06 Jun 2024 13:46:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw5Fn503Yz3yfn;
	Thu,  6 Jun 2024 13:46:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717681565;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=NvYHT2NvLjxpfxmXQFI7gSvSk1K68Jkrax/VPab4Ks8=;
	b=be1za+o705GMDKb377OfVE1kTIzZ3L8cDPsxEc0CVfN3jdjbCu9FLu/tBEcjD0fYl57qnb
	uTZrDN82VS8IJRmw2dfjWqfcbLTQlOytvkLp43RWVJ9iCJ43Gvi2tOg14wFknKtXeZuKkc
	GsgJEGkVZn45mYqWtiwhwjbsBJcTyaQ1WNpmU9MEtp7/fYWxX1Ln6pbyRZtVRRuOHV3Xv1
	HIVVNK8BaaNHtVyPYETh/qeUcD8iIfzenxhl6LtcH3ftvUNYTtDyDE1O/TFg56kmPcgtsk
	jKCRQORLbsRU4KwZ0gI/VPRgNBaf0vfLx9lRECuMP1fRCGyGRyBo2eWstYVFrw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717681565; a=rsa-sha256; cv=none;
	b=xGMOp+ZlpIFOe3BcfsnM0WkqD59bJtTDeT+r0v6UCHEhXOFLx77+mollZMP7hz+WYltTY5
	NRSH8PaZ3aKMV2eDkYrXbL7vielYfGPTUhF89p/wmYW3nXFhKcXCHUoiL7MCI11pfzLQ6Y
	IP/AmK5WWL0zeRYrv6zHxDriOJZcpbiQpuROikcsjt/69PwMWMcJtga1LiyoqM1r6+fmPv
	bv63Jq40Z04SRv5ofmEHhMwKXWEBSnxrx5h4Ts2B56wfsl+TA0WvBFxdszMXiQUNjXgA5+
	i8Ta039f75liDYGhAvXJ2yVe5c/0jH75URXPRTt7SClWke8rBAjpfFKxtrk/wA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717681565;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=NvYHT2NvLjxpfxmXQFI7gSvSk1K68Jkrax/VPab4Ks8=;
	b=pxVQ5i3LJJ9yaCvtKoqbU0nBKGExoFzMFu2uD7kb5f23eGtFcRDIrJoaO8/IwiiAPtTQ1y
	cKTgW5YelMXLVMsbhR6uyA6qRAyKlfNYseqb1PWZFuQHlXfMI6ni8TIqttUCnIbwv12uzh
	s+lvvtrQUJxz5ONw5NIFccwvBi2zRQISYuXxvk3mnGkToNPmelu6HWFmPV2fRdmESVNUs5
	k+Ld5LGCtwxi/+LSesBGO+sWyW7+YDvKAorkOzdtoQQHrkMWY9BEKKlQ4gwSJ6NjY3EePh
	/m6T+9q/gchMKtYkB1RbKvDhHNJatNYP1ZbxhRj706cNNMv/8KVQ9U0DhNiF9Q==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw5Fn4cTzznn6;
	Thu,  6 Jun 2024 13:46:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456Dk5I7010644;
	Thu, 6 Jun 2024 13:46:05 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Dk5LO010641;
	Thu, 6 Jun 2024 13:46:05 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 13:46:05 GMT
Message-Id: <202406061346.456Dk5LO010641@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: f0829825fb9d - main - netlink: pass the correct
  arguments for SIOCDIFADDR and SIOCDIFADDR_IN6
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: f0829825fb9dee5381d3b5f52f66d5e9384240e7
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=f0829825fb9dee5381d3b5f52f66d5e9384240e7

commit f0829825fb9dee5381d3b5f52f66d5e9384240e7
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-05 17:44:46 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 13:45:30 +0000

    netlink: pass the correct arguments for SIOCDIFADDR and SIOCDIFADDR_IN6
    
    These take struct ifreq and struct in6_ifreq respectively. Passing struct
    in_aliasreq or struct in6_aliasreq means we're supplying a shorter object than
    expected. While this doesn't actively break things on most architectures other
    than CHERI it is still wrong.
    
    Reported by:    CheriBSD
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sys/netlink/route/iface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c
index 19da6aea5f31..81db54ab12d4 100644
--- a/sys/netlink/route/iface.c
+++ b/sys/netlink/route/iface.c
@@ -1204,7 +1204,7 @@ handle_deladdr_inet(struct nlmsghdr *hdr, struct nl_parsed_ifa *attrs,
 		return (EINVAL);
 	}
 
-	struct in_aliasreq req = { .ifra_addr = *addr };
+	struct ifreq req = { .ifr_addr = *(struct sockaddr *)addr };
 
 	return (in_control_ioctl(SIOCDIFADDR, &req, ifp, nlp_get_cred(nlp)));
 }
@@ -1288,7 +1288,7 @@ handle_deladdr_inet6(struct nlmsghdr *hdr, struct nl_parsed_ifa *attrs,
 		return (EINVAL);
 	}
 
-	struct in6_aliasreq req = { .ifra_addr = *addr };
+	struct in6_ifreq req = { .ifr_addr = *addr };
 
 	return (in6_control_ioctl(SIOCDIFADDR_IN6, &req, ifp, nlp_get_cred(nlp)));
 }

From nobody Thu Jun  6 13:46:06 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw5Fq1TDYz5MWPb;
	Thu, 06 Jun 2024 13:46:07 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw5Fp6nvFz3ymt;
	Thu,  6 Jun 2024 13:46:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717681566;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=45KPbi768ArqAukx0T6XkB+ss1509BnBCx3HtzxEFaI=;
	b=A53Z+Ezmyx3DBkhmcafTFJBTSTHa/WN1/olycHxNArFUGL+JoR5URAo4LbcLvYaselwO/A
	5rmBeV268g5oPZ4HAJiweUqqMCxMxS5IsLLqq0KgNUW6VAKG8+9nZuTBA7ErZ4jdjAdfpv
	863fErdt5KzscSYGVsKVyW7YxTSNWgW1awIBeEs1hbQL+qIk6Xjme8AC+U4OFm7OV2yI9b
	84lBhslz7VuLnxj44twKt80OIBAjLSOJMmE56VLzoLeyyIRgupWY9SrRECMtdWCH//zUAv
	WSWTZwyQ+9HQy795UF8nOFaLfrgBUAjCbaOhMFWjoGZhwJH+SyHSQah3H3EXfg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717681567; a=rsa-sha256; cv=none;
	b=mRH0AsWIVvrEDlt3c7QWjS+j5XXChzACJGF56X+kyv6KGzUm2uFokRfF3+iZeh8R2ky+O/
	SWkAr2ZntBymUvYXekfq5VCctE9uMXeAYUKeUOwKgyxgb/+ixn4XK8SboiT+MR3PULLEn6
	M5M8PNa6K/b7jMisbJZ8+5XIH5ncPw3rfCQ7qkAFm/EERM2ZmgOHci7SWzRe0vKZge/ATA
	Qkv1g8DHCQ6OQBp6GMpC7unaQ0zb20iuSZ9fA1ZyiVVGSjoGN5ZxIeCsQwMnGSAWHDgPOf
	KkRrylU0ys5EoWRSCYX6hZvuusbKMAEuaWS/tvi0Ae76Omr8H8JONT2XMt4thA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717681567;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=45KPbi768ArqAukx0T6XkB+ss1509BnBCx3HtzxEFaI=;
	b=paoVw0T8FSj6iIknK2k82X7L2pwFdOBXq/vU9SsccVJgmftG4S7b+vqMfVT596BkHthogv
	JQiDp2FnuRSugQbCEJZnkxSd8VRUHYtAt1moM0yWZkvy0WpfxPScufPbLPm5MBvBo8+baU
	9NAta/B/CUujYlYquzP+QZ3NT81dod1Eh0sJmqhabPOSNTiQFYR82i5bg6rFhVF4kqj7TX
	wXukfpM8Xd2IHfkaCh3u0MRgNIKb8ZQGxTNN7zZ03EXmaboJzxvlyIKPGyKjRVxk0yaqly
	pbJPr8dPbXsR7+GcrXL1TrnR0t2esQSDSFr82F/Z+Ep9eU+JxQZw8c1WbwI0CQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw5Fp5zLTzp5P;
	Thu,  6 Jun 2024 13:46:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456Dk6r0010686;
	Thu, 6 Jun 2024 13:46:06 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Dk60k010683;
	Thu, 6 Jun 2024 13:46:06 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 13:46:06 GMT
Message-Id: <202406061346.456Dk60k010683@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 8f04209d37ec - main - pf: simplify pf_addrcpy() and
  pf_match_addr()
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8f04209d37ec14e28aaeb14a7a020dac9fb4983b
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=8f04209d37ec14e28aaeb14a7a020dac9fb4983b

commit 8f04209d37ec14e28aaeb14a7a020dac9fb4983b
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-05 20:30:34 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 13:45:31 +0000

    pf: simplify pf_addrcpy() and pf_match_addr()
    
    Use the v4/v6 union members rather than the uint32_t ones.
    Export IN_ARE_MASKED_ADDR_EQUAL() in in_var.h and use it (and its IPv6
    equivalent) for masked comparisons rather than hand-rolled code.
    
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sys/netinet/in.c     |  3 ---
 sys/netinet/in_var.h |  5 +++++
 sys/netpfil/pf/pf.c  | 19 ++++---------------
 3 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 940b197d9e95..cc2f37863ea1 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1473,9 +1473,6 @@ in_lltable_new(struct in_addr addr4, u_int flags)
 	return (&lle->base);
 }
 
-#define IN_ARE_MASKED_ADDR_EQUAL(d, a, m)	(		\
-	((((d).s_addr ^ (a).s_addr) & (m).s_addr)) == 0 )
-
 static int
 in_lltable_match_prefix(const struct sockaddr *saddr,
     const struct sockaddr *smask, u_int flags, struct llentry *lle)
diff --git a/sys/netinet/in_var.h b/sys/netinet/in_var.h
index 09d3cd050fc3..b4bdb2a65fc8 100644
--- a/sys/netinet/in_var.h
+++ b/sys/netinet/in_var.h
@@ -97,6 +97,11 @@ struct in_ifaddr {
 #define IN_LNAOF(in, ifa) \
 	((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
 
+#ifdef _KERNEL
+#define IN_ARE_MASKED_ADDR_EQUAL(d, a, m)	(		\
+	((((d).s_addr ^ (a).s_addr) & (m).s_addr)) == 0 )
+#endif
+
 #define LLTABLE(ifp)	\
 	((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt
 /*
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 195b5d49db7a..064642d7da05 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -723,14 +723,11 @@ pf_addrcpy(struct pf_addr *dst, struct pf_addr *src, sa_family_t af)
 	switch (af) {
 #ifdef INET
 	case AF_INET:
-		dst->addr32[0] = src->addr32[0];
+		memcpy(&dst->v4, &src->v4, sizeof(dst->v4));
 		break;
 #endif /* INET */
 	case AF_INET6:
-		dst->addr32[0] = src->addr32[0];
-		dst->addr32[1] = src->addr32[1];
-		dst->addr32[2] = src->addr32[2];
-		dst->addr32[3] = src->addr32[3];
+		memcpy(&dst->v6, &src->v6, sizeof(dst->v6));
 		break;
 	}
 }
@@ -3408,21 +3405,13 @@ pf_match_addr(u_int8_t n, struct pf_addr *a, struct pf_addr *m,
 	switch (af) {
 #ifdef INET
 	case AF_INET:
-		if ((a->addr32[0] & m->addr32[0]) ==
-		    (b->addr32[0] & m->addr32[0]))
+		if (IN_ARE_MASKED_ADDR_EQUAL(a->v4, b->v4, m->v4))
 			match++;
 		break;
 #endif /* INET */
 #ifdef INET6
 	case AF_INET6:
-		if (((a->addr32[0] & m->addr32[0]) ==
-		     (b->addr32[0] & m->addr32[0])) &&
-		    ((a->addr32[1] & m->addr32[1]) ==
-		     (b->addr32[1] & m->addr32[1])) &&
-		    ((a->addr32[2] & m->addr32[2]) ==
-		     (b->addr32[2] & m->addr32[2])) &&
-		    ((a->addr32[3] & m->addr32[3]) ==
-		     (b->addr32[3] & m->addr32[3])))
+		if (IN6_ARE_MASKED_ADDR_EQUAL(&a->v6, &b->v6, &m->v6))
 			match++;
 		break;
 #endif /* INET6 */

From nobody Thu Jun  6 13:46:07 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw5Fr130Gz5MWVB;
	Thu, 06 Jun 2024 13:46:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw5Fr0HMMz3yfy;
	Thu,  6 Jun 2024 13:46:08 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717681568;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=YyNaBR60aF+ImaYv4p+HqWJZrwffFhBXjXe6MiTtFAM=;
	b=btFkNOp6I0qPOo1fLL86e1So+RisbZjO+uqGdRw0vBNRw8pmyvD1BDcIHBbLLnIR0k57fY
	MdKFn8I/3MPhFPzHJQbjc60FFt2NNdaffC5ewGXjiSBkRlpu1/HzAE1sbk8TKJfgSehrEL
	gcWtgqKMyNa6DXZM4EEugTLzJ1KVBdhahbpaM+NaLVDq4cdvMgHGwbUAx1WBPT+sfXx6Bf
	j5N5EJAY1W+H0omuSWruO5DhxR4VUQ2JmWURm/LzwFOLxQ9lhZLYKFjSryVMQduv6EbbVq
	vtOd6nSCReR/gmcKaOkWwtWW99ZxOhgw4fDCg8s1muqyYgBzjIfFy0OpLFeZpQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717681568; a=rsa-sha256; cv=none;
	b=nKVeqCJOGHmttf6lTOomdo00rnijG8oCw/DOKSLeNZ92k+k9AFf9zrVjw9Z9KeJxTw7o1o
	b7zXKJZBsDDpvgJXZqR8gxCniAJorMT5liX34jheIIhbvTGdH33xoL2O0qSGc9fgzS+2Y7
	QT0hijAWUN8uPKMCb/E17fiNrp59PyR5bIF8Dbx0SFCjnfPqUCv+DUv56KWEB52cKPWev0
	M1TOBKYqi/XEKJFiEvs5nyecLMy0iWt4zFZOeiBHoMj97B2xdulonSd+pliuwzXJW/OZpO
	Rg/mrX3IaclrpZy11/Bm61Crxbr9juovMO3TONcGk/CC3GqdKEHXfW9FQ1gdEQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717681568;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=YyNaBR60aF+ImaYv4p+HqWJZrwffFhBXjXe6MiTtFAM=;
	b=gePB+5cu5QbMdEEuxcyQCG6/K30mRsKFNjbTbPDuGrUJeUkwwXrV6nTSPRweU6r3Ja6q/k
	4zcfVmnOYxjwqtR5ZJ1V0FJ35JS/0LlCoM8Pjo1EbGLM6i5dc2LBREzJEfqHnqzXhQAT1g
	A2MJZlyOH8Hlaisai5Iflp1rphDvxS3/tCKceir4CzcitJosVcwPTfNHsuRhIq/hkmcIC/
	yKLYh9jcaB2EVtUc/Lzo3NWKuCjAvf8lhZJfw06Z02SBXYCOngg5G0Wwp8nAqRUKe/Tm2T
	QG85S1KBBCnXFbkUFtMutkGVYHKQTTDrisiHnSEirZ8F5GjjP7ETY62jF8WADw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw5Fq71V1zpDt;
	Thu,  6 Jun 2024 13:46:07 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456Dk719010728;
	Thu, 6 Jun 2024 13:46:07 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Dk7A5010725;
	Thu, 6 Jun 2024 13:46:07 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 13:46:07 GMT
Message-Id: <202406061346.456Dk7A5010725@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: dc3ee89c86d3 - main - pfctl: fix possible out-of-bounds
  read
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: dc3ee89c86d30cc7a14dce9550bbd4d37c7ff182
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=dc3ee89c86d30cc7a14dce9550bbd4d37c7ff182

commit dc3ee89c86d30cc7a14dce9550bbd4d37c7ff182
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-05 21:55:37 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 13:45:31 +0000

    pfctl: fix possible out-of-bounds read
    
    Tags in $10 (filter_opts) are not guaranteed to be the maximum possible
    tag length, so memcpy() can end up reading outside of the allocated
    buffer.
    
    Use strlcpy() instead.
    
    Reported by:    CheriBSD
    Event:          Kitchener-Waterloo Hackathon 202406
---
 sbin/pfctl/parse.y | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 92e6e36f3b23..19e029c881d1 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1230,7 +1230,7 @@ etherrule	: ETHER action dir quick interface bridge etherproto etherfromto l3fro
 			r.direction = $3;
 			r.quick = $4.quick;
 			if ($10.tag != NULL)
-				memcpy(&r.tagname, $10.tag, sizeof(r.tagname));
+				strlcpy(r.tagname, $10.tag, sizeof(r.tagname));
 			if ($10.match_tag)
 				if (strlcpy(r.match_tagname, $10.match_tag,
 				    PF_TAG_NAME_SIZE) >= PF_TAG_NAME_SIZE) {
@@ -1240,7 +1240,7 @@ etherrule	: ETHER action dir quick interface bridge etherproto etherfromto l3fro
 				}
 			r.match_tag_not = $10.match_tag_not;
 			if ($10.queues.qname != NULL)
-				memcpy(&r.qname, $10.queues.qname, sizeof(r.qname));
+				strlcpy(r.qname, $10.queues.qname, sizeof(r.qname));
 			r.dnpipe = $10.dnpipe;
 			r.dnflags = $10.free_flags;
 			if (eth_rule_label(&r, $10.label))

From nobody Thu Jun  6 14:10:03 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw5nR4MsTz5MZYh;
	Thu, 06 Jun 2024 14:10:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw5nR3LR4z44PN;
	Thu,  6 Jun 2024 14:10:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717683003;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=50ejHChO1pVdq/EYRQ55aXSKbB9basW6R3eJY/YBpfY=;
	b=tsc8bEswVt5SZlq2Az5gdaI0X6zrZCHxYeD8tiVOzmHb594YynJTUv7gXsyxNlRxFP/Pil
	4nHei2TIwlEEdd/RLSC7/PRz+rIpLRJGIHbIDDXk6X5XfSL9F7H0jceMElTpRNXmVBmFSh
	iIhHeJvbdUE9UsZtEkOZrV5ypDlLbqerbDSBymn1YQNS0KXk/Xc8rBAEAdpDn5v6d8qbvW
	eOw2EYubw5k0mRDBcmCThsXnnICnKvXwIC3QZP+1vhrpE8QVTJIX2hGV3XYDpS4Ce44cyF
	vid+Tjpou/khmFGqI8QBRB/0vYGPDP7bFQkQbZNsotzk5Gq7UWXMH0QmNcwB8A==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717683003; a=rsa-sha256; cv=none;
	b=r/qBBKH7drVOoIQPodoJD48xvth+4gwOzcR6yI3gDu5h1e3HnhIlPPeY3LkfZROVdMDUDW
	6eWiAknvsjoVrZ0n+cIIdc8HgMtoyB2iU5eDrr/kIOUh1wyITPbi7gjl1gMlhD1okERNPw
	kirgHr8tI7hadq1PX6otpHtd7iF6z6gHxUTmvgfSfLb3y49mnlkkQV3Z9XyS6q6yk3UrOQ
	G3rpJjG0f2OOTZi9lvTmlfBdCYNNkcTCSzTIvz1bis6/5EsFZmGinE6GTLBH9kq22YWmXN
	bmRBRa/CTIZxBNcQMGPEBocw2PKLmKfM9XS9lw87fhmAMGPO4IjQFPXlwwY5xg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717683003;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=50ejHChO1pVdq/EYRQ55aXSKbB9basW6R3eJY/YBpfY=;
	b=lZBfYGDBBY+/KR+JnUjVJJXhs3mL2/OA8jilZxYY7Bo8BIrfkwYizQEhiEmHxdCU+GeWKf
	6JRaiCl1cz5V1yehXDB98sbcl70cInPhe5O5mpyFghDIaRw/t6IlPQri92uK/YxT9haRWh
	7n2lKXNZCtmo5jiwj755l1QWvZCujdtFhHRPMKR+SQg3HYdhUQgeRCoHiOla5+T/8cMO9/
	BEgYGmMSdcoG7LB4nCvr6m06YXt7zgOvPMYkvYvsKS4qkeJff2I5plZL/MwrMdNY/Qpb5w
	d7hb8hnF36tCVaibW6VsHX5uV164mXIRge1VuwJ76WUa0PbxAUM+EPf/QBSRlQ==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw5nR2xf9zpj4;
	Thu,  6 Jun 2024 14:10:03 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456EA3Ok047919;
	Thu, 6 Jun 2024 14:10:03 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456EA3q7047914;
	Thu, 6 Jun 2024 14:10:03 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 14:10:03 GMT
Message-Id: <202406061410.456EA3q7047914@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ed Maste <emaste@FreeBSD.org>
Subject: git: 230efeda080f - main - libusbhid: add missing include
  guards
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: emaste
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 230efeda080f09bc282f50a7a4cfc337fd7c6d0d
Auto-Submitted: auto-generated

The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=230efeda080f09bc282f50a7a4cfc337fd7c6d0d

commit 230efeda080f09bc282f50a7a4cfc337fd7c6d0d
Author:     Andreas Kempe <kempe@lysator.liu.se>
AuthorDate: 2022-07-10 20:51:48 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-06-06 14:09:05 +0000

    libusbhid: add missing include guards
    
    PR:             265136
---
 lib/libusbhid/usbhid.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/libusbhid/usbhid.h b/lib/libusbhid/usbhid.h
index 15d4f1613746..637fb3d846f7 100644
--- a/lib/libusbhid/usbhid.h
+++ b/lib/libusbhid/usbhid.h
@@ -29,6 +29,9 @@
  *
  */
 
+#ifndef _USBHID_H_
+#define _USBHID_H_
+
 #include <stdint.h>
 
 typedef struct report_desc *report_desc_t;
@@ -111,3 +114,5 @@ int hid_set_report(int fd, enum hid_kind k,
     unsigned char *data, unsigned int size);
 
 __END_DECLS
+
+#endif /* !_USBHID_H_ */

From nobody Thu Jun  6 15:06:29 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw72Y2Cghz5MvDY;
	Thu, 06 Jun 2024 15:06:29 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw72Y1kpkz4JYQ;
	Thu,  6 Jun 2024 15:06:29 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717686389;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=UKdikO3KFmm7prUJZEWYI7vo5e9646GLnorpjLUREbM=;
	b=OkquqCLiCXy1/FKgE+rN4cHBZzAm5yU+Ebgx+TenbYN3RIqncqb5xxgUuEX5RMePve2W6y
	pxn+UPWIYbk0eueUUWidMlD0J/S3cfT2+G2EKl8He14BV/V+nIVgJ8D2mQYDQatIXK5PvT
	PMEgUt4G1vupLNCZqBLKOm2qpHSMc0owtL0c9Y76B1EZE6RqqXnBg8pWoReeVJlbHOuOi6
	Uqa57L+r7+1zPe9q1rcfaPseFEsaEo5q7dR3SZKR+5FlwA7dtZ4AvkeSNR+yjhuvAjL+uK
	jAs4I4OUfwb4ZScg+2GnZgdN60Blu3uydlbCg72AHlx0xlBFkbR7K8WLZ5TC5w==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717686389; a=rsa-sha256; cv=none;
	b=WOnG/4hnCyRFcrT3izJnRQdRtdWukBzNLLk3GnAbI2fuIZRbQgMmVVEH8kLmh+W7iBm9By
	JQLeDmX9kcW3RwjvglOKilvlX1g0DG6vZvyIrRmddvhBIjO+3Dbm3VPZrpWiVE+Yqg94v0
	cyQ26vEefx1XeR2ahuyM/Cr48GrXHtI4CdAGwkyNJW0Rm9awLbm+1DOkFJfnZK0SK/mS8R
	HKGDy9RPM1qfCYNh/DCLWu5OunS46oa01t16LN++/HKnRwJyRUQFW4XYaaiqK0qufYp/mA
	Xxu4B0eLVRilVAZaZxwPIN80JkBZoTDr9vSo+vkG4f/Lttqm0ev4IG6An4AT8Q==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717686389;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=UKdikO3KFmm7prUJZEWYI7vo5e9646GLnorpjLUREbM=;
	b=FmDob3e0nUCanoRYLooSY7934XgzJvUgm6xW4rQob0ftF8afh0BJOW9v6MWDFhKNv5y9Yb
	Viq3+rlFliQq4WfVD9GIea8n4x7KTnME0+d7SQ2FV9D8xolnPtWaEp9sqYT3ZUa6HAWBdb
	awCjkOoyjjOFP7b70uzM0HJOG43SQjtuPcCmnKZqitVgprsic8QwGKIfAW1hW1JI808BlP
	dgefeaMRA9+XiF7EVzk50t3WYc6QZIjaEv2++vooYDyysZMIgwO5HY4tML92XpPrbyI0a2
	pmE3hG36UEmNZDW0Z/xb78ue/62Usd7DfIcp5iyiAFvcX/UtJFJe6NHdKy9g9Q==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw72Y1Kc8zrFl;
	Thu,  6 Jun 2024 15:06:29 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456F6Tov048342;
	Thu, 6 Jun 2024 15:06:29 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456F6TiT048339;
	Thu, 6 Jun 2024 15:06:29 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 15:06:29 GMT
Message-Id: <202406061506.456F6TiT048339@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: b5b90ff9844d - main - u3g: Add support for SIM7600G
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: b5b90ff9844d1cb780ff777fc42ad393e4683563
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=b5b90ff9844d1cb780ff777fc42ad393e4683563

commit b5b90ff9844d1cb780ff777fc42ad393e4683563
Author:     Maxime Thiebaut <maxime+freebsd@thiebaut.dev>
AuthorDate: 2024-06-06 10:43:46 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 15:02:15 +0000

    u3g: Add support for SIM7600G
    
    Signed-off-by:  Maxime Thiebaut <maxime+freebsd@thiebaut.dev>
    Reviewed by:    kp
---
 sys/dev/usb/serial/u3g.c | 1 +
 sys/dev/usb/usbdevs      | 1 +
 2 files changed, 2 insertions(+)

diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c
index e0a1ff29b0a4..88f94ddaecc6 100644
--- a/sys/dev/usb/serial/u3g.c
+++ b/sys/dev/usb/serial/u3g.c
@@ -205,6 +205,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = {
 	U3G_DEV(ALINK, 3GU, 0),
 	U3G_DEV(ALINK, DWM652U5, 0),
 	U3G_DEV(ALINK, SIM7600E, 0),
+	U3G_DEV(ALINK, SIM7600G, 0),
 	U3G_DEV(AMOI, H01, 0),
 	U3G_DEV(AMOI, H01A, 0),
 	U3G_DEV(AMOI, H02, 0),
diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs
index 4bb24e01c97c..ea011f54b075 100644
--- a/sys/dev/usb/usbdevs
+++ b/sys/dev/usb/usbdevs
@@ -1064,6 +1064,7 @@ product ALCOR AU6390	0x6390	AU6390 USB-IDE converter
 product ALINK DWM652U5		0xce16	DWM-652
 product ALINK 3G		0x9000	3G modem
 product ALINK SIM7600E		0x9001	LTE modem
+product ALINK SIM7600G		0x9011	LTE modem
 product ALINK 3GU		0x9200	3G modem
 
 /* Altec Lansing products */

From nobody Thu Jun  6 17:06:42 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw9jG1mdGz5NGrn;
	Thu, 06 Jun 2024 17:06:42 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw9jG1G0Mz4JjY;
	Thu,  6 Jun 2024 17:06:42 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717693602;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=bBItNZ6x3ihBbJRqYY5PfklwYCBm/Xgb93zUPlml3ts=;
	b=rL+vGyEHN8evka99s4aE5Upg8FRuay+PluV2QowUFLEy2oajC+IT5+/BPJQDQD33gV16qh
	WNLY3TsnCqjFO2JP9lFuuJ94EEi1mIx99CNPbeo1TuIquyr0IlM/uKduJwDE0Xo8roRHVJ
	SwLjHPUj6Hb+KBMeojth6IYczPIWd+29d4x7HBs4MRibwlry4v6kLYQuCqKKGnf4adeAWs
	o6lc7hjQSa6qCgPB6zSPX6HJt2mMG51O0QpCBg9gLA3vmIhIxHzr5CdZAqc7EhKjtrFIQy
	ILr7pFB3Io1MYIQ9CT20Y2KquRjwLdnXLzjotgsLuEd/lwJG8TuhGHHLL0f7fQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717693602; a=rsa-sha256; cv=none;
	b=XZoofyZzV/wiA+cdj0hcub3PqigrdPKKTKOkMz8RmKyFIqVTrfNywDFOVS9ukBXxqB08X3
	DqntsSTWhHhl9vfRZNrR4dBNaGSFwU/Us2gJsOogmUCEJgCutsiQHZ/JkrhGmgDGG5+nEp
	BwWuY5n/ivjvXQEOyyXZLJd+GTH698LlUTVKRmv/Zz21Vyy45MaJbJUKb6Yu8JNigI3tWN
	ucioZp7DG5pZluoTvF6z3x7Zx2iB7+lt//ftFuzj4KDQeAO5N2vexRlDpVaTRgKfx31/Jx
	mFzPoq68nTtQEo3HnmIQAxH20jggolgT/JsImYHB++sO+qS1QeSzX+sidT0Xzg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717693602;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=bBItNZ6x3ihBbJRqYY5PfklwYCBm/Xgb93zUPlml3ts=;
	b=pIsHqRAYi7lbHwiIoBjczSGVchoaVLsiK/F8ohUogjZiLbWK843t1zX2yRvqnnEjSYoFq1
	DLFzPYj+QufTflYaWl9TDFk/VGRT5uBAHuG2crYZBOhcszkK41adJQe1PV/WVkYf3nRkdR
	fPsuMuCei4yNCYu9XCMsGH6spcCa0N2eL4rgsISp3qNEm2xW1pbPPcqt6PM1s1XHSALO7w
	0H+Y0hjKIvrlsTJ5Y8KWslLYt2bhbu9LQBjyMNkf7qRHObhJeSlEAl5Vv7kU+7I4xrPVOs
	kGBUZRnKlNXChyDDfOEYBoHCYCCkl9EulJax9HwnI7UO3hq1EVcmS2vegwxn7Q==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw9jG0nJ8zvJ5;
	Thu,  6 Jun 2024 17:06:42 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456H6gHF073613;
	Thu, 6 Jun 2024 17:06:42 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456H6gJq073610;
	Thu, 6 Jun 2024 17:06:42 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 17:06:42 GMT
Message-Id: <202406061706.456H6gJq073610@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Allan Jude <allanjude@FreeBSD.org>
Subject: git: 63f5c101a1fd - main - comm: flush stdout for error
  checking prior to exiting
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: allanjude
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 63f5c101a1fdf4e8b94c5d76afcd6cbf0b2c79da
Auto-Submitted: auto-generated

The branch main has been updated by allanjude:

URL: https://cgit.FreeBSD.org/src/commit/?id=63f5c101a1fdf4e8b94c5d76afcd6cbf0b2c79da

commit 63f5c101a1fdf4e8b94c5d76afcd6cbf0b2c79da
Author:     Cosimo Cecchi <cosimo@apple.com>
AuthorDate: 2024-06-06 16:51:22 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2024-06-06 17:04:37 +0000

    comm: flush stdout for error checking prior to exiting
    
    UNIX conformance wants utilities to catch any errors when doing I/O, as
    opposed to relying on the implicit flush upon exit.
    comm currently does not do that.
    This commit adds handling of I/O errors on stdout prior to exit.
    
    Reviewed by:    imp, allanjude
    Sponsored by:   Apple Inc.
    Differential Revision:  https://reviews.freebsd.org/D45439
---
 usr.bin/comm/comm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c
index b8fb10ccddb4..2f305e23ce8f 100644
--- a/usr.bin/comm/comm.c
+++ b/usr.bin/comm/comm.c
@@ -172,6 +172,8 @@ main(int argc, char *argv[])
 				(void)printf("%s%s\n", col2, line2);
 		}
 	}
+	if (ferror(stdout) != 0 || fflush(stdout) != 0)
+		err(1, "stdout");
 	exit(0);
 }
 

From nobody Thu Jun  6 17:06:43 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vw9jH4StXz5NH7R;
	Thu, 06 Jun 2024 17:06:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Vw9jH2RZmz4JrW;
	Thu,  6 Jun 2024 17:06:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717693603;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=yyx1Xr4E/Nb52sjPs2TF3tYGNJebheY+QfHu79IrJxI=;
	b=h7qnxDYYoSOBWXOBNa1TmeNBcqKIsE3mXEMnW046T6nWvWoTU/rxKVI3DpfxrGMxcSvQwn
	gD/2H/pMXFgrjIsh80TLo2uWG6unnYPakXM+Ibfqrs7dfKJFADMPdwjhxTmnsZyPEhF60v
	5vfdnEGWq24qKNduZ2NH/QsHtDZvP248wf+jX6BupHfeXyxwzwuIL6uJOoVN4y1jqi9UXW
	mowim+SMHrew9FKVTIvvzpHheOylAgxuJ0jhfz/WIBjbtiFS2xR9E6uu5ym/IG2riRBg24
	EfdSo0GOHwmoYV8aXk7BOIfTZc3mPZ2jEVkkDAsgzTYxYd8iocz8r5/5NPIaQg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717693603; a=rsa-sha256; cv=none;
	b=Qi6U2UXzQBziC/br63JvWDjKE/wWgYw47DnszeoBKN7z/VsrQSPwlokjOKSS99DhXOsaBM
	5jb4W/v7RBJlFrnUQ2B9ocCQ5qZllfvSVStY6mf79YcxEexwWpTQcNp1TGR3KuEmzIkfF7
	P3lwp0aSOJ7iA9BxstQm9BHT+LcJ14nOncEcJuWR8BXpKvICpND/KujWFhUqEbhqfC7SyZ
	NsNzPxHZzAfE+MBzur1Yusbh3seLTotKMWfh7Fkfe92BMPPcdRJXchUxv2FcNfJL/OlR8q
	TrrG1/QGeLuVNMfFjSlHAfy4tAyj8FkjM0i97RHB/w36gJXJvWSd+du/KEtJpQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717693603;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=yyx1Xr4E/Nb52sjPs2TF3tYGNJebheY+QfHu79IrJxI=;
	b=UfnyBAAhHJfnXKQfkOjIBqGMsOnvzdZGxnM6ePkspwlnZeR38EUDhxY0bnIAfcR6zS0FXd
	9RlWQD6Mrkj/6IzCFu4KYVHUDJiTwqI9bPj679LQHvcN9IPclPKuzTwANzjSQnVNTz9QOx
	jv38CAmG4iclGlw+evLjpkNIeGiiowExIfT8Vr8Lu/MuvBWfQ41yoKwkLlBAWjxFU8AAAU
	d3OGTSd7cvtLX7ga99umKpsdOwrTiw+BvbGzb20hPofKJUvfM7ju2BrPrxkudbBHzyEQVu
	2LP3JQs1uiL06ruXBZYwJOB+r+2cd4wtmD6YXzrMjHotMBUV6waclrTOYnNaRw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vw9jH1qYtzvWx;
	Thu,  6 Jun 2024 17:06:43 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456H6hdb073673;
	Thu, 6 Jun 2024 17:06:43 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456H6ht9073670;
	Thu, 6 Jun 2024 17:06:43 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 17:06:43 GMT
Message-Id: <202406061706.456H6ht9073670@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Allan Jude <allanjude@FreeBSD.org>
Subject: git: 7dd39ef4e0d5 - main - comm: close a race condition
  when comm is fed from stdin
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: allanjude
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 7dd39ef4e0d56b213445754a189d204b70a77a00
Auto-Submitted: auto-generated

The branch main has been updated by allanjude:

URL: https://cgit.FreeBSD.org/src/commit/?id=7dd39ef4e0d56b213445754a189d204b70a77a00

commit 7dd39ef4e0d56b213445754a189d204b70a77a00
Author:     Cosimo Cecchi <cosimo@apple.com>
AuthorDate: 2024-06-06 16:51:43 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2024-06-06 17:04:38 +0000

    comm: close a race condition when comm is fed from stdin
    
    If one of the files has ended, we won't show the column, but we still
    need to drain the file pointer to avoid potentially hitting a pipe
    failure.
    
    This commit moves the NULL offset checks inside show() so that getline()
    and ferror() are still called on fp.
    
    Reviewed by:    allanjude
    Sponsored by:   Apple Inc.
    Differential Revision:  https://reviews.freebsd.org/D45440
---
 usr.bin/comm/comm.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/usr.bin/comm/comm.c b/usr.bin/comm/comm.c
index 2f305e23ce8f..4dcd7cc9a2dd 100644
--- a/usr.bin/comm/comm.c
+++ b/usr.bin/comm/comm.c
@@ -129,12 +129,12 @@ main(int argc, char *argv[])
 
 		/* if one file done, display the rest of the other file */
 		if (n1 < 0) {
-			if (n2 >= 0 && col2 != NULL)
+			if (n2 >= 0)
 				show(fp2, argv[1], col2, &line2, &line2len);
 			break;
 		}
 		if (n2 < 0) {
-			if (n1 >= 0 && col1 != NULL)
+			if (n1 >= 0)
 				show(fp1, argv[0], col1, &line1, &line1len);
 			break;
 		}
@@ -206,10 +206,12 @@ show(FILE *fp, const char *fn, const char *offset, char **bufp, size_t *buflenp)
 	ssize_t n;
 
 	do {
-		(void)printf("%s%s\n", offset, *bufp);
+		/* offset is NULL when draining fp, not printing */
+		if (offset != NULL)
+			(void)printf("%s%s\n", offset, *bufp);
 		if ((n = getline(bufp, buflenp, fp)) < 0)
 			break;
-		if (n > 0 && (*bufp)[n - 1] == '\n')
+		if (n > 0 && offset != NULL && (*bufp)[n - 1] == '\n')
 			(*bufp)[n - 1] = '\0';
 	} while (1);
 	if (ferror(fp))

From nobody Thu Jun  6 17:22:35 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwB3b2qltz5NKNb;
	Thu, 06 Jun 2024 17:22:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwB3b2KPwz4Lym;
	Thu,  6 Jun 2024 17:22:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717694555;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=asRPVbxfLGu1I0sgbFji4fPXdFqXIljMSGc48UBvaNs=;
	b=p5CPAWfdKX/3dsJ9kUoklT4EVe3yao679eQRmrOlZBXzLcJWEqRXiZ/VF4yAJsI5l8XABK
	SMD/iZSmmgWGeVydrlEGNcyEM53U3X7LO+ygUBsCU/Y1yUVCDk3HbIiqO3fjXkG8LggLKe
	KM/wcuCQGD+11Rt3BYPgyjYVokw9qf+rtfLQjv4UsLPGNv4M+Ymg7n8qjVyfPWEFO3/udJ
	ftGLkLaxyA7Fb/NocsE+MiO9cdGsliTSERmRv7bVz0SVzUXGIQP5MzhNfJzg5XCcEwM6Fd
	Hz3toc5jRRDAttucQmGXXtLxsBQ7KkgH+yOuex5ewcRyiLUsE3Dj/s2duG8ptg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717694555; a=rsa-sha256; cv=none;
	b=hmHiCMZTh1xfgbDwk+VHPon/5ptlOHJy25pwqTSmJW3x5o36tetDm/ixh8ToStzTMyjvth
	l+EjOm/GxICQu1M5WW2gDYRNCfwLuy7VUmjPo7DwxJSWidU/0sGBTknpXLmow7qbVodIGs
	/Nl1WlvXx0Hdd4PClieZ3abQCuq3nsw1fI0EalbOweAzxDvoIuPgQ8irG56YJbUeVZsvxO
	x6nlV8kHeXEzdLYQT8/zWA2Omz0+6voNFZRA0issZ2LpBL99gqBp5dMG0HR/nUhj42NnX0
	ysDKj79nR2xQr//XdrbyHXiZ4l6AI1nMm7cKLJdcquVX+OgFkgoYPqCumm30Aw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717694555;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=asRPVbxfLGu1I0sgbFji4fPXdFqXIljMSGc48UBvaNs=;
	b=ZNa8fgl3WAK2SvyMU2xGETJSb5Hy201mPhSjTFcaG9ZxEsmquJpqW1wUP6RTEMtNQ7ubVi
	V9s3FXJP9D6ld2pFY0hX6m7BhJoXMUKmeK2xBxj54P/ByyReHrbyo/qxk5fCATsKAlwN7c
	I7iyUEEUK4+/l/ISByoxLVVFoz/+6rXvEqXVWgISbvvdjI3ZYWNFEHGK3k8wUeOFJOb5f0
	pK/daAj4bnYBRJOpFco1ZDTOvgk7lcDNatmQAPjYdsmR6AHfaqMwq6tl3F9vQK9CDUTNnW
	d9WfXi6vSR/z7CU/fllpl4MOGGBeFsVc7R3PLWHSCydnKGcEW0QDLcYpHYI3Vg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwB3b1wZGzvv1;
	Thu,  6 Jun 2024 17:22:35 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456HMZFU006816;
	Thu, 6 Jun 2024 17:22:35 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456HMZe6006813;
	Thu, 6 Jun 2024 17:22:35 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 17:22:35 GMT
Message-Id: <202406061722.456HMZe6006813@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Alan Somers <asomers@FreeBSD.org>
Subject: git: 60107d23d8f2 - main - ctladm.8: fix several errors
  in the "port" section
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: asomers
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 60107d23d8f2c05f418c024000a31a6148d2f7de
Auto-Submitted: auto-generated

The branch main has been updated by asomers:

URL: https://cgit.FreeBSD.org/src/commit/?id=60107d23d8f2c05f418c024000a31a6148d2f7de

commit 60107d23d8f2c05f418c024000a31a6148d2f7de
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2024-06-05 20:13:04 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2024-06-06 17:22:06 +0000

    ctladm.8: fix several errors in the "port" section
    
    * Document the "-d" option.
    * Add the "-c" and "-r" options to the summary.
    * Correct the list of required options.
    * Clarify that the "-t" option is only for use with "-o", "-w", and "-W"
    * Replace references to the nonexistent "-n" with "-p".
    
    Also, fix a few related error strings in the ctladm command.
    
    MFC after:      2 weeks
    Sponsored by:   Axcient
    Reviewed by:    jhb
    Differential Revision: https://reviews.freebsd.org/D45503
---
 usr.sbin/ctladm/ctladm.8 | 32 ++++++++++++++++++++++++++++----
 usr.sbin/ctladm/ctladm.c |  7 ++++---
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8
index 2c90e12ef924..b3af4b45ba26 100644
--- a/usr.sbin/ctladm/ctladm.8
+++ b/usr.sbin/ctladm/ctladm.8
@@ -35,7 +35,7 @@
 .\"
 .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
 .\"
-.Dd May 2, 2024
+.Dd June 5, 2024
 .Dt CTLADM 8
 .Os
 .Sh NAME
@@ -162,6 +162,7 @@
 .Nm
 .Ic port
 .Op Fl c
+.Op Fl d Ar driver
 .Op Fl o Ar on|off
 .Op Fl w Ar wwpn
 .Op Fl W Ar wwnn
@@ -598,6 +599,10 @@ The serial number is returned when the error is injected.
 Perform one of several CTL frontend port operations.
 Either get a list of frontend ports
 .Pq Fl l ,
+create a new frontend port
+.Pq Fl c ,
+destroy a frontend port
+.Pq Fl r ,
 turn one or more frontends on
 or off
 .Pq Fl o Ar on|off ,
@@ -607,6 +612,8 @@ or World Wide Port Name
 .Pq Fl W Ar wwpn
 for a given port.
 One of
+.Fl c ,
+.Fl r ,
 .Fl l ,
 .Fl o ,
 or
@@ -619,6 +626,18 @@ combined with enabling/disabling or listing ports.
 .Bl -tag -width 12n
 .It Fl c
 Create new frontend port using free pp and vp=0.
+.It Fl d Ar driver
+Specify the name of the frontend driver used by the
+.Pq Fl c
+or
+.Pq Fl r
+subcommands.
+Valid driver names include
+.Dq ioctl ,
+.Dq iscsi ,
+and
+.Dq nvmf ,
+but more can be added by external kernel modules.
 .It Fl o Ar on|off
 Turn the specified CTL frontend ports on or off.
 If no port number or port type is specified, all ports are turned on or
@@ -633,7 +652,12 @@ The port numbers can be found in the frontend port list.
 Remove port specified with
 .Pq Fl p Ar targ_port .
 .It Fl t Ar fe_type
-Specify the frontend type.
+Specify the frontend type used by the
+.Pq Fl o ,
+.Pq Fl w ,
+and
+.Pq Fl W
+subcommands.
 Currently defined port types are
 .Dq fc
 (Fibre Channel),
@@ -647,7 +671,7 @@ and
 .It Fl w Ar wwnn
 Set the World Wide Node Name for the given port.
 The
-.Fl n
+.Fl p
 argument must be specified, since this is only possible to implement on a
 single port.
 As a general rule, the WWNN should be the same across all ports on the
@@ -655,7 +679,7 @@ system.
 .It Fl W Ar wwpn
 Set the World Wide Port Name for the given port.
 The
-.Fl n
+.Fl p
 argument must be specified, since this is only possible to implement on a
 single port.
 As a general rule, the WWPN must be different for every port in the system.
diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c
index 688281238fb0..28f9a39386d3 100644
--- a/usr.sbin/ctladm/ctladm.c
+++ b/usr.sbin/ctladm/ctladm.c
@@ -546,7 +546,7 @@ cctl_port(int fd, int argc, char **argv, char *combinedopt)
 	 * we'll throw an error, since that only works on one port at a time.
 	 */
 	if ((port_type != CTL_PORT_NONE) && (targ_port != -1)) {
-		warnx("%s: can only specify one of -t or -n", __func__);
+		warnx("%s: can only specify one of -t or -p", __func__);
 		retval = 1;
 		goto bailout;
 	} else if ((targ_port == -1) && (port_type == CTL_PORT_NONE))
@@ -630,7 +630,7 @@ cctl_port(int fd, int argc, char **argv, char *combinedopt)
 	}
 	case CCTL_PORT_MODE_SET:
 		if (targ_port == -1) {
-			warnx("%s: -w and -W require -n", __func__);
+			warnx("%s: -w and -W require -p", __func__);
 			retval = 1;
 			goto bailout;
 		}
@@ -679,7 +679,8 @@ bailout:
 	return (retval);
 
 bailout_badarg:
-	warnx("%s: only one of -l, -o or -w/-W may be specified", __func__);
+	warnx("%s: only one of -c, -r, -l, -o or -w/-W may be specified",
+		__func__);
 	return (1);
 }
 

From nobody Thu Jun  6 17:25:55 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwB7S1ZGWz5NKcx;
	Thu, 06 Jun 2024 17:25:56 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwB7S0tjbz4Mbb;
	Thu,  6 Jun 2024 17:25:56 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717694756;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=R3f21IphXLSSe91ibVlRqcCSQkSUUWKL13FOfUdC8ag=;
	b=IVMBeE9zCYwsyFqS+T0QIq/SvQFx2OHOd3yFC92UPNQta6kEk55e+M1/E8zu6d5+t6pChV
	Zl9FfaVfH1GyqcG9uUGQwUP1SPK1qZr+23qDXMiCSL1xrjU9ynDNtlUxn33877GoIIlXu2
	mjNyw3urO1SEY/2GGrqsQgW8Z4U+92T7aO2f4ZD+EfOQQyaFBKI8GWSAU0ewZ2IJBuULG0
	KUqEX4y48/nIda4yrCfnf7MSqrlhQheOixWg0cV3pxhTMEIiRQv/MNpKRD7el/xV/WrhPy
	Yhgteim7TzBQVINUWoAgJuLOSZrFJ3o2B+pBKwCCDXslnM9wt91+nxv77hV9jw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717694756; a=rsa-sha256; cv=none;
	b=bvZvz7S4KYIQY7Jmh4S0LlhLahG6RI+WQLj263FN1hBmoj6XVyY1mjMUbp9cS+l0XWL4y0
	H/pcFuJ5pbJlrCQhsgciQpq3LSBRPUOffscGJBIzItEicX+JbUxP4tesCEhlsMU8DX1Hrv
	0GtzL7sXG6BhLWGROq9LJ/NunY0W+aTHTeZtGh34YHZ9QaR8tMxWjn/ePv8dZFMQSb1OYE
	l6h4cYF11AcT9sx4IuiFom1bqraE6eVkln6EMjr/YksvCZBbjw0G2WZp5Eol+djOnlpUGB
	wFAtV2lWlyAw22tgCcAYsA1Paq9rL/oF3qzA6opigoBsZUmJ1vJ3QuNCykfylQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717694756;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=R3f21IphXLSSe91ibVlRqcCSQkSUUWKL13FOfUdC8ag=;
	b=Yabj1G570yL7EmYBdiyBM8e48t2QyNMy5dHJGz6RUJ/EvTH8hs5QEtnPCY2rZgpI5p9/RL
	1OwC8bBuFZSe7DxxmBuqXZ/nl8c6//4secEivoiobZKjvDgOhLm7M9IhFq0jpqA2OopHlU
	i5icM8tS0W9x6SkFNyyXZzk8TWtrfvfW2qU+6H4oex+YVa95xeuUUEAgnGFLFiqJ1q++Hu
	hyvz7m+GvQ2A3o4wMScOnuvrrFqjxVJmp+qNKzr2XruoJA+eD9ahpk6YOxbqdh1oUEJZI6
	/EmoT/JO99PL0M0M+aKTLrxPVeve/zIpRe7t1e7clEV+4vVnacAcvd52wq8cOg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwB7S0VG8zvv2;
	Thu,  6 Jun 2024 17:25:56 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456HPt18007411;
	Thu, 6 Jun 2024 17:25:55 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456HPtbM007408;
	Thu, 6 Jun 2024 17:25:55 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 17:25:55 GMT
Message-Id: <202406061725.456HPtbM007408@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Allan Jude <allanjude@FreeBSD.org>
Subject: git: 4472fd66d006 - main - lam: fail on I/O errors
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: allanjude
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 4472fd66d0067347e3123896ae1b33f8bd444d56
Auto-Submitted: auto-generated

The branch main has been updated by allanjude:

URL: https://cgit.FreeBSD.org/src/commit/?id=4472fd66d0067347e3123896ae1b33f8bd444d56

commit 4472fd66d0067347e3123896ae1b33f8bd444d56
Author:     Cosimo Cecchi <cosimo@apple.com>
AuthorDate: 2024-06-06 17:24:07 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2024-06-06 17:24:15 +0000

    lam: fail on I/O errors
    
    I/O errors should be reported; however lam currently does not
    disambiguate between EOF because end-of-file was reached and EOF because
    an I/O error occurred.
    This commit changes lam to exit with EX_IOERR when an I/O error occurs.
    
    Reviewed by:    imp, allanjude
    Sponsored by:   Apple Inc.
    Differential Revision:  https://reviews.freebsd.org/D45437
---
 usr.bin/lam/lam.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c
index 68cb4b946575..2194ae7ab596 100644
--- a/usr.bin/lam/lam.c
+++ b/usr.bin/lam/lam.c
@@ -43,6 +43,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sysexits.h>
 #include <unistd.h>
 
 #define	MAXOFILES	20
@@ -212,6 +213,9 @@ gatherline(struct openfile *ip)
 	*p = '\0';
 	if (c == EOF) {
 		ip->eof = 1;
+		if (ferror(ip->fp)) {
+			err(EX_IOERR, NULL);
+		}
 		if (ip->fp == stdin)
 			fclose(stdin);
 		morefiles--;

From nobody Thu Jun  6 17:35:46 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwBLp2Xh2z5NMQ9;
	Thu, 06 Jun 2024 17:35:46 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwBLp22Qvz4NsD;
	Thu,  6 Jun 2024 17:35:46 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717695346;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=H5TXIa+vHH1K347c7d7+b9TgFp6QPqIZggQLFbkDMuc=;
	b=ZjnAtBw0aDTrm7V93Xe8w/FH8AxbMhbFnoXTgu4rpZ/+UhoF39GJRTu/UU9vfVcuo885Gb
	Tuj5zfRQQrkwUlSPtO+vAh9m54DgnnRzDFHBXXlCwhvRAZU6F588HfGzcS8Efs8W2lnP7l
	tt2fODKGqYEFSPtE6LzhXr+pJ9Dgharp03CswmXoIJf3TPomWjXsf4V8boPt8XLP2ZWSkK
	nEanqrvJEyImjagEDGER810PuUdDtK/apwzRCtcigK+YT73Ew/EPTNCAZZZ3pBOGVQcTUP
	qaMirlGnQgDcn/SJa2Ck0ZOHWgtdy2sJqP5m9Zi9DdyCsDSy51D2NXErjd/AMw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717695346; a=rsa-sha256; cv=none;
	b=nAmpjbbI6iDtzWDVGidMYCpAPKzrT+VyQB9WRYMg7vk+Vee2ph6yb2obzAE5BTQK6PTIJ8
	SV/F5xs1Aao+iaUHZQ03w0WYkIigtidp+Gk9SaUooSkDSQ4o1fQWkOZaiPIT0tpxTbWMGG
	VlX/93ez62KJMz38SgXRtlMbS4BBXBsdph8p+pj0oBFZchmJc3BrzmbVbXhfjHz4Zf/svJ
	g4BuZDQr2XuKkwieqhP6dR60xfO1kSd8IFvNaJFD7pFhQdj5jkqtIk5t122aB+omXpD7Py
	P9FnJ1pCe6IaBwLTqz+dRRu2xDUBEHgFeJoNvzI2Cc9NmpV64Y8vYtwLXStMHA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717695346;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=H5TXIa+vHH1K347c7d7+b9TgFp6QPqIZggQLFbkDMuc=;
	b=NrrzcitXOIh7Ta3U0FnwUGdmJDAQ+kmQPDIO7GPjN9+pfZBJ8iMwIxg/7b8L3iIE4yTY3E
	Um6PdRFrcCeMICYTLxsAZJs8oo4kfZA8lTj0Q6el+Dxr5ElYHLaDWe9uFIbHuJy/fapIIE
	OhcOmoeyKhymsEL5ZrsTlyKwRbES0FDwQPvwwmOPUwMB1TPi3/htsWJoVmUpCLb5NKzlPi
	kIdrLnGi8Ve5n4RCXs2GLkm2sTZv2p75G96WWoC3cDV1ViOTaN1zw9PHwRqNo5Y11AO+la
	qAjMqCDFqkWkmcuKKWXs71idet+tdIDrMA75EKpGkVXW0w3ayitW2KIb6aqcgw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwBLp1dt4zvwL;
	Thu,  6 Jun 2024 17:35:46 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456HZkOJ024154;
	Thu, 6 Jun 2024 17:35:46 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456HZkv0024151;
	Thu, 6 Jun 2024 17:35:46 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 17:35:46 GMT
Message-Id: <202406061735.456HZkv0024151@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ryan Libby <rlibby@FreeBSD.org>
Subject: git: 7658d1532caa - main - vm_radix: define
  vm_radix_insert_lookup_lt and use in vm_page_rename
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rlibby
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 7658d1532caa47deafa20e4af902e0e26dd0b34c
Auto-Submitted: auto-generated

The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=7658d1532caa47deafa20e4af902e0e26dd0b34c

commit 7658d1532caa47deafa20e4af902e0e26dd0b34c
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-06 17:26:50 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-06 17:26:50 +0000

    vm_radix: define vm_radix_insert_lookup_lt and use in vm_page_rename
    
    Use the new pctrie combined lookup/insert.  This is an easy application
    of the new facility.  There are other places where we do this for pages
    that may need more plumbing to use combined lookup/insert.
    
    Reviewed by:    kib (previous version), dougm, markj
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D45396
---
 sys/vm/vm_page.c  |  5 +----
 sys/vm/vm_radix.h | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 9ba31cb9e1b3..b41439045205 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1851,9 +1851,6 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex)
 	VM_OBJECT_ASSERT_WLOCKED(new_object);
 
 	KASSERT(m->ref_count != 0, ("vm_page_rename: page %p has no refs", m));
-	mpred = vm_radix_lookup_le(&new_object->rtree, new_pindex);
-	KASSERT(mpred == NULL || mpred->pindex != new_pindex,
-	    ("vm_page_rename: pindex already renamed"));
 
 	/*
 	 * Create a custom version of vm_page_insert() which does not depend
@@ -1862,7 +1859,7 @@ vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex)
 	 */
 	opidx = m->pindex;
 	m->pindex = new_pindex;
-	if (vm_radix_insert(&new_object->rtree, m)) {
+	if (vm_radix_insert_lookup_lt(&new_object->rtree, m, &mpred) != 0) {
 		m->pindex = opidx;
 		return (1);
 	}
diff --git a/sys/vm/vm_radix.h b/sys/vm/vm_radix.h
index 815c915b5fb1..dcacf1a5d3fc 100644
--- a/sys/vm/vm_radix.h
+++ b/sys/vm/vm_radix.h
@@ -69,6 +69,26 @@ vm_radix_insert(struct vm_radix *rtree, vm_page_t page)
 	return (VM_RADIX_PCTRIE_INSERT(&rtree->rt_trie, page));
 }
 
+/*
+ * Insert the page into the vm_radix tree with its pindex as the key.  Panic if
+ * the pindex already exists.  Return zero on success or a non-zero error on
+ * memory allocation failure.  Set the out parameter mpred to the previous page
+ * in the tree as if found by a previous call to vm_radix_lookup_le with the
+ * new page pindex.
+ */
+static __inline int
+vm_radix_insert_lookup_lt(struct vm_radix *rtree, vm_page_t page,
+    vm_page_t *mpred)
+{
+	int error;
+
+	error = VM_RADIX_PCTRIE_INSERT_LOOKUP_LE(&rtree->rt_trie, page, mpred);
+	if (__predict_false(error == EEXIST))
+		panic("vm_radix_insert_lookup_lt: page already present, %p",
+		    *mpred);
+	return (error);
+}
+
 /*
  * Returns the value stored at the index assuming there is an external lock.
  *

From nobody Thu Jun  6 17:35:47 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwBLq3RRwz5NMN1;
	Thu, 06 Jun 2024 17:35:47 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwBLq2sf3z4P67;
	Thu,  6 Jun 2024 17:35:47 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717695347;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=JTl61AtsyO/LbRP0eHZb+l2aHongmz0+HZkAn6AaGzc=;
	b=MNQtQYp2g5Scnss8e2QvbkzOJ8LC58+Lw+j+J8UlqWZlX0gpQScLME2S00tVG6lLvy58e1
	JU+o6f+W25CE+Wln+ZtyDqXPG0aXlFlTuPcn2xvqMf07S6F4ygrQLqPtAu69BBjTulcbci
	ZxVdlWXG/EGZab77IGVG3sqsvEF2K+NhSbqTZl71CvgTMyATxxlWla0hFXmAAr/5kg9amn
	JtNld3ZosvDzR5cbJFADfknZU9EeAE1DIs5dZ7JcOIyrB+HhM2jBepu1+Lo2T/UWwEAkih
	NtOttLG5LCgel29VvYy14vGYoPPQ8V/By7PJuhkV62xajfeVKJd41Gj/yfkXGQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717695347; a=rsa-sha256; cv=none;
	b=W7cREqap6qpINQyM/69QsFKDvGqDnM7/PHYIGTtcfSj0PP5KmOWpoFledxSjDJqUk12sNB
	6Opvt+F+x/PmPZzjLd4pbb6hMRRB8Xk2slOGVknlc+DF3LT8y88sYOo5ieXQYDFefoJ+Vb
	8kYaRvmlChyRvDGrAEKXsz0D5XIFtC/vyvWUqvdqPTLWPl/pd/O73SCfrG5zNe8/eN773y
	Ttyb8+IxN/b/mqfbARR2tpTKXVP54DjIneqcEV7UW7gI5lgBhSoCGyhqEGTPwpMKEgdi3P
	ycLaJ1ICY6C2e/Te44MYmRRoO1K+nTrJhhqHxlR8F/2n493aoInysXwxHKnFVg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717695347;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=JTl61AtsyO/LbRP0eHZb+l2aHongmz0+HZkAn6AaGzc=;
	b=Rw08ZilF7ZHE97kAZ4P0FRFibD+VgH48d32HW3bo4YPnWfMhF1zbe6geo69yIhGAV5CuK7
	lN5DMlYCnMMAqJrEBeqrGgH1Z8lkb+bEEv+a0e+VBA7L+x0imSBit4r35Xfjk6/n2TostZ
	E7DtbJZfZ+1lrGu772q7vvJ4jU2KTORcp1UF7rbfZ1x2xN+xtmUOlnHeL9XbVz/ShZUvEs
	/MaCt/6w0sdl/z5HK9YKg4XjZPNzjAOtsxkNiOjU8Q9COu2G7wHsl09cqyL71FW4+tBcXB
	AlYA9PEqIWv14Kew24+gwUrWGu3bxAP9pciHY2ncli2bN1HNUZR2cinoTPgC9w==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwBLq2NtmzvwM;
	Thu,  6 Jun 2024 17:35:47 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456HZlJo024196;
	Thu, 6 Jun 2024 17:35:47 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456HZl0g024193;
	Thu, 6 Jun 2024 17:35:47 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 17:35:47 GMT
Message-Id: <202406061735.456HZl0g024193@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Ryan Libby <rlibby@FreeBSD.org>
Subject: git: 1b13e36fcc00 - main - vm_page_insert: use pctrie
  combined insert/lookup
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: rlibby
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 1b13e36fcc000186045186451ab2a2fec5654fac
Auto-Submitted: auto-generated

The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=1b13e36fcc000186045186451ab2a2fec5654fac

commit 1b13e36fcc000186045186451ab2a2fec5654fac
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-06-06 17:26:50 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-06-06 17:26:50 +0000

    vm_page_insert: use pctrie combined insert/lookup
    
    This reduces work done under vm_page_insert for large objects.
    
    Reviewed by:    alc, dougm, markj
    Sponsored by:   Dell EMC Isilon
    Differential Revision:  https://reviews.freebsd.org/D45486
---
 sys/vm/vm_page.c | 100 ++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 59 insertions(+), 41 deletions(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index b41439045205..4b97637668b4 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -1416,6 +1416,56 @@ vm_page_dirty_KBI(vm_page_t m)
 	m->dirty = VM_PAGE_BITS_ALL;
 }
 
+/*
+ * Insert the given page into the given object at the given pindex.  mpred is
+ * used for memq linkage.  From vm_page_insert, lookup is true, mpred is
+ * initially NULL, and this procedure looks it up.  From vm_page_insert_after,
+ * lookup is false and mpred is known to the caller to be valid, and may be
+ * NULL if this will be the page with the lowest pindex.
+ *
+ * The procedure is marked __always_inline to suggest to the compiler to
+ * eliminate the lookup parameter and the associated alternate branch.
+ */
+static __always_inline int
+vm_page_insert_lookup(vm_page_t m, vm_object_t object, vm_pindex_t pindex,
+    vm_page_t mpred, bool lookup)
+{
+	int error;
+
+	VM_OBJECT_ASSERT_WLOCKED(object);
+	KASSERT(m->object == NULL,
+	    ("vm_page_insert: page %p already inserted", m));
+
+	/*
+	 * Record the object/offset pair in this page.
+	 */
+	m->object = object;
+	m->pindex = pindex;
+	m->ref_count |= VPRC_OBJREF;
+
+	/*
+	 * Add this page to the object's radix tree, and look up mpred if
+	 * needed.
+	 */
+	if (lookup)
+		error = vm_radix_insert_lookup_lt(&object->rtree, m, &mpred);
+	else
+		error = vm_radix_insert(&object->rtree, m);
+	if (__predict_false(error != 0)) {
+		m->object = NULL;
+		m->pindex = 0;
+		m->ref_count &= ~VPRC_OBJREF;
+		return (1);
+	}
+
+	/*
+	 * Now link into the object's ordered list of backed pages.
+	 */
+	vm_page_insert_radixdone(m, object, mpred);
+	vm_pager_page_inserted(object, m);
+	return (0);
+}
+
 /*
  *	vm_page_insert:		[ internal use only ]
  *
@@ -1426,11 +1476,7 @@ vm_page_dirty_KBI(vm_page_t m)
 int
 vm_page_insert(vm_page_t m, vm_object_t object, vm_pindex_t pindex)
 {
-	vm_page_t mpred;
-
-	VM_OBJECT_ASSERT_WLOCKED(object);
-	mpred = vm_radix_lookup_le(&object->rtree, pindex);
-	return (vm_page_insert_after(m, object, pindex, mpred));
+	return (vm_page_insert_lookup(m, object, pindex, NULL, true));
 }
 
 /*
@@ -1447,42 +1493,7 @@ static int
 vm_page_insert_after(vm_page_t m, vm_object_t object, vm_pindex_t pindex,
     vm_page_t mpred)
 {
-	vm_page_t msucc;
-
-	VM_OBJECT_ASSERT_WLOCKED(object);
-	KASSERT(m->object == NULL,
-	    ("vm_page_insert_after: page already inserted"));
-	if (mpred != NULL) {
-		KASSERT(mpred->object == object,
-		    ("vm_page_insert_after: object doesn't contain mpred"));
-		KASSERT(mpred->pindex < pindex,
-		    ("vm_page_insert_after: mpred doesn't precede pindex"));
-		msucc = TAILQ_NEXT(mpred, listq);
-	} else
-		msucc = TAILQ_FIRST(&object->memq);
-	if (msucc != NULL)
-		KASSERT(msucc->pindex > pindex,
-		    ("vm_page_insert_after: msucc doesn't succeed pindex"));
-
-	/*
-	 * Record the object/offset pair in this page.
-	 */
-	m->object = object;
-	m->pindex = pindex;
-	m->ref_count |= VPRC_OBJREF;
-
-	/*
-	 * Now link into the object's ordered list of backed pages.
-	 */
-	if (vm_radix_insert(&object->rtree, m)) {
-		m->object = NULL;
-		m->pindex = 0;
-		m->ref_count &= ~VPRC_OBJREF;
-		return (1);
-	}
-	vm_page_insert_radixdone(m, object, mpred);
-	vm_pager_page_inserted(object, m);
-	return (0);
+	return (vm_page_insert_lookup(m, object, pindex, mpred, false));
 }
 
 /*
@@ -1510,6 +1521,13 @@ vm_page_insert_radixdone(vm_page_t m, vm_object_t object, vm_page_t mpred)
 		    ("vm_page_insert_radixdone: object doesn't contain mpred"));
 		KASSERT(mpred->pindex < m->pindex,
 		    ("vm_page_insert_radixdone: mpred doesn't precede pindex"));
+		KASSERT(TAILQ_NEXT(mpred, listq) == NULL ||
+		    m->pindex < TAILQ_NEXT(mpred, listq)->pindex,
+		    ("vm_page_insert_radixdone: pindex doesn't precede msucc"));
+	} else {
+		KASSERT(TAILQ_EMPTY(&object->memq) ||
+		    m->pindex < TAILQ_FIRST(&object->memq)->pindex,
+		    ("vm_page_insert_radixdone: no mpred but not first page"));
 	}
 
 	if (mpred != NULL)

From nobody Thu Jun  6 18:44:38 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwCtH1wyWz5LLgf;
	Thu, 06 Jun 2024 18:44:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwCtH145Hz4YGW;
	Thu,  6 Jun 2024 18:44:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717699479;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=8RAUr4jqnUsaCRof3mpY7sz1OL6FLBReiipzpaguU00=;
	b=adrQ6qBAgUL/QrzhxzB9ZOYYdCrhXPL5Stqqkms5uqK61v1vGfs+k7DvA9Q/AMZj1YEHFU
	xz5QB5TSjKAp9sSQMMmLKSkxrEKsHNeDsVndGvtqjwsEEy+wcWslaLwnWDEjj7GJTkHA8D
	meFMSJi25MV2eZZUHYuUusjum5SfaOICEfhXXLhkLZh6s2jwGGqcsucE4LGkibZxxlP7hC
	t8BBiFxx5T+PcJuMU3oZmrFGmyuNDzdsJfRtYGqV0D88z7SWtDjwt9n4K0wUNfU6T0OKIH
	JcdamMYeIs5gZtJj35IilqAu2oCq3F9W3pk4NMXTKjWBaeRrEAcQN5LowOLwmQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717699479; a=rsa-sha256; cv=none;
	b=JhB3BhnSRmLt+nvz8LzHD9Fqw2ej+ZTJyn33zR7Zhnki8SrfpPIg4JWXRueuNRl565fmaW
	ZVn/ox5g0o4fGjXSMDAAhtnTpizBCZq0qpsjpria9eTWGJIyuKSHOn2ZpZ7UxoGh2bSI5C
	miDjgn4Jz9I70Y7+sXdjqSYvsjG+ejjnWvPyF3C8smULpPAlwwyOvQKtLOE0jj91W4j7Xy
	+I9EYt4GCwCCG1hhEz3t+vcutf2cdO0TZLcs+wUZ+YoMIMxOp9DRvfzlZwU2+KkH/t6RpY
	64l5bPMMXWzGqb3miSskeG7oe+i2B/jWbKwW1uby45JsFD6lfJLAF3I8S5Zcew==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717699479;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=8RAUr4jqnUsaCRof3mpY7sz1OL6FLBReiipzpaguU00=;
	b=dho5BrvsybIFyQAp1TqPIiutfn4s0x85110xQ7r3FGDi37p737N5kmISJQCKNuhMD+pQn3
	RZ03X9UuM4JjyKYIp5AlqB73/FAtbbu85iLy5vEPfD1R6+/RdJ7PtB79Ia/CcCWp49vdez
	aKktSStgMip32GFODB5mS5/yxHoZB5DuhVmQNfI0HuUyqT7wPC2ELG0Pn1Gub2a5znXEux
	71KG2NQ1MmgTkxnj4R1LhDgYslfqiIAMrySrgp94IkuEnpl1rqXZvwwfP8qc9CM6FIEaS2
	keKv+Q8YF4q3V1HTxI0TbLOzfgg1bdkCJpwXNblEoTV7zGmARoSh4gbtMJQw+w==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwCtH0YPNzxVn;
	Thu,  6 Jun 2024 18:44:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456IiclB042007;
	Thu, 6 Jun 2024 18:44:38 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456IicBR042004;
	Thu, 6 Jun 2024 18:44:38 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 18:44:38 GMT
Message-Id: <202406061844.456IicBR042004@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Doug Moore <dougm@FreeBSD.org>
Subject: git: 2c10bacdf402 - main - rangeset: add next() iteration
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: dougm
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 2c10bacdf402c1cf246302303b4dbdce21bf9692
Auto-Submitted: auto-generated

The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=2c10bacdf402c1cf246302303b4dbdce21bf9692

commit 2c10bacdf402c1cf246302303b4dbdce21bf9692
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-06-06 18:42:31 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-06-06 18:42:31 +0000

    rangeset: add next() iteration
    
    Add a method rangeset_next to find the first range that starts at or
    after a given value. Use it to rewrite pmap_pkru_same and
    pmap_bti_same to avoid walking a page at a time over pages in no
    range.
    
    Reviewed by:    andrew, kib
    Differential Revision:  https://reviews.freebsd.org/D45511
---
 sys/amd64/amd64/pmap.c   | 26 +++++++++++++-------------
 sys/arm64/arm64/pmap.c   | 23 ++++++++++++-----------
 sys/kern/subr_rangeset.c |  8 ++++++++
 sys/sys/rangeset.h       |  5 +++++
 4 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 2f3119aede67..4d4ecc8ea4e2 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -11448,7 +11448,7 @@ pmap_pkru_deassign_all(pmap_t pmap)
 static bool
 pmap_pkru_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
 {
-	struct pmap_pkru_range *ppr, *prev_ppr;
+	struct pmap_pkru_range *next_ppr, *ppr;
 	vm_offset_t va;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
@@ -11457,19 +11457,19 @@ pmap_pkru_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
 	    sva >= VM_MAXUSER_ADDRESS)
 		return (true);
 	MPASS(eva <= VM_MAXUSER_ADDRESS);
-	for (va = sva; va < eva; prev_ppr = ppr) {
-		ppr = rangeset_lookup(&pmap->pm_pkru, va);
-		if (va == sva)
-			prev_ppr = ppr;
-		else if ((ppr == NULL) ^ (prev_ppr == NULL))
+	ppr = rangeset_lookup(&pmap->pm_pkru, sva);
+	if (ppr == NULL) {
+		ppr = rangeset_next(&pmap->pm_pkru, sva);
+		return (ppr == NULL ||
+		    ppr->pkru_rs_el.re_start >= eva);
+	}
+	while ((va = ppr->pkru_rs_el.re_end) < eva) {
+		next_ppr = rangeset_next(&pmap->pm_pkru, va);
+		if (next_ppr == NULL ||
+		    va != next_ppr->pkru_rs_el.re_start ||
+		    ppr->pkru_keyidx != next_ppr->pkru_keyidx)
 			return (false);
-		if (ppr == NULL) {
-			va += PAGE_SIZE;
-			continue;
-		}
-		if (prev_ppr->pkru_keyidx != ppr->pkru_keyidx)
-			return (false);
-		va = ppr->pkru_rs_el.re_end;
+		ppr = next_ppr;
 	}
 	return (true);
 }
diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c
index 8ac7b8f6a135..92c1c824ba4e 100644
--- a/sys/arm64/arm64/pmap.c
+++ b/sys/arm64/arm64/pmap.c
@@ -9274,7 +9274,7 @@ pmap_bti_deassign_all(pmap_t pmap)
 static bool
 pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
 {
-	struct rs_el *prev_rs, *rs;
+	struct rs_el *next_rs, *rs;
 	vm_offset_t va;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
@@ -9286,17 +9286,18 @@ pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva)
 	if (pmap->pm_bti == NULL || ADDR_IS_KERNEL(sva))
 		return (true);
 	MPASS(!ADDR_IS_KERNEL(eva));
-	for (va = sva; va < eva; prev_rs = rs) {
-		rs = rangeset_lookup(pmap->pm_bti, va);
-		if (va == sva)
-			prev_rs = rs;
-		else if ((rs == NULL) ^ (prev_rs == NULL))
+	rs = rangeset_lookup(pmap->pm_bti, sva);
+	if (rs == NULL) {
+		rs = rangeset_next(pmap->pm_bti, sva);
+		return (rs == NULL ||
+			rs->re_start >= eva);
+	}
+	while ((va = rs->re_end) < eva) {
+		next_rs = rangeset_next(pmap->pm_bti, va);
+		if (next_rs == NULL ||
+		    va != next_rs->re_start)
 			return (false);
-		if (rs == NULL) {
-			va += PAGE_SIZE;
-			continue;
-		}
-		va = rs->re_end;
+		rs = next_rs;
 	}
 	return (true);
 }
diff --git a/sys/kern/subr_rangeset.c b/sys/kern/subr_rangeset.c
index 84c71a583192..0a675b4a2fce 100644
--- a/sys/kern/subr_rangeset.c
+++ b/sys/kern/subr_rangeset.c
@@ -260,6 +260,14 @@ rangeset_lookup(struct rangeset *rs, uint64_t place)
 	return (r);
 }
 
+void *
+rangeset_next(struct rangeset *rs, uint64_t place)
+{
+
+	rangeset_check(rs);
+	return (RANGESET_PCTRIE_LOOKUP_GE(&rs->rs_trie, place));
+}
+
 int
 rangeset_copy(struct rangeset *dst_rs, struct rangeset *src_rs)
 {
diff --git a/sys/sys/rangeset.h b/sys/sys/rangeset.h
index a9fc0ad885c8..3225819c4794 100644
--- a/sys/sys/rangeset.h
+++ b/sys/sys/rangeset.h
@@ -74,6 +74,11 @@ int	rangeset_remove_pred(struct rangeset *rs, uint64_t start,
  */
 void	*rangeset_lookup(struct rangeset *rs, uint64_t place);
 
+/*
+ * Finds the first range that begins at or after place.
+ */
+void	*rangeset_next(struct rangeset *rs, uint64_t place);
+
 /*
  * Copies src_rs entries into dst_rs.  dst_rs must be empty.
  * Leaves dst_rs empty on failure.

From nobody Thu Jun  6 20:40:36 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwGS43P3jz5Mwq3;
	Thu, 06 Jun 2024 20:40:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwGS41thxz4p1F;
	Thu,  6 Jun 2024 20:40:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717706436;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=6nKNuiIQ7LOZ4lXIhKhFGD127qK6JPV/BGcZrgsIsR8=;
	b=QtV1hlrTtQiRMXp+oVttDhKAj/KlnYqlI5RhEsfOatIoNm3Qpp/zrIS678U07Af5tg91q3
	ttYOftpX4YntsSljFNL8UdlxKAmNm3NyZMK7cBmMYYYgsrVRo0FUNEhOpgXHj77pBiiWOp
	2SXW579C9vSE81EkEF1Ey89mlF7BIZrAu7Jj3ise8jPNg4PkYoyBo2LEwHTRVgIGL3ioez
	kmUZivEfCwYsMr8nvdiVQprFd1K0WFuz9UfRLPAkXxl3/GDe5/jSxc+J20t0IsqVn1WzKW
	NzOE9OYi12KvtCCy/7s1+3ui0Ubq6feFPjqfDoWYE0hOyZyRsIPyemz6abYX1A==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706436; a=rsa-sha256; cv=none;
	b=YfxwWo9QQtKU2YucZoPgGUHPoqZIML0fUxWj+/JrvsE4bLpY5gEjU/8qCuLtq96LEX4Pb6
	WxQ2jR0GE6ok2R8o3B9qtc49fwv2dxwR53iQzlqDKsA8OyFF9oZZKIzh66UvLg+KGEqx61
	mr53u9EhrE8KRShARbh54Sj/tgQGwywXpuvG1qm/kKSIBxdopaa3u7CcfxoRrr061HLwMj
	YXBF5aOmPsGcF87Nm6tZYuTwEIy/6dMpv2uGv8o94OiQoMOk2IGTcqIHA9LLPCpOjEI3GK
	4TWFLwat54tYY3gAw6+wAaKl2sWQnvPcr2guSCPlTifCJulAKwNKYTCG79wMWg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717706436;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=6nKNuiIQ7LOZ4lXIhKhFGD127qK6JPV/BGcZrgsIsR8=;
	b=MD5SJmobU7+7hjLVM7wO9e0mSrB3OI62VLQ828gzaxzzzbEoHLcN7XIX73n9t5TCjpapOX
	oRntuujytKeajSSYKJ2GVdr56LXlRmEsb4ZAw/iRip5ATnl9w0h6TI95cKiSUG2A+GeAJh
	aW4TIqvIXeQRuXgwCvPd+qiCDzDcO1m3pQ/DlAnwBMa2wiEweYMN3pmWAaCGht+TBOj+vA
	sWh/JMi0uKjhWzu7AX72xgG9rEQ0BNv5u55l8vxOvVt+jlSxObG5AgsQFTF4mLRyUFqNLx
	l/YHK2rwGUe3q7QHRIhdMH0MQHSBchjB9v2NMr0e4KHEwHOCEmQrT9GZe3Q9Gg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwGS41Mvdz11dl;
	Thu,  6 Jun 2024 20:40:36 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456Keadc039881;
	Thu, 6 Jun 2024 20:40:36 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456KeaVC039878;
	Thu, 6 Jun 2024 20:40:36 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 20:40:36 GMT
Message-Id: <202406062040.456KeaVC039878@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 30bad751e8bf - main - pf: convert
  DIOCGETTIMEOUT/DIOCSETTIMEOUT to netlink
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 30bad751e8bf7bea01a1756ec9112490875c4a92
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=30bad751e8bf7bea01a1756ec9112490875c4a92

commit 30bad751e8bf7bea01a1756ec9112490875c4a92
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-05 03:58:56 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 18:46:18 +0000

    pf: convert DIOCGETTIMEOUT/DIOCSETTIMEOUT to netlink
---
 lib/libpfctl/libpfctl.c   | 84 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/libpfctl/libpfctl.h   |  2 ++
 sbin/pfctl/parse.y        |  4 +--
 sbin/pfctl/pfctl.c        | 19 ++++-------
 sbin/pfctl/pfctl_parser.h |  2 +-
 sys/net/pfvar.h           |  2 ++
 sys/netpfil/pf/pf_ioctl.c | 65 +++++++++++++++++++++++-------------
 sys/netpfil/pf/pf_nl.c    | 76 ++++++++++++++++++++++++++++++++++++++++++
 sys/netpfil/pf/pf_nl.h    |  8 +++++
 9 files changed, 224 insertions(+), 38 deletions(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 42339af5642b..a31fe6f0aff4 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -2522,3 +2522,87 @@ pfctl_set_debug(struct pfctl_handle *h, uint32_t level)
 
 	return (e.error);
 }
+
+int
+pfctl_set_timeout(struct pfctl_handle *h, uint32_t timeout, uint32_t seconds)
+{
+	struct snl_writer nw;
+	struct snl_errmsg_data e = {};
+	struct nlmsghdr *hdr;
+	uint32_t seq_id;
+	int family_id;
+
+	family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME);
+	if (family_id == 0)
+		return (ENOTSUP);
+
+	snl_init_writer(&h->ss, &nw);
+	hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_SET_TIMEOUT);
+
+	snl_add_msg_attr_u32(&nw, PF_TO_TIMEOUT, timeout);
+	snl_add_msg_attr_u32(&nw, PF_TO_SECONDS, seconds);
+
+	if ((hdr = snl_finalize_msg(&nw)) == NULL)
+		return (ENXIO);
+
+	seq_id = hdr->nlmsg_seq;
+
+	if (! snl_send_message(&h->ss, hdr))
+		return (ENXIO);
+
+	while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) {
+	}
+
+	return (e.error);
+}
+
+struct pfctl_nl_timeout {
+	uint32_t seconds;
+};
+#define	_OUT(_field)	offsetof(struct pfctl_nl_timeout, _field)
+static struct snl_attr_parser ap_get_timeout[] = {
+	{ .type = PF_TO_SECONDS, .off = _OUT(seconds), .cb = snl_attr_get_uint32 },
+};
+static struct snl_field_parser fp_get_timeout[] = {};
+#undef _OUT
+SNL_DECLARE_PARSER(get_timeout_parser, struct genlmsghdr, fp_get_timeout, ap_get_timeout);
+
+int
+pfctl_get_timeout(struct pfctl_handle *h, uint32_t timeout, uint32_t *seconds)
+{
+	struct snl_writer nw;
+	struct pfctl_nl_timeout to = {};
+	struct snl_errmsg_data e = {};
+	struct nlmsghdr *hdr;
+	uint32_t seq_id;
+	int family_id;
+
+	family_id = snl_get_genl_family(&h->ss, PFNL_FAMILY_NAME);
+	if (family_id == 0)
+		return (ENOTSUP);
+
+	snl_init_writer(&h->ss, &nw);
+	hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_GET_TIMEOUT);
+	hdr->nlmsg_flags |= NLM_F_DUMP;
+
+	snl_add_msg_attr_u32(&nw, PF_TO_TIMEOUT, timeout);
+
+	if ((hdr = snl_finalize_msg(&nw)) == NULL)
+		return (ENXIO);
+
+	seq_id = hdr->nlmsg_seq;
+
+	if (! snl_send_message(&h->ss, hdr))
+		return (ENXIO);
+
+	while ((hdr = snl_read_reply_multi(&h->ss, seq_id, &e)) != NULL) {
+		if (! snl_parse_nlmsg(&h->ss, hdr, &get_timeout_parser, &to))
+			continue;
+	}
+
+	if (seconds != NULL)
+		*seconds = to.seconds;
+
+	return (e.error);
+}
+
diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h
index ae1457e9304b..6d59d66a924a 100644
--- a/lib/libpfctl/libpfctl.h
+++ b/lib/libpfctl/libpfctl.h
@@ -493,5 +493,7 @@ struct pfctl_natlook {
 int	pfctl_natlook(struct pfctl_handle *h,
 	    const struct pfctl_natlook_key *k, struct pfctl_natlook *r);
 int	pfctl_set_debug(struct pfctl_handle *h, uint32_t level);
+int	pfctl_set_timeout(struct pfctl_handle *h, uint32_t timeout, uint32_t seconds);
+int	pfctl_get_timeout(struct pfctl_handle *h, uint32_t timeout, uint32_t *seconds);
 
 #endif
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 19e029c881d1..2876eb6e89dc 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -5165,7 +5165,7 @@ timeout_spec	: STRING NUMBER
 				yyerror("only positive values permitted");
 				YYERROR;
 			}
-			if (pfctl_set_timeout(pf, $1, $2, 0) != 0) {
+			if (pfctl_apply_timeout(pf, $1, $2, 0) != 0) {
 				yyerror("unknown timeout %s", $1);
 				free($1);
 				YYERROR;
@@ -5179,7 +5179,7 @@ timeout_spec	: STRING NUMBER
 				yyerror("only positive values permitted");
 				YYERROR;
 			}
-			if (pfctl_set_timeout(pf, "interval", $2, 0) != 0)
+			if (pfctl_apply_timeout(pf, "interval", $2, 0) != 0)
 				YYERROR;
 		}
 		;
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index 8776ec7f82dc..d97043fc5c66 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1656,17 +1656,15 @@ pfctl_show_running(int dev)
 int
 pfctl_show_timeouts(int dev, int opts)
 {
-	struct pfioc_tm pt;
+	uint32_t seconds;
 	int i;
 
 	if (opts & PF_OPT_SHOWALL)
 		pfctl_print_title("TIMEOUTS:");
-	memset(&pt, 0, sizeof(pt));
 	for (i = 0; pf_timeouts[i].name; i++) {
-		pt.timeout = pf_timeouts[i].timeout;
-		if (ioctl(dev, DIOCGETTIMEOUT, &pt))
+		if (pfctl_get_timeout(pfh, pf_timeouts[i].timeout, &seconds))
 			err(1, "DIOCGETTIMEOUT");
-		printf("%-20s %10d", pf_timeouts[i].name, pt.seconds);
+		printf("%-20s %10d", pf_timeouts[i].name, seconds);
 		if (pf_timeouts[i].timeout >= PFTM_ADAPTIVE_START &&
 		    pf_timeouts[i].timeout <= PFTM_ADAPTIVE_END)
 			printf(" states");
@@ -2469,7 +2467,7 @@ pfctl_load_limit(struct pfctl *pf, unsigned int index, unsigned int limit)
 }
 
 int
-pfctl_set_timeout(struct pfctl *pf, const char *opt, int seconds, int quiet)
+pfctl_apply_timeout(struct pfctl *pf, const char *opt, int seconds, int quiet)
 {
 	int i;
 
@@ -2499,12 +2497,7 @@ pfctl_set_timeout(struct pfctl *pf, const char *opt, int seconds, int quiet)
 int
 pfctl_load_timeout(struct pfctl *pf, unsigned int timeout, unsigned int seconds)
 {
-	struct pfioc_tm pt;
-
-	memset(&pt, 0, sizeof(pt));
-	pt.timeout = timeout;
-	pt.seconds = seconds;
-	if (ioctl(pf->dev, DIOCSETTIMEOUT, &pt)) {
+	if (pfctl_set_timeout(pf->h, timeout, seconds)) {
 		warnx("DIOCSETTIMEOUT");
 		return (1);
 	}
@@ -2553,7 +2546,7 @@ pfctl_set_optimization(struct pfctl *pf, const char *opt)
 	}
 
 	for (i = 0; hint[i].name; i++)
-		if ((r = pfctl_set_timeout(pf, hint[i].name,
+		if ((r = pfctl_apply_timeout(pf, hint[i].name,
 		    hint[i].timeout, 1)))
 			return (r);
 
diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h
index 58532ad37e12..06ab5d052631 100644
--- a/sbin/pfctl/pfctl_parser.h
+++ b/sbin/pfctl/pfctl_parser.h
@@ -285,7 +285,7 @@ int	pfctl_add_pool(struct pfctl *, struct pfctl_pool *, sa_family_t);
 void	pfctl_move_pool(struct pfctl_pool *, struct pfctl_pool *);
 void	pfctl_clear_pool(struct pfctl_pool *);
 
-int	pfctl_set_timeout(struct pfctl *, const char *, int, int);
+int	pfctl_apply_timeout(struct pfctl *, const char *, int, int);
 int	pfctl_set_reassembly(struct pfctl *, int, int);
 int	pfctl_set_optimization(struct pfctl *, const char *);
 int	pfctl_set_limit(struct pfctl *, const char *, unsigned int);
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 0ea4741f8937..16d3d90f4862 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -2503,6 +2503,8 @@ int			 pf_ioctl_addrule(struct pf_krule *, uint32_t,
 			    uint32_t, const char *, const char *, uid_t uid,
 			    pid_t);
 void			 pf_ioctl_clear_status(void);
+int			 pf_ioctl_get_timeout(int, int *);
+int			 pf_ioctl_set_timeout(int, int, int *);
 
 void			 pf_krule_free(struct pf_krule *);
 void			 pf_krule_clear_counters(struct pf_krule *);
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 99cb3bd85d57..cef50c00283b 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -2443,6 +2443,46 @@ pf_ioctl_clear_status(void)
 	PF_RULES_WUNLOCK();
 }
 
+int
+pf_ioctl_set_timeout(int timeout, int seconds, int *prev_seconds)
+{
+	uint32_t old;
+
+	if (timeout < 0 || timeout >= PFTM_MAX ||
+	    seconds < 0)
+		return (EINVAL);
+
+	PF_RULES_WLOCK();
+	old = V_pf_default_rule.timeout[timeout];
+	if (timeout == PFTM_INTERVAL && seconds == 0)
+		seconds = 1;
+	V_pf_default_rule.timeout[timeout] = seconds;
+	if (timeout == PFTM_INTERVAL && seconds < old)
+		wakeup(pf_purge_thread);
+
+	if (prev_seconds != NULL)
+		*prev_seconds = old;
+
+	PF_RULES_WUNLOCK();
+
+	return (0);
+}
+
+int
+pf_ioctl_get_timeout(int timeout, int *seconds)
+{
+	PF_RULES_RLOCK_TRACKER;
+
+	if (timeout < 0 || timeout >= PFTM_MAX)
+		return (EINVAL);
+
+	PF_RULES_RLOCK();
+	*seconds = V_pf_default_rule.timeout[timeout];
+	PF_RULES_RUNLOCK();
+
+	return (0);
+}
+
 static int
 pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td)
 {
@@ -3838,35 +3878,16 @@ DIOCGETSTATESV2_full:
 
 	case DIOCSETTIMEOUT: {
 		struct pfioc_tm	*pt = (struct pfioc_tm *)addr;
-		int		 old;
 
-		if (pt->timeout < 0 || pt->timeout >= PFTM_MAX ||
-		    pt->seconds < 0) {
-			error = EINVAL;
-			break;
-		}
-		PF_RULES_WLOCK();
-		old = V_pf_default_rule.timeout[pt->timeout];
-		if (pt->timeout == PFTM_INTERVAL && pt->seconds == 0)
-			pt->seconds = 1;
-		V_pf_default_rule.timeout[pt->timeout] = pt->seconds;
-		if (pt->timeout == PFTM_INTERVAL && pt->seconds < old)
-			wakeup(pf_purge_thread);
-		pt->seconds = old;
-		PF_RULES_WUNLOCK();
+		error = pf_ioctl_set_timeout(pt->timeout, pt->seconds,
+		    &pt->seconds);
 		break;
 	}
 
 	case DIOCGETTIMEOUT: {
 		struct pfioc_tm	*pt = (struct pfioc_tm *)addr;
 
-		if (pt->timeout < 0 || pt->timeout >= PFTM_MAX) {
-			error = EINVAL;
-			break;
-		}
-		PF_RULES_RLOCK();
-		pt->seconds = V_pf_default_rule.timeout[pt->timeout];
-		PF_RULES_RUNLOCK();
+		error = pf_ioctl_get_timeout(pt->timeout, &pt->seconds);
 		break;
 	}
 
diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
index cf5146c716c6..026f8caab535 100644
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -1349,6 +1349,67 @@ pf_handle_set_debug(struct nlmsghdr *hdr, struct nl_pstate *npt)
 	return (0);
 }
 
+struct pf_nl_set_timeout
+{
+	uint32_t timeout;
+	uint32_t seconds;
+};
+#define	_OUT(_field)	offsetof(struct pf_nl_set_timeout, _field)
+static const struct nlattr_parser nla_p_set_timeout[] = {
+	{ .type = PF_TO_TIMEOUT, .off = _OUT(timeout), .cb = nlattr_get_uint32 },
+	{ .type = PF_TO_SECONDS, .off = _OUT(seconds), .cb = nlattr_get_uint32 },
+};
+static const struct nlfield_parser nlf_p_set_timeout[] = {};
+#undef _OUT
+NL_DECLARE_PARSER(set_timeout_parser, struct genlmsghdr, nlf_p_set_timeout, nla_p_set_timeout);
+
+static int
+pf_handle_set_timeout(struct nlmsghdr *hdr, struct nl_pstate *npt)
+{
+	struct pf_nl_set_timeout attrs = {};
+	int error;
+
+	error = nl_parse_nlmsg(hdr, &set_timeout_parser, npt, &attrs);
+	if (error != 0)
+		return (error);
+
+	return (pf_ioctl_set_timeout(attrs.timeout, attrs.seconds, NULL));
+}
+
+static int
+pf_handle_get_timeout(struct nlmsghdr *hdr, struct nl_pstate *npt)
+{
+	struct pf_nl_set_timeout attrs = {};
+	struct nl_writer *nw = npt->nw;
+	struct genlmsghdr *ghdr_new;
+	int error;
+
+	error = nl_parse_nlmsg(hdr, &set_timeout_parser, npt, &attrs);
+	if (error != 0)
+		return (error);
+
+	error = pf_ioctl_get_timeout(attrs.timeout, &attrs.seconds);
+	if (error != 0)
+		return (error);
+
+	if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr)))
+		return (ENOMEM);
+
+	ghdr_new = nlmsg_reserve_object(nw, struct genlmsghdr);
+	ghdr_new->cmd = PFNL_CMD_GET_TIMEOUT;
+	ghdr_new->version = 0;
+	ghdr_new->reserved = 0;
+
+	nlattr_add_u32(nw, PF_TO_SECONDS, attrs.seconds);
+
+	if (!nlmsg_end(nw)) {
+		nlmsg_abort(nw);
+		return (ENOMEM);
+	}
+
+	return (0);
+}
+
 static const struct nlhdr_parser *all_parsers[] = {
 	&state_parser,
 	&addrule_parser,
@@ -1357,6 +1418,7 @@ static const struct nlhdr_parser *all_parsers[] = {
 	&set_statusif_parser,
 	&natlook_parser,
 	&set_debug_parser,
+	&set_timeout_parser,
 };
 
 static int family_id;
@@ -1460,6 +1522,20 @@ static const struct genl_cmd pf_cmds[] = {
 		.cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL,
 		.cmd_priv = PRIV_NETINET_PF,
 	},
+	{
+		.cmd_num = PFNL_CMD_SET_TIMEOUT,
+		.cmd_name = "SET_TIMEOUT",
+		.cmd_cb = pf_handle_set_timeout,
+		.cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL,
+		.cmd_priv = PRIV_NETINET_PF,
+	},
+	{
+		.cmd_num = PFNL_CMD_GET_TIMEOUT,
+		.cmd_name = "GET_TIMEOUT",
+		.cmd_cb = pf_handle_get_timeout,
+		.cmd_flags = GENL_CMD_CAP_DUMP | GENL_CMD_CAP_HASPOL,
+		.cmd_priv = PRIV_NETINET_PF,
+	},
 };
 
 void
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
index ab199e308a38..5f9d8166ca50 100644
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -50,6 +50,8 @@ enum {
 	PFNL_CMD_CLEAR_STATUS = 12,
 	PFNL_CMD_NATLOOK = 13,
 	PFNL_CMD_SET_DEBUG = 14,
+	PFNL_CMD_SET_TIMEOUT = 15,
+	PFNL_CMD_GET_TIMEOUT = 16,
 	__PFNL_CMD_MAX,
 };
 #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1)
@@ -334,6 +336,12 @@ enum pf_set_debug_types_t {
 	PF_SD_LEVEL		= 1, /* u32 */
 };
 
+enum pf_timeout_types_t {
+	PF_TO_UNSPEC,
+	PF_TO_TIMEOUT		= 1, /* u32 */
+	PF_TO_SECONDS		= 2, /* u32 */
+};
+
 #ifdef _KERNEL
 
 void	pf_nl_register(void);

From nobody Thu Jun  6 20:40:37 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwGS541hkz5MwnW;
	Thu, 06 Jun 2024 20:40:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwGS52Wjxz4nq8;
	Thu,  6 Jun 2024 20:40:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717706437;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=F3KMmmtqT+6sr21ha6J85NhUnQERN3RDL1oPHMVougQ=;
	b=bBb0kETG7IifTKAhvjSxZUi0hG945bDCrhgjhLkEUYl8/kyksvAVCiD/cDeXNFeC7OMi2i
	dsuvYjIqBQUslO3E/34haVb4o6LQHYCN/syFieOmZrcLq/7nJgmbhH7+TJkdjXW21zeemm
	7eWY+L+iJRKCX0QostFS5/rR8d/4fztPIuNEIXtf8zfkWhAkZrM+D5I5KXEV0tMMBA5fIK
	q4Pf6TMI+ZMoqbwWMCLRCqphIsvDggeP5jsjKJHy99Mz/MfYyxi55QBDwUHc6uSa3J49tr
	oi37Tj6dbtRM5dyyOVNBEWizGtOEmANvxA+g3swktsSII9x2A6cj5y8mpeKQLA==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706437; a=rsa-sha256; cv=none;
	b=F3x5JjGtaAyfNH630aZdvIjZmAsbpYO/jNNfyZppw3jUopintmVSnCv9KK0ZQltHytpyf/
	T23ehS8hWRmMHLQVJ5WDL/5xqOgDU59OMAi2y1Fs2Bc4ys8vGqIzaUSlyzjc8peFTdTLAw
	R04VaDIrJZDpbWP6eoWXSsXebB9boc1pys2zen29uqcelEuOt6xSETmE29htxksZhqgU7X
	vWrJuv7KXPb9ApdzYZ+tPNfqjo/A0EC7JTGYKwLihKszYS5lNwGOu3CwfncecbA1F8C2CF
	hnkJDDmLZ+j6KlP4vCp8QnLjCxY1reP3vgE2QWMSEgQrLnOyUq4xH4RTJPoMOw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717706437;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=F3KMmmtqT+6sr21ha6J85NhUnQERN3RDL1oPHMVougQ=;
	b=VnyL9NYs+cGT9k7rp3/4187vYtLtL00VqWJ+7bYbKjEmra5BOpG92uYwVpeCiDz2QZWbHV
	hp5kdUdOkkzLnj70CvwqISxhetgXYjetS0mDkJvXs03MmcKuBby5D6DbXWuQY5WUZ4kbrx
	b92y/FNLJTa33hVLQmgmCUnKhqFkudIrbve5O9Kh9U+6UI87NeHnwa2Rw2O8ce3vNhSvsQ
	YP0XzTUzKWi6YqsLLs0tEbrJvBexyIoU2mTO6pzlskBP/lLI3JGJJMR+NYmZjlvO7xVf5R
	aAmw31rUcugkZde4tgU8hEYGOEHXWHS//6uuoJYDw8BrN4IVcLV33Ay/UFXjEw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwGS526ywz11Gx;
	Thu,  6 Jun 2024 20:40:37 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456KebFB039932;
	Thu, 6 Jun 2024 20:40:37 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456KebHm039929;
	Thu, 6 Jun 2024 20:40:37 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 20:40:37 GMT
Message-Id: <202406062040.456KebHm039929@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: 8ed5170c66ec - main - pf tests: test setting and
  retrieving timeout values
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8ed5170c66ec4914e90c2f3657227ceb9e35193f
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=8ed5170c66ec4914e90c2f3657227ceb9e35193f

commit 8ed5170c66ec4914e90c2f3657227ceb9e35193f
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-06 15:50:42 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 18:46:19 +0000

    pf tests: test setting and retrieving timeout values
---
 tests/sys/netpfil/pf/sctp.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/sys/netpfil/pf/sctp.sh b/tests/sys/netpfil/pf/sctp.sh
index c6dba1719d00..c3e1301238b0 100644
--- a/tests/sys/netpfil/pf/sctp.sh
+++ b/tests/sys/netpfil/pf/sctp.sh
@@ -656,6 +656,37 @@ pfsync_cleanup()
 	pfsynct_cleanup
 }
 
+atf_test_case "timeout" "cleanup"
+timeout_head()
+{
+	atf_set descr 'Test setting and retrieving timeout values'
+	atf_set require.user root
+}
+
+timeout_body()
+{
+	sctp_init
+}
+
+timeout_cleanup()
+{
+	pft_cleanup
+
+	vnet_mkjail timeout
+
+	pft_set_rules timeout \
+		"set timeout sctp.first 13" \
+		"set timeout sctp.opening 14"
+
+	atf_check -s exit:0 -o match:"sctp.first.*13" \
+	    jexec timeout pfctl -st
+	atf_check -s exit:0 -o match:"sctp.opening.*14" \
+	    jexec timeout pfctl -st
+	# We've not changed other timeouts
+	atf_check -s exit:0 -o match:"sctp.established.*86400" \
+	    jexec timeout pfctl -st
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case "basic_v4"
@@ -666,4 +697,5 @@ atf_init_test_cases()
 	atf_add_test_case "nat_v6"
 	atf_add_test_case "rdr_v4"
 	atf_add_test_case "pfsync"
+	atf_add_test_case "timeout"
 }

From nobody Thu Jun  6 20:40:38 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwGS71gGdz5MwVQ;
	Thu, 06 Jun 2024 20:40:39 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwGS63YLbz4nvs;
	Thu,  6 Jun 2024 20:40:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717706438;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=SHfFWd919wqM2eXWYqDP3otpDzwbRQNkkloIt4ePwIA=;
	b=V84dCYw6kxZ+OZNcqmnjnLIq7QA8jZ+wPDeN13cKdKvuryZHitdbeUaySYnnrk6R+GdjW6
	1BwU8dqiKfobOHouF/jInmGsV1QP1F+45MvRIpAm2lW9DHtO4zx9oFWnefUQsgt2dI1iw8
	ttJSIRXuDs+T5YO7aUmyZqrdLsAfRlEQ+c4rdJKKIJv9WD1zl2XDwuISD3c83sCNL0GZr5
	ml+1+2LmF9dqFHgpxYmZlfcwvwrWNoXOc+IBUaqxfqJd0+iE5tG3aGCeSU+II/esQgruSi
	OE0o5d2wRZ69Puo6gAGavI2GV5YKBMFqQ47XD78xqi8uEWTlrQcDIKIS3kilSg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706438; a=rsa-sha256; cv=none;
	b=NTszTkBIltJaC24NMi9pIlFy3st+RLEikkwSPC8ME9tUOPWl6XM7FTJ7t5ebfCg4Rber6q
	63yYng5iyh1HnZwM2cGNSNN7HEYgzK16eD65YN+MEA5Lq8umJ9530YNvQV7hoas9Hf84Mq
	B5LM4bKPvUASnxWCh7W20f6dVPpVPpcqPVeR6dAQFBLwWR2KWRkzar4OF/XVtbnGdQIrQ8
	xW8aiHYC5dej9nreAy8yai3tkDqB2xMKrbwHWD4QU7Pfl6pNzdQ6dK4nJ6Px8pd8xxke5K
	3l1I+x/1/25qizXb8F2WiOL4mi87Ox/qskkvpmYGAlX23KqUBjLbPtS2t+FJbA==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717706438;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=SHfFWd919wqM2eXWYqDP3otpDzwbRQNkkloIt4ePwIA=;
	b=sukmt90F6hLQM/nCHgKCoPOdL8tlho9mj7MoAlIX2WohJpBJ50Tf1Xn6VOWIJpQ2ueajcK
	K8WFcdCnghdmfTn7cB2LUXmpAVqcWyWMEPM4BOtouzM3AtNISRlE3SyUyMAHWsc8xy9gft
	9cWx0Fbb55p89tTZaJDFnIUIfFNKFmTQxmEufxcY8JG9ASHasaw5dcTwwR6weSALhGjjhl
	evMNIU9p9XNhuQFMnH84NAGz7hftoRXCB65orVov8pF4UE9hoKiBgoOkkeRsJxDryJaiAH
	WHhK9y8sdGMS54lUwlHcJKs8hoSy/q9p1PGlDbhy1mLgaS3v2ThejWDCJ+vVkw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwGS637TSz11FK;
	Thu,  6 Jun 2024 20:40:38 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456KecY7039998;
	Thu, 6 Jun 2024 20:40:38 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456KecZ1039995;
	Thu, 6 Jun 2024 20:40:38 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 20:40:38 GMT
Message-Id: <202406062040.456KecZ1039995@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Kristof Provost <kp@FreeBSD.org>
Subject: git: f042e1515433 - main - pf: add sctp multihome probe
  points
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: kp
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: f042e1515433456dca4a2be8ec8ac60c75860304
Auto-Submitted: auto-generated

The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=f042e1515433456dca4a2be8ec8ac60c75860304

commit f042e1515433456dca4a2be8ec8ac60c75860304
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-06-06 15:35:09 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-06-06 18:46:19 +0000

    pf: add sctp multihome probe points
    
    Add probe points to allow us to probe when we add or remove multihome addresses.
    
    Example use:
            pf:sctp:multihome:add
            {
                    printf("Add tag %x address %x", arg0,
                        ((struct pf_sctp_source *)arg1)->addr.v4.s_addr);
            }
    
            pf:sctp:multihome:remove
            {
                    printf("Remove tag %x address %x", arg0,
                        ((struct pf_sctp_source *)arg2)->addr.v4.s_addr);
            }
    
    MFC after:      1 week
    Sponsored by:   Orange Business Services
---
 sys/netpfil/pf/pf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 064642d7da05..8c97d1bf200d 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -130,6 +130,10 @@ SDT_PROBE_DEFINE2(pf, ip, , bound_iface, "struct pf_kstate *",
     "struct pfi_kkif *");
 SDT_PROBE_DEFINE4(pf, sctp, multihome, test, "struct pfi_kkif *",
     "struct pf_krule *", "struct mbuf *", "int");
+SDT_PROBE_DEFINE2(pf, sctp, multihome, add, "uint32_t",
+    "struct pf_sctp_source *");
+SDT_PROBE_DEFINE3(pf, sctp, multihome, remove, "uint32_t",
+    "struct pf_kstate *", "struct pf_sctp_source *");
 
 SDT_PROBE_DEFINE3(pf, eth, test_rule, entry, "int", "struct ifnet *",
     "struct mbuf *");
@@ -6031,11 +6035,12 @@ pf_sctp_multihome_detach_addr(const struct pf_kstate *s)
 	key.v_tag = s->dst.scrub->pfss_v_tag;
 	ep  = RB_FIND(pf_sctp_endpoints, &V_pf_sctp_endpoints, &key);
 	if (ep != NULL) {
-		/* XXX Actually remove! */
 		TAILQ_FOREACH_SAFE(i, &ep->sources, entry, tmp) {
 			if (pf_addr_cmp(&i->addr,
 			    &s->key[PF_SK_WIRE]->addr[s->direction == PF_OUT],
 			    s->key[PF_SK_WIRE]->af) == 0) {
+				SDT_PROBE3(pf, sctp, multihome, remove,
+				    key.v_tag, s, i);
 				TAILQ_REMOVE(&ep->sources, i, entry);
 				free(i, M_PFTEMP);
 				break;
@@ -6056,6 +6061,8 @@ pf_sctp_multihome_detach_addr(const struct pf_kstate *s)
 			if (pf_addr_cmp(&i->addr,
 			    &s->key[PF_SK_WIRE]->addr[s->direction == PF_IN],
 			    s->key[PF_SK_WIRE]->af) == 0) {
+				SDT_PROBE3(pf, sctp, multihome, remove,
+				    key.v_tag, s, i);
 				TAILQ_REMOVE(&ep->sources, i, entry);
 				free(i, M_PFTEMP);
 				break;
@@ -6113,6 +6120,7 @@ pf_sctp_multihome_add_addr(struct pf_pdesc *pd, struct pf_addr *a, uint32_t v_ta
 	i->af = pd->af;
 	memcpy(&i->addr, a, sizeof(*a));
 	TAILQ_INSERT_TAIL(&ep->sources, i, entry);
+	SDT_PROBE2(pf, sctp, multihome, add, v_tag, i);
 
 	PF_SCTP_ENDPOINTS_UNLOCK();
 }

From nobody Thu Jun  6 20:42:55 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwGVl572Jz5MxHM;
	Thu, 06 Jun 2024 20:42:55 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwGVl4GJTz4q4X;
	Thu,  6 Jun 2024 20:42:55 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717706575;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=iXRg4LA7yPeGWFxkOjud6dPnB7VL9F0Ub1eECu9hQ0s=;
	b=b6cl9MVoaRvT55nJisXRiw4+z4iGyGNGRj1mGx57pHtn+C0SiZc5Fo2HHEAfmmbH38YHQl
	lvgDS5gQpWCQBr+RTcH789/DJhINi3nPm6neotcqK/nBBZqWvamsBzd/o1O5mh4/go5mij
	bbeZqsAUswBgtAIpRscOwJzcrd5Yoa0u4bNsvbPFZnKUH6qtsb/rW1CaXBBiT7i71qIH6h
	pb65pfhH1dTrv1KhSFLL1Oj2OwltHbmCH1j491R6CkyApznPXvcJJrvuwuZJrxIKR05Iu/
	l/fJu761wUYtAYYQ/XM0gsloluRbkI1XdDew0FmMFDRbxaj+g8CM5N5izjw9zg==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706575; a=rsa-sha256; cv=none;
	b=AgOE1WxiIsyynU0TA6wLRO3l5S/XRUilmtzlkHkObj0301pCvu8Jcbo1qaeJRPwjZa70k2
	PcuwA5iYr+ewXQ4wR2G0XvABTLPuM1pmS5xdBBmQz4Mq6RTs3SWJuWSvr7zkXotLZt0cj2
	8nqtwgf1QcCU6wFm4deGIePfzlx9y65NxeJ8MTy9pzXd67lvfE53G0Y3wdSOMqfU0kp7Km
	eNH+vMA7U0a/1Lf6pPLwXBT3qPNtnDIGEdIqZqjoKyOwLzfVw+qgoDcIN2WEnLdO3lXpp9
	xI8wxOX7F9VRQ9JqRmivnPlYPt3QVE/iEoSpHVfGR1QM4gg9PqEAsQyCC2dmCQ==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717706575;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=iXRg4LA7yPeGWFxkOjud6dPnB7VL9F0Ub1eECu9hQ0s=;
	b=fHy0rF3hhHNrZ32kxshxUlkIvUkLpypdBiOgMZ/NBEhqyhwb13B98ZcvZCDLby76vNCN5J
	SKOMsw138aNfzw1NtobnLMDxuAoSVZEnbjJ6XH2X8VsnozIJglUkvq2LMZfhY4ToricAso
	WXVvYanF3nRWRiQgNEaaQWvnw1GFSsPHiZplxH5vwcvysWusDTXzHKaN23l9NRtBO2B/n/
	LEibdExjSSB/B9cWcD6vX/+1UX/7YniZAOJrqx+YUAO41lya8LRrlZ3OXZmelcE+bZ67dR
	Fhz0gMa5OSePcqEhKnJWaEA+37XIMG17BxaWTq4pmbDKb8uhmdd98EOi2Vz0Zg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwGVl3shNz11fq;
	Thu,  6 Jun 2024 20:42:55 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456KgtFE046065;
	Thu, 6 Jun 2024 20:42:55 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456KgtbE046062;
	Thu, 6 Jun 2024 20:42:55 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 20:42:55 GMT
Message-Id: <202406062042.456KgtbE046062@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Vladimir Kondratyev <wulf@FreeBSD.org>
Subject: git: 21f4cf5ccf87 - main - LinuxKPI: lockdep_assert: wrong
  'cond' used in WARN_ON MACRO
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: wulf
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 21f4cf5ccf87fd15d4d71f89d4c3ecab13f26146
Auto-Submitted: auto-generated

The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=21f4cf5ccf87fd15d4d71f89d4c3ecab13f26146

commit 21f4cf5ccf87fd15d4d71f89d4c3ecab13f26146
Author:     Alvin Chen <weike.chen@dell.com>
AuthorDate: 2024-06-06 20:42:06 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-06-06 20:42:06 +0000

    LinuxKPI: lockdep_assert: wrong 'cond' used in WARN_ON MACRO
    
    'cond' in WARN_ON need be bracketed,
    otherwise it is wrong for multiple conditions.
    
    Reviewed by:    wulf
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D44604
---
 sys/compat/linuxkpi/common/include/linux/lockdep.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/lockdep.h b/sys/compat/linuxkpi/common/include/linux/lockdep.h
index a379e191aad7..5291be79218e 100644
--- a/sys/compat/linuxkpi/common/include/linux/lockdep.h
+++ b/sys/compat/linuxkpi/common/include/linux/lockdep.h
@@ -50,8 +50,8 @@ struct pin_cookie {
 #define	lockdep_unregister_key(key) do { } while(0)
 
 #ifdef INVARIANTS
-#define	lockdep_assert(cond) do { WARN_ON(!cond); } while (0)
-#define	lockdep_assert_once(cond) do { WARN_ON_ONCE(!cond); } while (0)
+#define	lockdep_assert(cond) do { WARN_ON(!(cond)); } while (0)
+#define	lockdep_assert_once(cond) do { WARN_ON_ONCE(!(cond)); } while (0)
 
 #define	lockdep_assert_not_held(m) do {					\
 	struct lock_object *__lock = (struct lock_object *)(m);		\

From nobody Thu Jun  6 20:42:56 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwGVm5y6Bz5MxS0;
	Thu, 06 Jun 2024 20:42:56 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwGVm5KZrz4qFL;
	Thu,  6 Jun 2024 20:42:56 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717706576;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=X37iVPx7SkopSCraHL+SO9ZQUUREDZsPmc/MinC6xow=;
	b=b6dgZv+3xg72B0CY6re2X8bU1vCkQrGFRxF1F/PMii/WCkOYiblTliaqh2mOLgNM8bhvvH
	pO0JqZ/aMuhp1JxW3XGNAU29HZiAcJJguaQ2eja89S+Ur5f3kfhZs65eEdL6h+eaMIXZFk
	rJh4ez9hrEcwFDvXIZvSo7MG5IW1WmVXYl0E17Dk2hQt+g329U8621JelnBOSgsch9/wAv
	Ja2ZeNcBc0exr5ISlGl0/31CXdbXL0K7IRW7wDdNHhdOjF5xWTx2rkQ4G2kFB5qJEcMfO5
	bL+I57g96ga118QBW3AcHWMfllmh7cxnp7hjA9XQKOWLsm0s1xlu5pPQKKpZtQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706576; a=rsa-sha256; cv=none;
	b=NwR24XUmec23MNAQ5VtrLM4edHSfO6gbckt7w4902y6A9vxPBcADYCbBr0eB8+lqDHXvDJ
	4dfXXK+Tz1YqOlD6Qsu17cWC0Df03kzukesFQBiBky7+T298+e0ExD5gG+CW4pHEc4/s4W
	8kOKchAWhZkbmF/BM0efw5P0ehkUI3V4gyC6iRQNbLXaud4ug//8+lLR6RPyvEdZ9djHQs
	9Vk72frqHMIGbVoQbYQ0d2PeCgPYAiNOvgWrmAUkpWaNGNNzwYR7GwngUMyhp8+gEhtSWt
	QgQnuUlcpotOjzNMVOh+TjgVO/YiGXD4qTiP0S5IuHugMlhWnFauAQza/2Abfg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717706576;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=X37iVPx7SkopSCraHL+SO9ZQUUREDZsPmc/MinC6xow=;
	b=TZQqa9eTFRIUz8700a5eh2H8F0M4sATXOfTENT2s4CjZpn6SLfI+LJgZnQ6VPlT0CTUv15
	TUYJo2TXdHaF5l39T2yK8eIai2MAX281Ft7jrMPQYTs+fuc3tGMLT9v9unZLpgTzZZL3sZ
	pM7XwNnl3f1pW3BAraK+yP67UUugX3eUAtlZx6pnjLI5pZ7vBoOhRZ65TRuutwYxlku2hv
	2A/ACJqDPgKTe2FABEsa5la6rVIgdOP83GFfQUTm+NRy0nHkh4JyOawpYY0lpiWH7CLcSc
	Vs13uE3CJzZ2fi0cr15/gBnhw6dRukkck+tanJPfv0J0d949fu7qWKsFhw+uiw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwGVm4w0pz11Hf;
	Thu,  6 Jun 2024 20:42:56 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456KguFw046123;
	Thu, 6 Jun 2024 20:42:56 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kgus0046120;
	Thu, 6 Jun 2024 20:42:56 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 20:42:56 GMT
Message-Id: <202406062042.456Kgus0046120@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Vladimir Kondratyev <wulf@FreeBSD.org>
Subject: git: 613723bac219 - main - linuxkpi: Allow ida_destroy and
  idr_destroy to be called multiple times
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: wulf
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 613723bac219cb08ac1ad0afd3e07850d7fccc10
Auto-Submitted: auto-generated

The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=613723bac219cb08ac1ad0afd3e07850d7fccc10

commit 613723bac219cb08ac1ad0afd3e07850d7fccc10
Author:     Austin Shafer <ashafer@badland.io>
AuthorDate: 2024-06-06 20:42:06 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-06-06 20:42:06 +0000

    linuxkpi: Allow ida_destroy and idr_destroy to be called multiple times
    
    This fixes some weird behavior triggered by nvidia-drm.ko: some DRM
    cleanup functions will be called multiple times, leading to a double
    free. drm_mode_config_cleanup will be called twice, causing ida_destroy
    to be called twice. Although calling the cleanup twice doesn't seem
    very clean, on Linux this seems to be permissable as it handles it
    just fine. Not doing these checks causes mutex panics and double frees.
    
    In order to preserve this behavior this change checks if the objects
    have already been destroyed and bails if so. This fixes the panic seen
    when unloading the nvidia-drm driver.
    
    MFC after:      1 week
    Reviewed by:    bz, manu
    Differential revision:  https://reviews.freebsd.org/D44865
---
 sys/compat/linuxkpi/common/src/linux_idr.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_idr.c b/sys/compat/linuxkpi/common/src/linux_idr.c
index 583e2c237198..59c375194689 100644
--- a/sys/compat/linuxkpi/common/src/linux_idr.c
+++ b/sys/compat/linuxkpi/common/src/linux_idr.c
@@ -178,6 +178,14 @@ idr_destroy(struct idr *idr)
 {
 	struct idr_layer *il, *iln;
 
+	/*
+	 * This idr can be reused, and this function might be called multiple times
+	 * without a idr_init(). Check if this is the case.  If we do not do this
+	 * then the mutex will panic while asserting that it is valid.
+	 */
+	if (mtx_initialized(&idr->lock) == 0)
+		return;
+
 	idr_remove_all(idr);
 	mtx_lock(&idr->lock);
 	for (il = idr->free; il != NULL; il = iln) {
@@ -802,4 +810,5 @@ ida_destroy(struct ida *ida)
 {
 	idr_destroy(&ida->idr);
 	free(ida->free_bitmap, M_IDR);
+	ida->free_bitmap = NULL;
 }

From nobody Thu Jun  6 20:42:57 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwGVp0y1Zz5MxM7;
	Thu, 06 Jun 2024 20:42:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwGVn67YLz4qPt;
	Thu,  6 Jun 2024 20:42:57 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717706577;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ZzvPY8roJaxK4zCtWE9VqQiBWAidUMRy9dTruaUTGY8=;
	b=dtI5nF8UF2H07g/MQEF1wCEeMqA1WxNUwuU3HcxUFohMHhqzxoFCL1wDIewzBPiZhmgGRT
	lC495YaovSV3xRs1TrP4Q6GsQ3ExWeSceMM9YyvIkMoU4W/ZB0S52CMI7lpyE9GaGSFGSe
	t02bN4KmkvXKVpgJlA58WOAFdlgom88LpsOGMYlMeDzxUz2qQq22yIcCvYAf6B+ozYkh+B
	tw/03pAnuODa70sViEzgyn34BiR+AJoBBTa5uMUG/q/oSn6JK1MU8NTbblv+Ewj3DduYV1
	W3G/HtjeL5bNz+ec073+A2rIyfx5CqQQbAjEwt4a2VTEyHcYdL8Ek01qxqXVFw==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706577; a=rsa-sha256; cv=none;
	b=gH8D9gM1b1IMwA7NBp1+nfDVR9r5OGulUO3g/UTTLLIq1xRkjB2ccxOapDEvVa/+hGIg8m
	pRLy9PU9ijbsl5EBW4RzlWV/1LIjktvdkRZnUw8gn9HJKdNm6Mfn5bnInlo1ESRliCMxNr
	oQ/iR1uGrETfaielI3gf6VqulNPahxQqBKdcMvuSsCTC6oLB8XeNANwEcMg37D5DPE9IDh
	7EU3jUvnzSo5iAkuz43IDIYCMUVUFOEU87W0VXEnvLew4ZN7Kg/d1Ne9AzSeFAkrjmy/Te
	qezQ06WkofA2MDZ74BsQnjmY5Xm2J5dm+tldjksxzkzQ9e6QKfLNVAFz1KV3Lw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717706577;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=ZzvPY8roJaxK4zCtWE9VqQiBWAidUMRy9dTruaUTGY8=;
	b=tftGlrHNjRZOFXQ5TePM24winYpZhTXcqgnCFlITnZBPhJOr39qAHbsQ8fH0ImpY1JKDjr
	ueStqjD0EAXVDN7KtUlWGkj8b/FtHfny3a7dVDrS3/me5T3C+T1GH91gCIittxLqF8MVch
	RQRGv+W9NopV23NTBYrVZjoOP0omVAs1RHPJOl3VjU0tZc0VK80nbYLpgFgYARx+ZXRt25
	pO/9036+6U5v2WyUn5Dbkz/+MzNgz61z4XeP4yvM6ZfyvFsNqfcUBkpBybWJr3YVCN79c2
	YQa5WTgo0yEfMreShdDxMb9cFZTNgZUZV//EG57+I/SpsWyHG1c51ZlGrjVYYg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwGVn5hMfz11Hg;
	Thu,  6 Jun 2024 20:42:57 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456Kgvig046174;
	Thu, 6 Jun 2024 20:42:57 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kgv5S046171;
	Thu, 6 Jun 2024 20:42:57 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 20:42:57 GMT
Message-Id: <202406062042.456Kgv5S046171@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Vladimir Kondratyev <wulf@FreeBSD.org>
Subject: git: cb8bfc4db8ca - main - LinuxKPI: Move page_address
  definition from linux/gfp.h to linux/mm.h
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: wulf
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: cb8bfc4db8ca8f4ed03406a554e77a013696c8e0
Auto-Submitted: auto-generated

The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb8bfc4db8ca8f4ed03406a554e77a013696c8e0

commit cb8bfc4db8ca8f4ed03406a554e77a013696c8e0
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-06-06 20:42:06 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-06-06 20:42:06 +0000

    LinuxKPI: Move page_address definition from linux/gfp.h to linux/mm.h
    
    To match Linux. Some future changes may depend on proper location.
    
    Sponsored by:   Serenity Cyber Security, LLC
    MFC after:      1 week
    Reviewed by:    bz, emaste
    Differential Revision:  https://reviews.freebsd.org/D45448
---
 sys/compat/linuxkpi/common/include/linux/gfp.h | 9 ---------
 sys/compat/linuxkpi/common/include/linux/mm.h  | 8 ++++++++
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h
index 8a0ce489f19f..bd8fa1a18372 100644
--- a/sys/compat/linuxkpi/common/include/linux/gfp.h
+++ b/sys/compat/linuxkpi/common/include/linux/gfp.h
@@ -84,15 +84,6 @@ struct page_frag_cache {
 	int pagecnt_bias;
 };
 
-/*
- * Resolve a page into a virtual address:
- *
- * NOTE: This function only works for pages allocated by the kernel.
- */
-void *linux_page_address(struct page *);
-
-#define	page_address(page) linux_page_address(page)
-
 /*
  * Page management for unmapped pages:
  */
diff --git a/sys/compat/linuxkpi/common/include/linux/mm.h b/sys/compat/linuxkpi/common/include/linux/mm.h
index 109bfffe7d6a..41af4be4c015 100644
--- a/sys/compat/linuxkpi/common/include/linux/mm.h
+++ b/sys/compat/linuxkpi/common/include/linux/mm.h
@@ -178,6 +178,14 @@ get_order(unsigned long size)
 	return (order);
 }
 
+/*
+ * Resolve a page into a virtual address:
+ *
+ * NOTE: This function only works for pages allocated by the kernel.
+ */
+void *linux_page_address(struct page *);
+#define	page_address(page) linux_page_address(page)
+
 static inline void *
 lowmem_page_address(struct page *page)
 {

From nobody Thu Jun  6 20:42:58 2024
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwGVq24MPz5MxM8;
	Thu, 06 Jun 2024 20:42:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4VwGVq0Rntz4qQ9;
	Thu,  6 Jun 2024 20:42:59 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1717706579;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=oQjuRPEw+uVkqrkWg2cxE0xNPCiF7g+uWHbrrI7tHy8=;
	b=ltUyjtKr2OB1lRksCW5wLP8UGdHcZ1eAu9qq0v+hVOPo31P4FbaG6TRuDz5oeKVZZ1IirG
	hXzltc9jHn7rzFrtgjL7J/p5R21rlVXCBRwUtA0vOIlZA/wXbjT6NM2HFG5LuXrDBmkbsR
	wBlAr4bRbMFg97uJ6NRkKkGIj2a89VogDKVx6AQyPzqOW5ar8qO2Ca3oz5qGGTfci5O74s
	zT7UJRD1bolSBF/GazWVbkSzPSBZgchKeclG77lVcd9pXi4OtAewFRYOo//12EXqMNcTaz
	7M/qGsD73Rp6R3L/NWB6+fOkmfVkZB4ip+d5NQpY6ErPRCd6pa+3Q/Ii7LqM/Q==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706579; a=rsa-sha256; cv=none;
	b=Qeal5l5U6O/igL/8kDP8nDN5+fIqntsejW7aFDJYr2O58EEVZ1LEyrEXM92eYDEt2u2SbA
	aQaX8t8N0r0qTdKNQSAGi6LiwnhB9vZFlz8MYjL7Bj82ETGd/uxTE87ZLBpM9DWeooYUBQ
	UFDFTDFWgQ3RSmVxn4jAFRqHTOKmJeEg9alJoHqpEZoHJ6Qook7ujD0/2IYom/jXfue5DR
	Ea198oWv7nT5l3tMlbnEM9jsVbuZcoDS2LfUtKU4y/x8qbF7kgsPHU6K4cI4lGPQ6WqTMU
	S085xj1MUL2PDH4esLyQx8ma22PByEz6Y59yzjuR5GsUQcCtfaViSma76Fp0wg==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1717706579;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=oQjuRPEw+uVkqrkWg2cxE0xNPCiF7g+uWHbrrI7tHy8=;
	b=QcpEtJxdTgzDDilej7TiM3GnpP107zRrrAAkjne3BZjcRoagohAjO0uNYZtnE1yff4XB5a
	eu//nlOF4vzyqSMvRkQ1IZ7x5OLOiOGFv4r3SnKJihJlqb7jfN44J34JyzjAsh3yTU8G0u
	ccTLVanhtKQ6EXmKKTttonyeDO8q86eGCYPDzRe8Bm6wS06am2wN7FtimmQUJzG7dPkgO+
	lA6QGZK+CwV58u3Pn/LZtvHkSpUtJrYcb0fy6PYmNcq8HwePNYWsp+c7WEazwO3hwQ+TtD
	oldUWoS7waWF555g0I2OcOKLj/lDpvzjlz9yxm6TwIR7alhCxxfFGmIqNvui3g==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwGVp6nnSz11Hh;
	Thu,  6 Jun 2024 20:42:58 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456KgwxF046222;
	Thu, 6 Jun 2024 20:42:58 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kgw73046219;
	Thu, 6 Jun 2024 20:42:58 GMT
	(envelope-from git)
Date: Thu, 6 Jun 2024 20:42:58 GMT
Message-Id: <202406062042.456Kgw73046219@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
        dev-commits-src-main@FreeBSD.org
From: Vladimir Kondratyev <wulf@FreeBSD.org>
Subject: git: f79474c4e3ee - main - LinuxKPI: Move linux/minmax.h
  content out of linux/kernel.h
List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help: <mailto:dev-commits-src-main+help@freebsd.org>
List-Post: <mailto:dev-commits-src-main@freebsd.org>
List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org>
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: wulf
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: f79474c4e3eeb48c6acb0a9e3163195a50cef577
Auto-Submitted: auto-generated

The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=f79474c4e3eeb48c6acb0a9e3163195a50cef577

commit f79474c4e3eeb48c6acb0a9e3163195a50cef577
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2024-06-06 20:42:06 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-06-06 20:42:06 +0000

    LinuxKPI: Move linux/minmax.h content out of linux/kernel.h
    
    To match Linux and allow direct linux/minmax.h inclusion.
    
    Sponsored by:   Serenity Cyber Security, LLC
    MFC after:      1 week
    Reviewed by:    bz
    Differential Revision:  https://reviews.freebsd.org/D45449
---
 sys/compat/linuxkpi/common/include/linux/kernel.h | 28 +---------
 sys/compat/linuxkpi/common/include/linux/minmax.h | 67 +++++++++++++++++++++++
 2 files changed, 68 insertions(+), 27 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index ed4320e80fa7..d616aa542784 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -45,6 +45,7 @@
 #include <linux/compiler.h>
 #include <linux/container_of.h>
 #include <linux/limits.h>
+#include <linux/minmax.h>
 #include <linux/stringify.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
@@ -517,29 +518,9 @@ kstrtou8_from_user(const char __user *s, size_t count, unsigned int base,
 	return (kstrtou8(buf, base, p));
 }
 
-#define min(x, y)	((x) < (y) ? (x) : (y))
-#define max(x, y)	((x) > (y) ? (x) : (y))
-
-#define min3(a, b, c)	min(a, min(b,c))
-#define max3(a, b, c)	max(a, max(b,c))
-
-#define	min_t(type, x, y) ({			\
-	type __min1 = (x);			\
-	type __min2 = (y);			\
-	__min1 < __min2 ? __min1 : __min2; })
-
-#define	max_t(type, x, y) ({			\
-	type __max1 = (x);			\
-	type __max2 = (y);			\
-	__max1 > __max2 ? __max1 : __max2; })
-
 #define offsetofend(t, m)	\
         (offsetof(t, m) + sizeof((((t *)0)->m)))
 
-#define clamp_t(type, _x, min, max)	min_t(type, max_t(type, _x, min), max)
-#define clamp(x, lo, hi)		min( max(x,lo), hi)
-#define	clamp_val(val, lo, hi) clamp_t(typeof(val), val, lo, hi)
-
 /*
  * This looks more complex than it should be. But we need to
  * get the type for the ~ right in round_down (it needs to be
@@ -559,13 +540,6 @@ extern bool linux_cpu_has_clflush;
 #define	cpu_has_clflush		linux_cpu_has_clflush
 #endif
 
-/* Swap values of a and b */
-#define swap(a, b) do {			\
-	typeof(a) _swap_tmp = a;	\
-	a = b;				\
-	b = _swap_tmp;			\
-} while (0)
-
 #define	DIV_ROUND_CLOSEST(x, divisor)	(((x) + ((divisor) / 2)) / (divisor))
 
 #define	DIV_ROUND_CLOSEST_ULL(x, divisor) ({		\
diff --git a/sys/compat/linuxkpi/common/include/linux/minmax.h b/sys/compat/linuxkpi/common/include/linux/minmax.h
new file mode 100644
index 000000000000..465607371b9b
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/minmax.h
@@ -0,0 +1,67 @@
+/*-
+ * SPDX-License-Id