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 Subject: git: 0f996f45418e - main - sqlite3: Vendor import of sqlite3 3.46.0 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 01:40:14 +0000 Commit: Cy Schubert 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 , 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 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 Reply-To: d@delphij.net To: Wolfram Schneider , 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 Subject: git: 645a228481c7 - main - ds1307: Return error code instead of boolean List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 13:41:11 +0000 Commit: Dmitry Salychev 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 14:58:18 +0000 Commit: Warner Losh 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-05-31 17:48:10 +0000 Commit: Gordon Tetlow 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-05-31 20:58:52 +0000 Commit: Gordon Tetlow 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 Subject: git: 80828c6fab02 - main - kern: Remove leftover saf1761otg bits List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-05-25 20:26:28 +0000 Commit: Mitchell Horne 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 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 Subject: git: 965fff98260f - main - man(1): ignore absolute path for .so include List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 16:00:42 +0000 Commit: Wolfram Schneider 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 Subject: git: b0056b31e900 - main - libkern: add ilog2 macro List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 16:37:55 +0000 Commit: Doug Moore 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 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: References: <202406021843.452Ih9Us047105@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 > AuthorDate: 2024-06-02 18:36:55 +0000 > Commit: Brooks Davis > 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 ; 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 ; 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 ; 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 In-Reply-To: <202406021227.452CRx8I007470@gitrepo.freebsd.org> Date: Mon, 3 Jun 2024 18:25:59 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@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?= 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 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 > AuthorDate: 2024-06-02 12:07:52 +0000 > Commit: Stefan E=C3=9Fer > 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 17:45:45 +0000 Commit: Doug Moore 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 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke cc: =?utf-8?Q?Stefan_E=C3=9Fer?= , "src-committers@freebsd.org" , "dev-commits-src-all@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 message dated "Mon, 03 Jun 2024 18:25:59 +0100." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 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 > > AuthorDate: 2024-06-02 12:07:52 +0000 > > Commit: Stefan E=C3=9Fer > > 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 FreeBSD UNIX: Web: https://FreeBSD.org NTP: 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 18:07:42 +0000 Commit: Doug Moore 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 Subject: git: 5dda778db634 - main - Use correct function declaration for yyerror List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 17:30:52 +0000 Commit: Warner Losh 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 ; 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 ; 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 ; 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 In-Reply-To: <202406031814.453IEsLL048613@gitrepo.freebsd.org> Date: Mon, 3 Jun 2024 19:19:44 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@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 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 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 > AuthorDate: 2024-06-03 17:30:52 +0000 > Commit: Warner Losh > 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 Subject: git: 08f6f78f81e2 - main - libkern: don't use MPASS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 18:20:00 +0000 Commit: Doug Moore 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 18:31:19 +0000 Commit: Doug Moore 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 ; 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 ; 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 ; 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 Date: Mon, 3 Jun 2024 12:38:50 -0600 Message-ID: Subject: Re: git: 5dda778db634 - main - Use correct function declaration for yyerror To: Jessica Clarke Cc: Warner Losh , "src-committers@freebsd.org" , "dev-commits-src-all@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 = wrote: > On 3 Jun 2024, at 19:14, Warner Losh wrote: > > > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D5dda778db63407214394c3cf63fb131= 2a4981024 > > > > commit 5dda778db63407214394c3cf63fb1312a4981024 > > Author: Dapeng Gao > > AuthorDate: 2024-06-03 17:30:52 +0000 > > Commit: Warner Losh > > 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

On Mon, Jun 3, 2024 at 12:19=E2=80=AFPM J= essica Clarke <jrtc27@freebsd.org<= /a>> wrote:
O= n 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=3D5dda778db63407214394c3cf63fb1312a4981024<= /a>
>
> commit 5dda778db63407214394c3cf63fb1312a4981024
> Author:=C2=A0 =C2=A0 =C2=A0Dapeng Gao <
dg612@cam.ac.uk>
> AuthorDate: 2024-06-03 17:30:52 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2024-06-03 18:14:10 +0000
>
>=C2=A0 =C2=A0 Use correct function declaration for yyerror
>
>=C2=A0 =C2=A0 According to the POSIX standard at
>=C2=A0 =C2=A0 https://pubs.o= pengroup.org/onlinepubs/9699919799/utilities/yacc.html
>=C2=A0 =C2=A0 `yyerror` should return `int`. Add unreachable since errx= never returns.
>
>=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 imp, kib
>=C2=A0 =C2=A0 Differential Revision:=C2=A0 https://reviews.fre= ebsd.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)
{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 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=C2= =A0
--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 Subject: git: 3ca6bf792924 - main - db_show_buffer: minor cleanup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 18:35:28 +0000 Commit: Ryan Libby 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 Subject: git: 7f1012ff7c8b - main - pctrie: predict successful allocation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 18:35:28 +0000 Commit: Ryan Libby 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 Subject: git: fbfdf57d65be - main - Fix off-by-one bug in btpand List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 19:30:36 +0000 Commit: Jessica Clarke 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 Subject: git: e0dcb9b611d3 - main - mfi: correct typo in sysctl/tunable description List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 20:31:16 +0000 Commit: Ed Maste 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 Subject: git: f3ab0d86e807 - main - bitset: Fix __BIT_FFS_AT()'s herald comment List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 19:22:12 +0000 Commit: Olivier Certner 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 Subject: git: ef659a2d041c - main - snd_hda: Add Lenovo X1 Carbon Gen11 support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 00:00:12 +0000 Commit: Christos Margiolis 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 Subject: git: badf44cc2124 - main - mbuf: provide m_freemp() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 00:22:07 +0000 Commit: Gleb Smirnoff 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 /* 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 00:22:33 +0000 Commit: Gleb Smirnoff 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 Subject: git: 3b35e7ee8de9 - main - MFV: xz 5.6.2. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 01:14:43 +0000 Commit: Xin LI 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 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 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 . */ ++/* Define to 1 if 'CLOCK_MONOTONIC' is declared in . */ +#define HAVE_CLOCK_MONOTONIC 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */ + +/* Define to 1 if you have the 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 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 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 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 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 header file. */ +#define HAVE_INTTYPES_H 1 + - /* Define to 1 if you have the 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 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 . */ ++/* Define to 1 if 'program_invocation_name' is declared in . */ +/* #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 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 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 header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the 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 header file. */ +/* #undef HAVE_SYS_BYTEORDER_H */ + - #ifndef WITHOUT_CAPSICUM - /* Define to 1 if you have the header file. */ - #define HAVE_SYS_CAPSICUM_H 1 - #endif ++/* Define to 1 if you have the header file. */ ++#define HAVE_SYS_CDEFS_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ENDIAN_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + - /* Define to 1 if you have the header file. */ - #define HAVE_SYS_TIME_H 1 - +/* Define to 1 if you have the 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 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 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-02 08:56:47 +0000 Commit: Alan Cox 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?= Subject: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 06:26:09 +0000 Commit: Stefan Eßer 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: Date: Tue, 4 Jun 2024 08:39:16 +0200 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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?= Subject: Re: git: 077f757d72e5 - main - newfs_msdos: align data area to VM page boundary by default To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@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 wrote: >> >> The branch main has been updated by se: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=077f757d72e561eb84193d8e58f63e96e69b8096 >> >> commit 077f757d72e561eb84193d8e58f63e96e69b8096 >> Author: Stefan Eßer >> AuthorDate: 2024-06-02 12:07:52 +0000 >> Commit: Stefan Eßer >> 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?= Subject: git: 5e09c5a1ed66 - main - bhyve: use correct size to map the OpRegion List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2023-12-18 12:44:04 +0000 Commit: Corvin Köhne 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?= Subject: git: e425e601b978 - main - bhyve: verify OpRegion size List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2023-12-15 11:46:09 +0000 Commit: Corvin Köhne 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 07:39:40 +0000 Commit: Peter Holm 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 #include #include +#include #include 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 -#include -#include +#include #include #include -#include #include #include #include +#include +#include +#include +#include #include 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 ", 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 Subject: git: 9dbbe68bc5f2 - main - pf: convert DIOCCLRSTATUS to netlink List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-05-30 17:31:26 +0000 Commit: Kristof Provost 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 Subject: git: a9d7ff4e5e6d - main - pf tests: basic status get/clear test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-05-30 18:28:30 +0000 Commit: Kristof Provost 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 Subject: git: 71d3c7041d70 - main - pf: convert DIOCNATLOOK to netlink List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-05-31 13:51:38 +0000 Commit: Kristof Provost 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 +#include "opt_inet.h" +#include "opt_inet6.h" #include #include @@ -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 Subject: git: c36c90a2cc17 - main - pf: convert DIOCSETDEBUG to netlink List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-01 18:07:22 +0000 Commit: Kristof Provost 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 Subject: git: cce69517551d - main - pf tests: basic debug level test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-01 18:07:56 +0000 Commit: Kristof Provost 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-01 20:37:36 +0000 Commit: Kristof Provost 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 Subject: git: 2144e31d8f85 - main - netpfil tests: make the pls tests more robust List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-03 19:27:59 +0000 Commit: Kristof Provost 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 ; 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 ; 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 ; 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 To: Stefan =?utf-8?B?RcOfZXI=?= 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: 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 > AuthorDate: 2024-06-04 06:26:09 +0000 > Commit: Stefan E=DFer > 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 ; 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 ; 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 ; 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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> In-Reply-To: From: Warner Losh Date: Tue, 4 Jun 2024 09:46:54 -0600 Message-ID: Subject: Re: git: 41ee91c64f47 - main - newfs_msdos: fix build on non-FreeBSD systems To: Shawn Webb Cc: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= , 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 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 > > AuthorDate: 2024-06-04 06:26:09 +0000 > > Commit: Stefan E=C3=9Fer > > 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


=
On Tue, Jun 4, 2024 at 9:22=E2=80=AFA= M Shawn Webb <shawn.webb@h= ardenedbsd.org> wrote:
On Tue, Jun 04, 2024 at 06:28:19AM +0000, Stefan E=C3=9Fer wr= ote:
> The branch main has been updated by se:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb60fa486a<= /a>
>
> commit 41ee91c64f47faaa8131df3cd8a63bdb60fa486a
> Author:=C2=A0 =C2=A0 =C2=A0Stefan E=C3=9Fer <se@FreeBSD.org>
> AuthorDate: 2024-06-04 06:26:09 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Stefan E=C3=9Fer <se@FreeBSD.org>
> CommitDate: 2024-06-04 06:26:09 +0000
>
>=C2=A0 =C2=A0 =C2=A0newfs_msdos: fix build on non-FreeBSD systems
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Disable data area alignment if the build environmen= t does not define
>=C2=A0 =C2=A0 =C2=A0PAGE_SIZE (e.g., when building on Linux or macOS).<= br> >=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0Reported by:=C2=A0 =C2=A0 jrtc27
>=C2=A0 =C2=A0 =C2=A0MFC after:=C2=A0 =C2=A0 =C2=A0 1 week
> ---
>=C2=A0 sbin/newfs_msdos/mkfs_msdos.c | 4 ++++
>=C2=A0 1 file changed, 4 insertions(+)
>
> diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msd= os.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)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (o.align)
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =3D bpb.= bpbSecPerClust;
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else
> +#ifdef=C2=A0 =C2=A0 =C2=A0 =C2=A0PAGE_SIZE
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =3D PAGE= _SIZE / bpb.bpbBytesPerSec;
> +#else
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0alignto =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 mak= e 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.




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/m= aster/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc
--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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-02 14:38:11 +0000 Commit: Warner Losh 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 17:07:56 +0000 Commit: Jessica Clarke 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 12:55:02 +0000 Commit: Kristof Provost 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 Subject: git: 84ff9e9122ac - main - pf: fix overly large memcpy() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 15:29:13 +0000 Commit: Kristof Provost 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 Subject: git: 41d6858ebd6a - main - git-arc.1: list width typo List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-01 06:19:33 +0000 Commit: Mitchell Horne 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 Subject: git: 9ff1462976fc - main - x86: simplify ceil(log2(x)) function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 18:00:25 +0000 Commit: Doug Moore 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 18:07:07 +0000 Commit: Doug Moore 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 Subject: git: 8327796cc873 - main - build.7: nit section order, tag spdx List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-02 13:23:40 +0000 Commit: Mitchell Horne 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 Subject: git: a8a2d5ef126f - main - build.7: +freebsd to description, link development List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-02 13:25:19 +0000 Commit: Mitchell Horne 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 Subject: git: afa166be99fc - main - build.7: update cross-compile example List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 18:22:54 +0000 Commit: Mitchell Horne 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 To: Brooks Davis 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: References: <202405311620.44VGK2xX033356@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: On Fri, May 31, 2024 at 06:03:16PM +0000, Brooks Davis wrote: B> > Author: Dmitry Lukhtionov B> > AuthorDate: 2024-05-31 16:19:54 +0000 B> > Commit: Gleb Smirnoff 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 Subject: git: 75cb949228bb - main - arm64/vmm: Add breakpoint and single-stepping support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 18:58:08 +0000 Commit: Mark Johnston 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 Subject: git: a0ca4af9455b - main - bhyve: Add arm64 support to the gdb stub List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 19:03:17 +0000 Commit: Mark Johnston 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 #include +#ifdef __aarch64__ +#include +#endif #include +#ifdef __amd64__ #include +#endif #include + #include + #include #ifndef WITHOUT_CAPSICUM #include @@ -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 @@ -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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 19:06:42 +0000 Commit: Mark Johnston 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 Subject: git: 480ad4055314 - main - vnet tests: check for if_bridge.ko List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 18:02:18 +0000 Commit: Kristof Provost 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 To: Stefan =?utf-8?B?RcOfZXI=?= Cc: Jessica Clarke , "src-committers@freebsd.org" , "dev-commits-src-all@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: References: <202406021227.452CRx8I007470@gitrepo.freebsd.org> <6D077B35-48BA-4516-BAB7-0B23CD3AB042@freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 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 wrote: > > > > > > The branch main has been updated by se: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=077f757d72e561eb84193d8e58f63e96e69b8096 > > > > > > commit 077f757d72e561eb84193d8e58f63e96e69b8096 > > > Author: Stefan Eßer > > > AuthorDate: 2024-06-02 12:07:52 +0000 > > > Commit: Stefan Eßer > > > 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 , 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 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 > AuthorDate: 2024-05-28 06:41:05 +0000 > Commit: Kevin Bowling > 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: Date: Tue, 4 Jun 2024 16:07:53 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 , 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 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 > AuthorDate: 2024-05-27 13:12:18 +0000 > Commit: Emmanuel Vadot > 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 To: John Baldwin Cc: Emmanuel Vadot , 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: References: <202405290757.44T7vbf4021395@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 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 Subject: git: 191e6a604938 - main - physmem: zero entire array List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 23:17:13 +0000 Commit: Mitchell Horne 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 Subject: git: 5df74441b35f - main - devmap: eliminate unused arguments List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 23:17:47 +0000 Commit: Mitchell Horne 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 * /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 Subject: git: 191bf63da255 - main - riscv: Move sigcode out of locore.S List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 23:18:05 +0000 Commit: Mitchell Horne 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 #include #include #include @@ -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 + * 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 + +#include + +/* + * 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 Subject: git: 65a33120c3d5 - main - riscv: fix vm.pmap.kernel_maps with Sv48 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 23:18:54 +0000 Commit: Mitchell Horne 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 23:51:37 +0000 Commit: John Baldwin 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 23:50:56 +0000 Commit: John Baldwin 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 ; 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 ; 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 ; 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 In-Reply-To: <202406042352.454NqFVj061328@gitrepo.freebsd.org> Date: Wed, 5 Jun 2024 01:00:24 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@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 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 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 > AuthorDate: 2024-06-04 23:51:37 +0000 > Commit: John Baldwin > 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 Subject: git: e2c9fad2e0ae - main - nfsd: Fix delegation handled for atomic upgrade List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 01:46:41 +0000 Commit: Rick Macklem 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 Subject: git: dbe7ff254e6c - main - nfsd: Update a file missed by commit e2c9fad2e0ae List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 01:54:15 +0000 Commit: Rick Macklem 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 20:01:55 +0000 Commit: Enji Cooper 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: Date: Tue, 4 Jun 2024 20:16:41 -0700 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202406042352.454NqFVj061328@gitrepo.freebsd.org> <587A0604-BF30-4A90-9B04-FC56C53BBF2A@freebsd.org> From: John Baldwin 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 wrote: >> >> The branch main has been updated by jhb: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=871b33ad65baf07c92cce120a4fc1978c2ed7b3b >> >> commit 871b33ad65baf07c92cce120a4fc1978c2ed7b3b >> Author: John Baldwin >> AuthorDate: 2024-06-04 23:51:37 +0000 >> Commit: John Baldwin >> 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 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: John Baldwin 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 message dated "Tue, 04 Jun 2024 23:52:15 +0000." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 > AuthorDate: 2024-06-04 23:51:37 +0000 > Commit: John Baldwin > 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 ---<>--- 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 Features2=0x802009 AMD Features=0xee500800 AMD Features2=0x37ff 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: 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 irqs 0-23 Launching APs: 3 2 1 random: entropy device external interface kbd1 at kbdmux0 vtvga0: aesni0: No AES or SHA support. acpi0: ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - \_PR_.CPU0 (20230628/dspkginit-605) acpi0: Power Button (fixed) cpu0: on acpi0 attimer0: port 0x40-0x43 on acpi0 Timecounter "i8254" frequency 1193182 Hz quality 0 Event timer "i8254" frequency 1193182 Hz quality 100 hpet0: iomem 0xfefff000-0xfefff3ff irq 0,8 on acpi0 Timecounter "HPET" frequency 25000000 Hz quality 950 atrtc0: 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: on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 pci0: at device 0.0 (no driver attached) isab0: at device 1.0 on pci0 isa0: on isab0 ohci0: mem 0xfe02f000-0xfe02ffff irq 21 at device 2.0 on pci0 usbus0 on ohci0 usbus0: 12Mbps Full Speed USB v1.0 ehci0: 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: port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xfc00-0xfc0f at device 4.0 on pci0 ata0: 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 FreeBSD UNIX: Web: https://FreeBSD.org NTP: 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-01 18:17:52 +0000 Commit: Alan Cox 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 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Cy Schubert cc: John Baldwin , 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 message dated "Tue, 04 Jun 2024 20:47:33 -0700." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 > > AuthorDate: 2024-06-04 23:51:37 +0000 > > Commit: John Baldwin > > 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: port 0x1f0-0x1f7,0x3f6,0x17 > 0-0x177,0x376,0xfc00-0xfc0f at device 4.0 on pci0 > ata0: 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 FreeBSD UNIX: Web: https://FreeBSD.org NTP: 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 To: John Baldwin 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: References: <202405290757.44T7vbf4021395@gitrepo.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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 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 > > AuthorDate: 2024-05-27 13:12:18 +0000 > > Commit: Emmanuel Vadot > > 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 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 ; 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 ; 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 ; 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 In-Reply-To: <20240605073006.165e209edd1d6ce0c8520c9e@bidouilliste.com> Date: Wed, 5 Jun 2024 06:38:09 +0100 Cc: John Baldwin , "src-committers@freebsd.org" , "dev-commits-src-all@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> <20240605073006.165e209edd1d6ce0c8520c9e@bidouilliste.com> To: Emmanuel Vadot 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 wrote: >=20 >=20 > Hi John, >=20 > On Tue, 4 Jun 2024 16:07:53 -0700 > John Baldwin 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 >>> AuthorDate: 2024-05-27 13:12:18 +0000 >>> Commit: Emmanuel Vadot >>> 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 To: Jessica Clarke Cc: John Baldwin , "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: <20240605074534.92c8334aa97628f7b8c58296@bidouilliste.com> In-Reply-To: <885F8DF1-69E2-4AC7-87E2-B63F1588DE17@freebsd.org> References: <202405290757.44T7vbf4021395@gitrepo.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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 wrote: > On 5 Jun 2024, at 06:30, Emmanuel Vadot wrote: > >=20 > >=20 > > Hi John, > >=20 > > On Tue, 4 Jun 2024 16:07:53 -0700 > > John Baldwin 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 > >>> AuthorDate: 2024-05-27 13:12:18 +0000 > >>> Commit: Emmanuel Vadot > >>> 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 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 Subject: git: 83fcab792c9d - main - nuageinit: use pw(8) instead of getent(1) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 08:34:25 +0000 Commit: Baptiste Daroussin 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 Subject: git: fa07b02f6e09 - main - nuageinit: make addsshkey friendly for testsuite List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 08:44:17 +0000 Commit: Baptiste Daroussin 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 Subject: git: 8d7331e62a5a - main - nuageinit: fix authorized_key test List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 08:58:17 +0000 Commit: Baptiste Daroussin 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 < To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 361da40536d7 - main - arm64: Disable outling atomics List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 12:45:00 +0000 Commit: Andrew Turner 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 Subject: git: a5affc0c4cab - main - stats: Fix the build under gcc List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 12:46:33 +0000 Commit: Andrew Turner 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 12:46:46 +0000 Commit: Andrew Turner 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 #include + 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 +#include #include +#include #include #include @@ -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 #include + #include #include @@ -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 + #include #include #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 + #include .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 #include #include #include @@ -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 + #include #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 + #include #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 + #include #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 #include #include @@ -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 + #include #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 + #include #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 + #include #include #include @@ -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 + #include #include .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 #include @@ -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 + +#include #include .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 #include +#include #include #include @@ -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 + #include + .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 +#include +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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-04 12:47:52 +0000 Commit: Andrew Turner 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 + #include #include #include @@ -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 +#include +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 Subject: git: 4eb82e65a73f - main - hidbus(4): Fix wrong assertion of bus List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 12:03:27 +0000 Commit: Zhenlei Huang 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 12:25:05 +0000 Commit: Wei Hu 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 Co-Authored-by: Erni Sri Satya Vennela 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 Subject: git: 03b330e1916f - main - riscv: add stage 2 translation to pmap. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 13:08:35 +0000 Commit: Ruslan Bukin 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 Subject: git: 637ee1391957 - main - pci(4): unbreak the build List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 04:16:48 +0000 Commit: Enji Cooper 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 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Andrew Turner 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 message dated "Wed, 05 Jun 2024 09:29:15 +0000." List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 > AuthorDate: 2024-06-04 12:47:52 +0000 > Commit: Andrew Turner > 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 > + > #include > #include > #include > @@ -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 > +#include > +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 FreeBSD UNIX: Web: https://FreeBSD.org NTP: 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 Message-Id: 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Wei Hu 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 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 > AuthorDate: 2024-06-05 12:25:05 +0000 > Commit: Wei Hu > 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 > Co-Authored-by: Erni Sri Satya Vennela > 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
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=3Dbec000c9c1ef409989685bb03ff05329= 07befb4a

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

<= /div>
Cheers,
-Enji

= --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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 16:41:54 +0000 Commit: Jessica Clarke 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 16:50:05 +0000 Commit: John Baldwin 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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> In-Reply-To: From: Ryan Libby Date: Wed, 5 Jun 2024 09:51:55 -0700 Message-ID: Subject: Re: git: bec000c9c1ef - main - amd64: add a func pointer to tlb shootdown function To: Enji Cooper , Wei Hu Cc: "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:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4VvYQy1sPYz4Nny On Wed, Jun 5, 2024 at 8:49=E2=80=AFAM Enji Cooper = wrote: > > > On Jun 5, 2024, at 5:38=E2=80=AFAM, Wei Hu wrote: > > The branch main has been updated by whu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dbec000c9c1ef409989685bb03f= f0532907befb4a > > commit bec000c9c1ef409989685bb03ff0532907befb4a > Author: Souradeep Chakrabarti > AuthorDate: 2024-06-05 12:25:05 +0000 > Commit: Wei Hu > 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 > Co-Authored-by: Erni Sri Satya Vennela > 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 To: Ryan Libby Cc: Enji Cooper , Wei Hu , "src-committers@freebsd.org" , "dev-commits-src-all@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: References: <202406051238.455CcdGB050229@gitrepo.freebsd.org> 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 wrote: > On Wed, Jun 5, 2024 at 8:49=E2=80=AFAM Enji Cooper > wrote: > > > > > > On Jun 5, 2024, at 5:38=E2=80=AFAM, Wei Hu wrote: > > > > The branch main has been updated by whu: > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3Dbec000c9c1ef409989685bb03ff05= 32907befb4a > > > > commit bec000c9c1ef409989685bb03ff0532907befb4a > > Author: Souradeep Chakrabarti > > AuthorDate: 2024-06-05 12:25:05 +0000 > > Commit: Wei Hu > > 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 > > Co-Authored-by: Erni Sri Satya Vennela > > 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 06:40:20 +0000 Commit: Alan Cox 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 ; 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 ; 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 ; 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 Date: Wed, 5 Jun 2024 10:52:02 -0700 Message-ID: Subject: Re: git: 1c45a62a2f66 - main - qlnxe: Fix multiple locking issues To: John Baldwin , keith.reynolds@hpe.com Cc: Kevin Bowling , 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 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 > > AuthorDate: 2024-05-28 06:41:05 +0000 > > Commit: Kevin Bowling > > 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 ; 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 ; 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 ) 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 Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_9A19CD70-743A-4DCE-B3E0-6705327F2302" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Cy Schubert 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 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 = 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 >> AuthorDate: 2024-06-04 12:47:52 +0000 >> Commit: Andrew Turner >> 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 >> + >> #include >> #include >> #include >> @@ -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 >> +#include >> = +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=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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 19:51:37 +0000 Commit: John Baldwin 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 19:51:56 +0000 Commit: John Baldwin 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 19:52:24 +0000 Commit: John Baldwin 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 19:52:43 +0000 Commit: John Baldwin 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 Subject: git: e140f85dc194 - main - nvmf: Rescan namespaces after reconnecting List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 19:53:08 +0000 Commit: John Baldwin 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 Subject: git: aacaeeee8ecd - main - nvmf: Permit failing I/O requests while disconnected List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 19:54:15 +0000 Commit: John Baldwin 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 #include #include +#include #include #include #include @@ -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 Subject: git: f46d4971b5af - main - nvmf: Handle shutdowns more gracefully List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 19:59:28 +0000 Commit: John Baldwin 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 #include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -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 +#include #include #include #include @@ -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: Date: Wed, 5 Jun 2024 22:30:37 +0200 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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?= Subject: Re: git: 077f757d72e5 - main - newfs_msdos: align data area to VM page boundary by default To: Konstantin Belousov , Jessica Clarke , Shawn Webb Cc: "src-committers@freebsd.org" , "dev-commits-src-all@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 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: 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 wrote: >>>> >>>> The branch main has been updated by se: >>>> >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=077f757d72e561eb84193d8e58f63e96e69b8096 >>>> >>>> commit 077f757d72e561eb84193d8e58f63e96e69b8096 >>>> Author: Stefan Eßer >>>> AuthorDate: 2024-06-02 12:07:52 +0000 >>>> Commit: Stefan Eßer >>>> 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" Subject: git: 9e012a9da5df - main - iwn(4): correct debug message: "not" to "no" List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 22:01:06 +0000 Commit: Bjoern A. Zeeb 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 Subject: git: c70c791f0660 - main - drm2: Remove one more implementation of ilog2() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 22:18:19 +0000 Commit: Mark Johnston 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 Message-Id: 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: =?utf-8?Q?Stefan_E=C3=9Fer?= 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 = 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 > AuthorDate: 2024-06-04 06:26:09 +0000 > Commit: Stefan E=C3=9Fer > 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
On Jun 3, = 2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer <se@freebsd.org> = wrote:

The branch = main has been updated by se:

URL: = https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb= 60fa486a

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 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 =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-- --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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: Cc: =?utf-8?Q?Stefan_E=C3=9Fer?= , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org To: Shawn Webb References: <202406040628.4546SJ98088668@gitrepo.freebsd.org> 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 = 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 >> AuthorDate: 2024-06-04 06:26:09 +0000 >> Commit: Stefan E=C3=9Fer >> 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
On Jun 4, = 2024, at 8:21=E2=80=AFAM, Shawn Webb <shawn.webb@hardenedbsd.org> = 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=3D41ee91c64f47faaa8131df3cd8a63bdb= 60fa486a

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 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 =3D bpb.bpbSecPerClust;
    else
+#i= fdef = 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?

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-- --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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: =?utf-8?Q?Stefan_E=C3=9Fer?= References: <202406040628.4546SJ98088668@gitrepo.freebsd.org> 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 = wrote: >=20 >> On Jun 3, 2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer = 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 >> AuthorDate: 2024-06-04 06:26:09 +0000 >> Commit: Stefan E=C3=9Fer >> 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
On Jun 5, = 2024, at 4:42=E2=80=AFPM, Enji Cooper <yaneurabeya@gmail.com> = wrote:

On Jun 3, = 2024, at 11:28=E2=80=AFPM, Stefan E=C3=9Fer <se@freebsd.org> = wrote:

The branch = main has been updated by se:

URL: = https://cgit.FreeBSD.org/src/commit/?id=3D41ee91c64f47faaa8131df3cd8a63bdb= 60fa486a

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 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 =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.

Also, POSIX says it = could be defined by limits.h: h= ttps://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-- --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 Subject: git: bbf81f46297f - main - pctrie: add combined insert/lookup operations List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 02:17:20 +0000 Commit: Ryan Libby 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 Subject: git: 780666c09bf9 - main - getblk: reduce time under bufobj lock List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 03:21:22 +0000 Commit: Ryan Libby 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 04:20:26 +0000 Commit: Zhenlei Huang 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 05:03:14 +0000 Commit: Konstantin Belousov 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 Subject: git: 86c9325d341f - main - tcp: simplify stack switching protocol List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 06:29:05 +0000 Commit: Michael Tuexen 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 18:47:48 +0000 Commit: Andrew Turner 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?= 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 10:28:02 +0000 Commit: Stefan Eßer 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-13 18:03:19 +0000 Commit: Sumit Saxena 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 Subject: git: 042808f74707 - main - mpi3mr: Controller state check before enabling PEL List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-14 17:14:53 +0000 Commit: Sumit Saxena 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-14 17:47:06 +0000 Commit: Sumit Saxena 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-14 18:12:49 +0000 Commit: Sumit Saxena 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-14 18:41:07 +0000 Commit: Sumit Saxena 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 Subject: git: 4034d7061a11 - main - mpi3mr: diag fault success beyond F000 fault code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-19 06:47:57 +0000 Commit: Sumit Saxena 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-19 06:56:44 +0000 Commit: Sumit Saxena 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 Subject: git: 945c3ce49ed1 - main - mpi3mr: copyright year update to 2024 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-19 07:25:04 +0000 Commit: Sumit Saxena 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: * * Authors: Sumit Saxena 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: * * Authors: Sumit Saxena 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: * * Authors: Sumit Saxena 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: * * Authors: Sumit Saxena 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: * * Authors: Sumit Saxena 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: * * Authors: Sumit Saxena 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: * * Authors: Sumit Saxena 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 Subject: git: baabb919345f - main - mpi3mr: mpi headers update to latest List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-19 07:23:07 +0000 Commit: Sumit Saxena 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: * * 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: * * 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: * * 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: * * 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: * * 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: * * 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: * * 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: * * 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: * * 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: * * 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: * * 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: * * 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-03-19 07:29:01 +0000 Commit: Sumit Saxena 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 #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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 08:38:52 +0000 Commit: Sumit Saxena 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 /* XXX for pcpu.h */ #include /* XXX for PCPU_GET */ +#include #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 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 10:28:38 +0000 Commit: Sumit Saxena 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 Subject: git: 8ca12190bf66 - main - pf: remove incorrect SUNION2PF() macro List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 15:28:55 +0000 Commit: Kristof Provost 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 17:44:46 +0000 Commit: Kristof Provost 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 Subject: git: 8f04209d37ec - main - pf: simplify pf_addrcpy() and pf_match_addr() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 20:30:34 +0000 Commit: Kristof Provost 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 Subject: git: dc3ee89c86d3 - main - pfctl: fix possible out-of-bounds read List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 21:55:37 +0000 Commit: Kristof Provost 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 Subject: git: 230efeda080f - main - libusbhid: add missing include guards List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2022-07-10 20:51:48 +0000 Commit: Ed Maste 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 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 Subject: git: b5b90ff9844d - main - u3g: Add support for SIM7600G List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 10:43:46 +0000 Commit: Kristof Provost CommitDate: 2024-06-06 15:02:15 +0000 u3g: Add support for SIM7600G Signed-off-by: Maxime Thiebaut 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 16:51:22 +0000 Commit: Allan Jude 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 16:51:43 +0000 Commit: Allan Jude 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 20:13:04 +0000 Commit: Alan Somers 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 Subject: git: 4472fd66d006 - main - lam: fail on I/O errors List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 17:24:07 +0000 Commit: Allan Jude 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 #include #include +#include #include #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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 17:26:50 +0000 Commit: Ryan Libby 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 Subject: git: 1b13e36fcc00 - main - vm_page_insert: use pctrie combined insert/lookup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 17:26:50 +0000 Commit: Ryan Libby 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 Subject: git: 2c10bacdf402 - main - rangeset: add next() iteration List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 18:42:31 +0000 Commit: Doug Moore 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 Subject: git: 30bad751e8bf - main - pf: convert DIOCGETTIMEOUT/DIOCSETTIMEOUT to netlink List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-05 03:58:56 +0000 Commit: Kristof Provost 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 Subject: git: 8ed5170c66ec - main - pf tests: test setting and retrieving timeout values List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 15:50:42 +0000 Commit: Kristof Provost 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 Subject: git: f042e1515433 - main - pf: add sctp multihome probe points List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 15:35:09 +0000 Commit: Kristof Provost 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 20:42:06 +0000 Commit: Vladimir Kondratyev 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 20:42:06 +0000 Commit: Vladimir Kondratyev 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 20:42:06 +0000 Commit: Vladimir Kondratyev 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 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 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 AuthorDate: 2024-06-06 20:42:06 +0000 Commit: Vladimir Kondratyev 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 #include #include +#include #include #include #include @@ -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-Identifier: BSD-2-Clause + * + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2014-2015 François Tigeot + * Copyright (c) 2015 Hans Petter Selasky + * Copyright (c) 2016 Matt Macy + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUXKPI_LINUX_MINMAX_H_ +#define _LINUXKPI_LINUX_MINMAX_H_ + +#include +#include +#include + +#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 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) + +/* Swap values of a and b */ +#define swap(a, b) do { \ + __typeof(a) _swap_tmp = a; \ + a = b; \ + b = _swap_tmp; \ +} while (0) + +#endif /* _LINUXKPI_LINUX_MINMAX_H_ */ From nobody Thu Jun 6 20:43: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 4VwGVt0Xwyz5MxSC; Thu, 06 Jun 2024 20:43: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 4VwGVs29qJz4qV0; Thu, 6 Jun 2024 20:43:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706581; 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=rB+nf9BuCSIvjsFbAJ/Q5H/Y2cR5Lj8v5w735HdBgys=; b=rS8BHXVcgqWxuDTCPcw6Vnp5lTOxmdrptSFkW4ho7NiGpovQ2mlzkZd7Ubsh2G2ecZbh11 tX2iuEAriqhf4RZbSM0rqiTXExcdmkGyir0Vg2jtfdfSLBdw+jwdX+taJQmtZShVSIQVrz QE1GOjHgUMKJTFpVYB451MLNsRDDmJYRUx4sQLdmC9wzBr9Q/ghfsnJAaVOhoOzfCNnWGX 2FaMgA/Amxc9BuNiNFaNW2wAd9FknHxjGe8tJnAfpLHR1xE7N9A0v7DcFVzg/+tVNi2wJN hqEq5f+IBlwuMBkuDgQ9y7MDe1XG0h0mK/fconfYYuLAgWGEV3AwcGK28rCtxA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706581; a=rsa-sha256; cv=none; b=pj9pxHOoKPV6phCsHyNhPfu038qEPQp/7BNuEKQ2xMhhmsqWNWCppC+TuKoQa3fkYtHFHW u54+r4QZX/Ar+SY7j9YLmhQlkORQ3U+X4N8IuAHiDtj4lQGHJOzS7HhEeDGU3JgY8Wwc6f GVYS8RplL9muIsH1I6jbK5ulx/3KLkhvG37scYzSi25HXzzyxRtPPbnV7RRfJkZ9+skcwa Ip7AxZlTJ7NxOrtHQkPLPhn+Up1RduIKOnbJFvjKzcqL4QCaz/N4Wbey2AdcFYLgIQTfSB Lm5f8f9RQBPnBVpXLqO12yxyze7qpkeSJ7yBuvql3iv/g4m4NeES8z7lH2xIsA== 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=1717706581; 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=rB+nf9BuCSIvjsFbAJ/Q5H/Y2cR5Lj8v5w735HdBgys=; b=Go9jDv+f7EpfR1BUnaILBIX0s2yXbwd0C8iDAJT4xrVX18Tti/wpWnXMEGFb6B0zBmt/S1 eQ9eCD8kSnwiLFoUOKeCl5Dja+1/3Orf3hTuWEOfHV+g8+IbhV6vSGW/qCZNiwu10y+eos 5/NkxrNz5HpnWN+RUz1q/MuI13erMNaSWwHFW/h0pe3xR+xCY5o/17zaCfd3O7uglT3nOv WbXsCl63BWTmPDSb5eMKraBcGgax4cx0BCowJ44sX0ubpqayAqKkMQj/GNN7l7fSZApgVz jPAGJ0UTr9TDnkicCSw0XqUyjjnTcLeoXm0MBVlTb5XmOdC0zsXHDi5/DEgx3A== 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 4VwGVs1hFPz11wg; Thu, 6 Jun 2024 20:43: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 456Kh1Jp046326; Thu, 6 Jun 2024 20:43:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kh1Vk046323; Thu, 6 Jun 2024 20:43:01 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:43:01 GMT Message-Id: <202406062043.456Kh1Vk046323@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 588064e658d3 - main - LinuxKPI: Move linux/math.h content out of linux/kernel.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 588064e658d32f037854dd852b988728197a28de Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=588064e658d32f037854dd852b988728197a28de commit 588064e658d32f037854dd852b988728197a28de Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:07 +0000 LinuxKPI: Move linux/math.h content out of linux/kernel.h To match Linux and allow direct linux/math.h inclusion. Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D45452 --- sys/compat/linuxkpi/common/include/linux/kernel.h | 32 +---------- sys/compat/linuxkpi/common/include/linux/math.h | 67 +++++++++++++++++++++++ 2 files changed, 68 insertions(+), 31 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index d616aa542784..3ed36f01a69b 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -124,10 +125,7 @@ extern int linuxkpi_warn_dump_stack; #undef PTR_ALIGN #define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a))) #define IS_ALIGNED(x, a) (((x) & ((__typeof(x))(a) - 1)) == 0) -#define DIV_ROUND_UP(x, n) howmany(x, n) #define __KERNEL_DIV_ROUND_UP(x, n) howmany(x, n) -#define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) -#define DIV_ROUND_DOWN_ULL(x, n) (((unsigned long long)(x) / (n)) * (n)) #define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f) #define printk(...) printf(__VA_ARGS__) @@ -521,16 +519,6 @@ kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, #define offsetofend(t, m) \ (offsetof(t, m) + sizeof((((t *)0)->m))) -/* - * 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 - * as wide as the result!), and we want to evaluate the macro - * arguments just once each. - */ -#define __round_mask(x, y) ((__typeof__(x))((y)-1)) -#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) -#define round_down(x, y) ((x) & ~__round_mask(x, y)) - #define smp_processor_id() PCPU_GET(cpuid) #define num_possible_cpus() mp_ncpus #define num_online_cpus() mp_ncpus @@ -540,24 +528,6 @@ extern bool linux_cpu_has_clflush; #define cpu_has_clflush linux_cpu_has_clflush #endif -#define DIV_ROUND_CLOSEST(x, divisor) (((x) + ((divisor) / 2)) / (divisor)) - -#define DIV_ROUND_CLOSEST_ULL(x, divisor) ({ \ - __typeof(divisor) __d = (divisor); \ - unsigned long long __ret = (x) + (__d) / 2; \ - __ret /= __d; \ - __ret; \ -}) - -static inline uintmax_t -mult_frac(uintmax_t x, uintmax_t multiplier, uintmax_t divisor) -{ - uintmax_t q = (x / divisor); - uintmax_t r = (x % divisor); - - return ((q * multiplier) + ((r * multiplier) / divisor)); -} - typedef struct linux_ratelimit { struct timeval lasttime; int counter; diff --git a/sys/compat/linuxkpi/common/include/linux/math.h b/sys/compat/linuxkpi/common/include/linux/math.h new file mode 100644 index 000000000000..fc4542c83f1f --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/math.h @@ -0,0 +1,67 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2013-2015 Mellanox Technologies, Ltd. + * Copyright (c) 2014-2015 François Tigeot + * Copyright (c) 2016 Matt Macy + * Copyright (c) 2019 Johannes Lundberg + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _LINUXKPI_LINUX_MATH_H_ +#define _LINUXKPI_LINUX_MATH_H_ + +#include + +/* + * 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 + * as wide as the result!), and we want to evaluate the macro + * arguments just once each. + */ +#define __round_mask(x, y) ((__typeof__(x))((y)-1)) +#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) +#define round_down(x, y) ((x) & ~__round_mask(x, y)) + +#define DIV_ROUND_UP(x, n) howmany(x, n) +#define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) +#define DIV_ROUND_DOWN_ULL(x, n) (((unsigned long long)(x) / (n)) * (n)) + +#define DIV_ROUND_CLOSEST(x, divisor) (((x) + ((divisor) / 2)) / (divisor)) +#define DIV_ROUND_CLOSEST_ULL(x, divisor) ({ \ + __typeof(divisor) __d = (divisor); \ + unsigned long long __ret = (x) + (__d) / 2; \ + __ret /= __d; \ + __ret; \ +}) + +static inline uintmax_t +mult_frac(uintmax_t x, uintmax_t multiplier, uintmax_t divisor) +{ + uintmax_t q = (x / divisor); + uintmax_t r = (x % divisor); + + return ((q * multiplier) + ((r * multiplier) / divisor)); +} + +#endif /* _LINUXKPI_LINUX_MATH_H_ */ From nobody Thu Jun 6 20:42: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 4VwGVs0yvMz5MxVj; Thu, 06 Jun 2024 20:43: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 4VwGVr13fmz4qX9; Thu, 6 Jun 2024 20:43:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706580; 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=3g1bAkUX10pbIDbSWLCdW9USqP5J4iXPWgzgvkcl9uQ=; b=mLSw/MH2Nj2R4IsVCRBcjFctaGoJb+1qbW5ow7nQp+VXtJjDivY8/oPIanW8G/+6BqpJNP gp2wNQuwCXGIfGYD68gXNQsb5P3ueBZT8p+L4r9nOCrqAiXbs362v0kH8IUF/fPntJFRCM lc6dsk1bDr4imA+H/JzOgzwPCjQrfOL4Tt3oQAbSOEfII+OSafCJ5RSdVgNUt+TTqA0477 20EXft6OCuWi3k4Ty1o9vvW7kgU+3R2r3vZk8WATRRW3hEeKoBxoERnFi6KUYSC3ARNP1I wz3nZLxXj9jKy0W9Vul9zlmTZ5SDU9nADDr/Ms94XKIuCzeJumLXlBeS2UqiPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706580; a=rsa-sha256; cv=none; b=i2BiJdPOM4TtcsM9NBFaLlseJOXTuAThGtLCT51qY/tBVeCe6Jat+vwO8g7fuYRg2uC0ps SJQDQuyj++YDnD+/KmV2uciSzT++nN7OztRbzH59WiWKnW/BX5N4vlucsUhsmwTSgZMSuj O9EQkGmO9ifz1iNWP902wwDdILUGaCWEAzeaWRkX2ncH0BRKXjOuc/01GWn7zZhR/vSXDK ZkrN37uNkbDTkZeBdJH1ndKHEBrFiMYr1sWn06EOw2aL7QnZcBzjejNX63HDeE+JSMMgc7 tQm5yCtox3zwQaY3ToLm9RWszbnGnqdAXQefQYOoLxpjAxpvUE5NKNiO1kTG4g== 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=1717706580; 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=3g1bAkUX10pbIDbSWLCdW9USqP5J4iXPWgzgvkcl9uQ=; b=mcUV/V6i0F/YSR6ih7hAdCBTxNfQNt30d8j4CKwVEZ3bXS+7itlaN+o7pTu/kW0r45zDoz aAYgFi1APMe9RPW7ew2WfveOqbFuXCDutPvRmUyBwn9kmrnE1YBiXteF3aTjbyHaPqW43W 8zNnWQMURworjwV7qGhThlLfmNyiAZVazCzaU9CJyv3f294jQLyhogeVDCTDI3cpw2eqGU gQ4g2wgz9zxlkNwS3aD95yC2LiFV2z4lcLzt+yJAVn42cl1rp4TVxoEhZPU15VfrOQSCQm oeO7Z6/x4xF0iFuhQgzKWXGc4qekTsq97li8dd2zDHnyxywW/AQD0nxvIUkqbQ== 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 4VwGVr0dJGz11fr; Thu, 6 Jun 2024 20:43: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 456KgxZk046271; Thu, 6 Jun 2024 20:42:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456KgxxK046268; Thu, 6 Jun 2024 20:42:59 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:42:59 GMT Message-Id: <202406062042.456KgxxK046268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 07c7c41ca1e3 - main - LinuxKPI: Add min_not_zero() to linux/minmax.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 07c7c41ca1e31c20c2e2d8fb68c148f521831e4d Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=07c7c41ca1e31c20c2e2d8fb68c148f521831e4d commit 07c7c41ca1e31c20c2e2d8fb68c148f521831e4d Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:06 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:06 +0000 LinuxKPI: Add min_not_zero() to linux/minmax.h It returns the minimum that is not zero, except both equals to zero. Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz, emaste, ssaxena Differential Revision: https://reviews.freebsd.org/D45450 Differential Revision: https://reviews.freebsd.org/D45451 --- sys/compat/linuxkpi/common/include/linux/minmax.h | 7 +++++++ sys/dev/bnxt/bnxt_re/bnxt_re.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/minmax.h b/sys/compat/linuxkpi/common/include/linux/minmax.h index 465607371b9b..d48958f0899f 100644 --- a/sys/compat/linuxkpi/common/include/linux/minmax.h +++ b/sys/compat/linuxkpi/common/include/linux/minmax.h @@ -7,6 +7,7 @@ * Copyright (c) 2014-2015 François Tigeot * Copyright (c) 2015 Hans Petter Selasky * Copyright (c) 2016 Matt Macy + * Copyright (c) 2023 Serenity Cyber Security, LLC. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,6 +44,12 @@ #define min3(a, b, c) min(a, min(b, c)) #define max3(a, b, c) max(a, max(b, c)) +#define min_not_zero(x, y) ({ \ + __typeof(x) __min1 = (x); \ + __typeof(y) __min2 = (y); \ + __min1 == 0 ? __min2 : ((__min2 == 0) ? __min1 : min(__min1, __min2));\ +}) + #define min_t(type, x, y) ({ \ type __min1 = (x); \ type __min2 = (y); \ diff --git a/sys/dev/bnxt/bnxt_re/bnxt_re.h b/sys/dev/bnxt/bnxt_re/bnxt_re.h index 3bf0bbeb1061..56b3c8c0488c 100644 --- a/sys/dev/bnxt/bnxt_re/bnxt_re.h +++ b/sys/dev/bnxt/bnxt_re/bnxt_re.h @@ -100,10 +100,12 @@ * @x: value1 * @y: value2 */ +#ifndef min_not_zero #define min_not_zero(x, y) ({ \ typeof(x) __x = (x); \ typeof(y) __y = (y); \ __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); }) +#endif struct ib_mr_init_attr { int max_reg_descriptors; From nobody Thu Jun 6 20:43: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 4VwGVt4vkCz5Mxn7; Thu, 06 Jun 2024 20:43: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 4VwGVt33j7z4qbq; Thu, 6 Jun 2024 20:43:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706582; 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=v2d4XiOKwd1rZi7JCrda88ea9sT97MdXpZQshllGmAs=; b=l+r6YPzS8oFBqGc2FCiSENeJssbzfck0912e7/uODr/GQEI45Nyr5zUWOtPH2n/AE9v7Wj h8FlmPBbgfQHZrK8WAqjNrxidIes9LFiwL9MZct4dFDp5uB0+6T+jzss7bcglUJSbjRiCq neueEp3M5Qlzc/67m9TbZKVZcNdn6ZqkLYNf6/fEgQjhApdoejyF4o/cNDXuwBaL7RnNAc jC9B5GTtcqHUac1fMXFzJO4IaKw+UWuQK3mqS8q97FweRDi0DrG5jbknp8Ralu7O8+Zz4P TB1MD4ldff9By6Wd94OqZrAnDjVCcIQhjckbdBZMyqKE+maUJ0JaMUGV9urftA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706582; a=rsa-sha256; cv=none; b=SDOOZHKisEd6u60Q0NzBfdXVRm9M6DuwXiK3WA8tNuFDAfWMF0FXj5GAmlbH0rgWyJ6fRA 7x9Zqq7KTFpqoJJ9XoUVt6byolu9TrbkVhBEblTnTCRMa+tdQwPSMnHy2jLXQOWCrFjhIj hR7zTLUmBX4RwuJ49g15maa9KQYPep60wPfVuUqmtFh4x3n5j+pU0NKDHGmRB1Z7/FHDdB n4pjeRZ7oUeWszo0NvRxixPaviVHueDSOCd2ce6VnJt0CY1m70laCGChHYKEf+N6oaoXmA ZFSaoHN3ldyNjxpeUUZTVaaT5FEwETJzspsQzDC1OkaMVZsPqweY68sfVK49pg== 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=1717706582; 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=v2d4XiOKwd1rZi7JCrda88ea9sT97MdXpZQshllGmAs=; b=dYqWb6+pFqM4Yicdjjnnt0GRPLWTi+SBEQbldGKMDA3K8QFRLl4l3twyV9v1KmPjLrFCfN YrqaMUCkJnJBIna5IJRQiu3UoRpgov3PiTTdYQgXKQrpBoFTffqzMG7JPHvX8ZlJOfx9WU Xo5AJzovH4FD9dXjVUJbJ453Ec+cTe13P3npTmWM87OZBvODjBWlfeQ+tyQHimt/yTfDpP 0iHJjJWZcE2DIGc3e5++e5IJmUmii7bNF1FSKnozM7PdghfOlkIhB64pvXN+vy4WMveuxF 70/J6AcAfbQKvPXxk7DRc95NyAcQGiIet2dwj/jxG7XKgl2uz5SkWIMM4QM1sQ== 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 4VwGVt2h8Tz11wh; Thu, 6 Jun 2024 20:43: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 456Kh2OQ046368; Thu, 6 Jun 2024 20:43:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kh2HL046365; Thu, 6 Jun 2024 20:43:02 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:43:02 GMT Message-Id: <202406062043.456Kh2HL046365@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: afc450fac9f0 - main - LinuxKPI: Add abs_diff to linux/math.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: afc450fac9f04f11cd916916ac28ffc52a973e1e Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=afc450fac9f04f11cd916916ac28ffc52a973e1e commit afc450fac9f04f11cd916916ac28ffc52a973e1e Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:07 +0000 LinuxKPI: Add abs_diff to linux/math.h It returns absolute value of the difference between the arguments. Add LinuxKPI version check as the macro was moved from drm-kmod to linux/math.h in Linux kernel commit 46f12960aad (6.6 timeframe). Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D45453 --- sys/compat/linuxkpi/common/include/linux/math.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/math.h b/sys/compat/linuxkpi/common/include/linux/math.h index fc4542c83f1f..dad7fa7fbe9c 100644 --- a/sys/compat/linuxkpi/common/include/linux/math.h +++ b/sys/compat/linuxkpi/common/include/linux/math.h @@ -5,6 +5,7 @@ * Copyright (c) 2014-2015 François Tigeot * Copyright (c) 2016 Matt Macy * Copyright (c) 2019 Johannes Lundberg + * Copyright (c) 2023 Serenity Cyber Security, LLC. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,6 +56,14 @@ __ret; \ }) +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 60600 +#define abs_diff(x, y) ({ \ + __typeof(x) _x = (x); \ + __typeof(y) _y = (y); \ + _x > _y ? _x - _y : _y - _x; \ +}) +#endif + static inline uintmax_t mult_frac(uintmax_t x, uintmax_t multiplier, uintmax_t divisor) { From nobody Thu Jun 6 20:43: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 4VwGVw1V1qz5MxKW; Thu, 06 Jun 2024 20:43: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 4VwGVv4BV8z4qVY; Thu, 6 Jun 2024 20:43:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706583; 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=q9SoaJQA9+12LffXXOrfuDPmndL7Qpiw22ICPAYE/1w=; b=ak6hnSnSdNobfdXqzch3jhLnCsGMp38zjNWIfeBD/b9ZbHgPEd/mK9/HqFZATXOti08gZ5 7RZ3fxKn1V2IyZiIJnMPV+QSTSWhJmZK74XQRfLKazFWTng7GGNeYvj9WlDgGxrjjP4dKo f9yR9kly8IqTqh/dmhTxwz93k0YDkvc6jBd+SvORQE1KwC0jcd1z008XnUlU3quYe2rc4I K0yGYmvM3CY9dtq6J+5sIyl8zwHHa8OP772hLosiBIQdEz38UpggJofFD6IlhGXcU0n+QA ZapkZIR1NVXN1hY9uMxrKPbEt3/m3ACumX2M/+490ZZyiuNVdri8aFGQ0yxJgA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706583; a=rsa-sha256; cv=none; b=F0geEeZW1lzZU7loglgtcEA04rEw56/HZzhOilfxdKehlZ08V4qLMB8MN/X3NNEsd1nXI9 gWxLIMgRV4GNawU53hgpCb5mDBM3PmnurmdlsCiWR6bLxKm3CxHWN+klyu/QlwyeewZRLO PF/rJ9pP6JI+DmIZWdhcLxofPZ5+6v+YU8JLtrNi8MAGZFZ7UmsDiGEvkm7VscM9+jn1NH 9yjcP4o832RflmTSrYnyC3XdlRNNSXDAGWyRuHfpHR2AoYeXXmjHOE20UgBFHlJPQzlKdW TGbU16GLgOUb2cA+qG9LVgTfr9xdDjs877x2UxU1V3Dsa2G38GgYs/IqBoo9Ig== 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=1717706583; 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=q9SoaJQA9+12LffXXOrfuDPmndL7Qpiw22ICPAYE/1w=; b=pJVuVDI2urMNtdWrlHy5MfYFLLxOqAGsuq/i8McJutAf/djfjJVbYh4tkuBFl4+WoDbZAh HbnT68un7B2PyTGTMsKqG6VXV7JQsYSDqM/Kbkacm+My72cF2r/adJdCa36ZVbkehtU0/6 RnjTNXAM0Z/uwCoHWKkvIrOd4ZZDbpkPise1yIvMBW1E59gB5sspKUkLegfJVG3fFp2OJR i5wolItifJkphIlBfzy60rUQ5S2RtJW1Eqpl2XfTr4aU+QkCfWIipS0mGnatX3Bq9ioVwo a8sKm17UB+TAP2wSkZfeNuj0jtv6pnaXDu3fvQlEUbVB5FokapgzjAoy6LS5/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 4VwGVv3pHTz11Tm; Thu, 6 Jun 2024 20:43: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 456Kh3K5046413; Thu, 6 Jun 2024 20:43:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kh3mg046410; Thu, 6 Jun 2024 20:43:03 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:43:03 GMT Message-Id: <202406062043.456Kh3mg046410@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: a97f3a9ec96a - main - LinuxKPI: Move kstrto* functions to linux/kstrtox.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: a97f3a9ec96a2de542326a158d1ab8e65ad4fe5f Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=a97f3a9ec96a2de542326a158d1ab8e65ad4fe5f commit a97f3a9ec96a2de542326a158d1ab8e65ad4fe5f Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:07 +0000 LinuxKPI: Move kstrto* functions to linux/kstrtox.h from linux/kernel.h to match Linux and allow direct linux/kstrtox.h inclusion. Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D45454 --- sys/compat/linuxkpi/common/include/linux/kernel.h | 248 +---------------- sys/compat/linuxkpi/common/include/linux/kstrtox.h | 310 +++++++++++++++++++++ 2 files changed, 311 insertions(+), 247 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h index 3ed36f01a69b..fd5f42fbe36c 100644 --- a/sys/compat/linuxkpi/common/include/linux/kernel.h +++ b/sys/compat/linuxkpi/common/include/linux/kernel.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -269,253 +270,6 @@ extern int linuxkpi_debug; #define _RET_IP_ __builtin_return_address(0) -static inline unsigned long long -simple_strtoull(const char *cp, char **endp, unsigned int base) -{ - return (strtouq(cp, endp, base)); -} - -static inline long long -simple_strtoll(const char *cp, char **endp, unsigned int base) -{ - return (strtoq(cp, endp, base)); -} - -static inline unsigned long -simple_strtoul(const char *cp, char **endp, unsigned int base) -{ - return (strtoul(cp, endp, base)); -} - -static inline long -simple_strtol(const char *cp, char **endp, unsigned int base) -{ - return (strtol(cp, endp, base)); -} - -static inline int -kstrtoul(const char *cp, unsigned int base, unsigned long *res) -{ - char *end; - - *res = strtoul(cp, &end, base); - - /* skip newline character, if any */ - if (*end == '\n') - end++; - if (*cp == 0 || *end != 0) - return (-EINVAL); - return (0); -} - -static inline int -kstrtol(const char *cp, unsigned int base, long *res) -{ - char *end; - - *res = strtol(cp, &end, base); - - /* skip newline character, if any */ - if (*end == '\n') - end++; - if (*cp == 0 || *end != 0) - return (-EINVAL); - return (0); -} - -static inline int -kstrtoint(const char *cp, unsigned int base, int *res) -{ - char *end; - long temp; - - *res = temp = strtol(cp, &end, base); - - /* skip newline character, if any */ - if (*end == '\n') - end++; - if (*cp == 0 || *end != 0) - return (-EINVAL); - if (temp != (int)temp) - return (-ERANGE); - return (0); -} - -static inline int -kstrtouint(const char *cp, unsigned int base, unsigned int *res) -{ - char *end; - unsigned long temp; - - *res = temp = strtoul(cp, &end, base); - - /* skip newline character, if any */ - if (*end == '\n') - end++; - if (*cp == 0 || *end != 0) - return (-EINVAL); - if (temp != (unsigned int)temp) - return (-ERANGE); - return (0); -} - -static inline int -kstrtou8(const char *cp, unsigned int base, u8 *res) -{ - char *end; - unsigned long temp; - - *res = temp = strtoul(cp, &end, base); - - /* skip newline character, if any */ - if (*end == '\n') - end++; - if (*cp == 0 || *end != 0) - return (-EINVAL); - if (temp != (u8)temp) - return (-ERANGE); - return (0); -} - -static inline int -kstrtou16(const char *cp, unsigned int base, u16 *res) -{ - char *end; - unsigned long temp; - - *res = temp = strtoul(cp, &end, base); - - /* skip newline character, if any */ - if (*end == '\n') - end++; - if (*cp == 0 || *end != 0) - return (-EINVAL); - if (temp != (u16)temp) - return (-ERANGE); - return (0); -} - -static inline int -kstrtou32(const char *cp, unsigned int base, u32 *res) -{ - - return (kstrtouint(cp, base, res)); -} - -static inline int -kstrtou64(const char *cp, unsigned int base, u64 *res) -{ - char *end; - - *res = strtouq(cp, &end, base); - - /* skip newline character, if any */ - if (*end == '\n') - end++; - if (*cp == 0 || *end != 0) - return (-EINVAL); - return (0); -} - -static inline int -kstrtoull(const char *cp, unsigned int base, unsigned long long *res) -{ - return (kstrtou64(cp, base, (u64 *)res)); -} - -static inline int -kstrtobool(const char *s, bool *res) -{ - int len; - - if (s == NULL || (len = strlen(s)) == 0 || res == NULL) - return (-EINVAL); - - /* skip newline character, if any */ - if (s[len - 1] == '\n') - len--; - - if (len == 1 && strchr("yY1", s[0]) != NULL) - *res = true; - else if (len == 1 && strchr("nN0", s[0]) != NULL) - *res = false; - else if (strncasecmp("on", s, len) == 0) - *res = true; - else if (strncasecmp("off", s, len) == 0) - *res = false; - else - return (-EINVAL); - - return (0); -} - -static inline int -kstrtobool_from_user(const char __user *s, size_t count, bool *res) -{ - char buf[8] = {}; - - if (count > (sizeof(buf) - 1)) - count = (sizeof(buf) - 1); - - if (copy_from_user(buf, s, count)) - return (-EFAULT); - - return (kstrtobool(buf, res)); -} - -static inline int -kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, - int *p) -{ - char buf[36] = {}; - - if (count > (sizeof(buf) - 1)) - count = (sizeof(buf) - 1); - - if (copy_from_user(buf, s, count)) - return (-EFAULT); - - return (kstrtoint(buf, base, p)); -} - -static inline int -kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, - unsigned int *p) -{ - char buf[36] = {}; - - if (count > (sizeof(buf) - 1)) - count = (sizeof(buf) - 1); - - if (copy_from_user(buf, s, count)) - return (-EFAULT); - - return (kstrtouint(buf, base, p)); -} - -static inline int -kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, - unsigned int *p) -{ - - return (kstrtouint_from_user(s, count, base, p)); -} - -static inline int -kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, - u8 *p) -{ - char buf[8] = {}; - - if (count > (sizeof(buf) - 1)) - count = (sizeof(buf) - 1); - - if (copy_from_user(buf, s, count)) - return (-EFAULT); - - return (kstrtou8(buf, base, p)); -} - #define offsetofend(t, m) \ (offsetof(t, m) + sizeof((((t *)0)->m))) diff --git a/sys/compat/linuxkpi/common/include/linux/kstrtox.h b/sys/compat/linuxkpi/common/include/linux/kstrtox.h new file mode 100644 index 000000000000..5dfc56d40d6e --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/kstrtox.h @@ -0,0 +1,310 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * Copyright (c) 2017-2018 Mellanox Technologies, Ltd. + * All rights reserved. + * Copyright (c) 2018 Johannes Lundberg + * Copyright (c) 2020-2022 The FreeBSD Foundation + * Copyright (c) 2021 Vladimir Kondratyev + * + * Portions of this software were developed by Bjoern A. Zeeb and + * Emmanuel Vadot under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LINUXKPI_LINUX_KSTRTOX_H_ +#define _LINUXKPI_LINUX_KSTRTOX_H_ + +#include +#include +#include + +#include +#include + +#include + +static inline unsigned long long +simple_strtoull(const char *cp, char **endp, unsigned int base) +{ + return (strtouq(cp, endp, base)); +} + +static inline long long +simple_strtoll(const char *cp, char **endp, unsigned int base) +{ + return (strtoq(cp, endp, base)); +} + +static inline unsigned long +simple_strtoul(const char *cp, char **endp, unsigned int base) +{ + return (strtoul(cp, endp, base)); +} + +static inline long +simple_strtol(const char *cp, char **endp, unsigned int base) +{ + return (strtol(cp, endp, base)); +} + +static inline int +kstrtoul(const char *cp, unsigned int base, unsigned long *res) +{ + char *end; + + *res = strtoul(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + return (0); +} + +static inline int +kstrtol(const char *cp, unsigned int base, long *res) +{ + char *end; + + *res = strtol(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + return (0); +} + +static inline int +kstrtoint(const char *cp, unsigned int base, int *res) +{ + char *end; + long temp; + + *res = temp = strtol(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + if (temp != (int)temp) + return (-ERANGE); + return (0); +} + +static inline int +kstrtouint(const char *cp, unsigned int base, unsigned int *res) +{ + char *end; + unsigned long temp; + + *res = temp = strtoul(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + if (temp != (unsigned int)temp) + return (-ERANGE); + return (0); +} + +static inline int +kstrtou8(const char *cp, unsigned int base, u8 *res) +{ + char *end; + unsigned long temp; + + *res = temp = strtoul(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + if (temp != (u8)temp) + return (-ERANGE); + return (0); +} + +static inline int +kstrtou16(const char *cp, unsigned int base, u16 *res) +{ + char *end; + unsigned long temp; + + *res = temp = strtoul(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + if (temp != (u16)temp) + return (-ERANGE); + return (0); +} + +static inline int +kstrtou32(const char *cp, unsigned int base, u32 *res) +{ + + return (kstrtouint(cp, base, res)); +} + +static inline int +kstrtos64(const char *cp, unsigned int base, s64 *res) +{ + char *end; + + *res = strtoq(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + return (0); +} + +static inline int +kstrtou64(const char *cp, unsigned int base, u64 *res) +{ + char *end; + + *res = strtouq(cp, &end, base); + + /* skip newline character, if any */ + if (*end == '\n') + end++; + if (*cp == 0 || *end != 0) + return (-EINVAL); + return (0); +} + +static inline int +kstrtoull(const char *cp, unsigned int base, unsigned long long *res) +{ + return (kstrtou64(cp, base, (u64 *)res)); +} + +static inline int +kstrtobool(const char *s, bool *res) +{ + int len; + + if (s == NULL || (len = strlen(s)) == 0 || res == NULL) + return (-EINVAL); + + /* skip newline character, if any */ + if (s[len - 1] == '\n') + len--; + + if (len == 1 && strchr("yY1", s[0]) != NULL) + *res = true; + else if (len == 1 && strchr("nN0", s[0]) != NULL) + *res = false; + else if (strncasecmp("on", s, len) == 0) + *res = true; + else if (strncasecmp("off", s, len) == 0) + *res = false; + else + return (-EINVAL); + + return (0); +} + +static inline int +kstrtobool_from_user(const char __user *s, size_t count, bool *res) +{ + char buf[8] = {}; + + if (count > (sizeof(buf) - 1)) + count = (sizeof(buf) - 1); + + if (copy_from_user(buf, s, count)) + return (-EFAULT); + + return (kstrtobool(buf, res)); +} + +static inline int +kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, + int *p) +{ + char buf[36] = {}; + + if (count > (sizeof(buf) - 1)) + count = (sizeof(buf) - 1); + + if (copy_from_user(buf, s, count)) + return (-EFAULT); + + return (kstrtoint(buf, base, p)); +} + +static inline int +kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, + unsigned int *p) +{ + char buf[36] = {}; + + if (count > (sizeof(buf) - 1)) + count = (sizeof(buf) - 1); + + if (copy_from_user(buf, s, count)) + return (-EFAULT); + + return (kstrtouint(buf, base, p)); +} + +static inline int +kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, + unsigned int *p) +{ + + return (kstrtouint_from_user(s, count, base, p)); +} + +static inline int +kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, + u8 *p) +{ + char buf[8] = {}; + + if (count > (sizeof(buf) - 1)) + count = (sizeof(buf) - 1); + + if (copy_from_user(buf, s, count)) + return (-EFAULT); + + return (kstrtou8(buf, base, p)); +} + +#endif /* _LINUXKPI_LINUX_KSTRTOX_H_ */ From nobody Thu Jun 6 20:43: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 4VwGVy2LD4z5MxKY; Thu, 06 Jun 2024 20:43: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 4VwGVx6GlRz4qf5; Thu, 6 Jun 2024 20:43:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706585; 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=iiuOHe9p8L8yiQoso8K/I+bpf6vTD8nY8zZRaGI5wdM=; b=LU7h8IXTCjXYc6ABVugtMEYEqDoQsEG8n9gIVlEd1mo1RIuk/dQ/VmxNpRsJktTLMOOWZO YkREHo42VeCrU3tt5Z6Cva6srIlyZgZv5gwwHE/s9QXiA6kOr4zsAzKNKkZcUipcvFOcQK AJJ3sCc03w0Q+camyfiKi/G3guw8c/eVVXHh3OMkIWXWRVh601DdOveIHj8pVhJdR1Upkw zGq8lBMEFhQ3ospzKWtb+riouQQAFKCgTtVdBHkgdIkd01PzujbZ2iTVMIUC5EPDY8kTlg K7S1DYkBsQA6m4hueYGknWftJ2OE1OvbiizendP9aVvrAEdewg7XFStiEwjk5A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706585; a=rsa-sha256; cv=none; b=gxYQ9k0REg8I8l7nXgqQw4kSJcRWjLvgU9F+HjIZ6f04hA00muZjvGBLN6EWa1uvaSVphH MPOIS9YkkWBv1H8S0UdIDawjYrwJx/TMQsBqjn9a9uHAYWip2t8HRqJJJ1aNBhO3JD///c Efc2lI6gK/KkcmlwNxoQGNAQPTszsfiwCIC7BB3aC2HEsmLhjN9r6jooIjB8T6tHvaMzdo Odb4mg04ZXgaDpcZVgg4Iiih9xioh1bfy5UuPwfI4HIupF0EwyLfzGD7fuKyS1nIUN60FD a1sWa0tD7QtYgfHezJcB0Q4pmtu/EsaZV0Y/clnH1jxb3A4n3Os4NzKJTlnb3g== 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=1717706585; 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=iiuOHe9p8L8yiQoso8K/I+bpf6vTD8nY8zZRaGI5wdM=; b=CWh5zfa3KOjbQGFGJXAGb8zIZMBGsDmDImtStCT8MUiile6vsVRHQxO4Hk4H2yYE90JPV2 Hm6ZvU84evjZBpW01yxGlFJgRraM0OQT3gjsJmMjmy1r9mQeILKs+19Y1rqdvwAJGSrQlC s44C7qtZcY1mvKGgJNG2aCcWb43qm+hYl9m+00Zc2zoCNlWEeahSmb9kcCLecFuYmoyH4G hdQPDBSywdWK2ffuHpxhQlvGlIiS7IostACX7WN3JW1bjtCaf1niYRB/OzOGdX9vK0Yg4n HXO3S74nu7XYH6wLNTEjvWY46ldbBp7rWIrLgMwX+LQk3X4f0T5kSsuw5bP5ZA== 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 4VwGVx5tSjz11wj; Thu, 6 Jun 2024 20:43: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 456Kh50R046518; Thu, 6 Jun 2024 20:43:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kh54e046515; Thu, 6 Jun 2024 20:43:05 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:43:05 GMT Message-Id: <202406062043.456Kh54e046515@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: db42bd1f71b1 - main - LinuxKPI: Convert Linux integer types to ISO C99 in linux/kstrtox.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: db42bd1f71b1a29b392aacbd5b7aaca4c8d7e85d Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=db42bd1f71b1a29b392aacbd5b7aaca4c8d7e85d commit db42bd1f71b1a29b392aacbd5b7aaca4c8d7e85d Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:07 +0000 LinuxKPI: Convert Linux integer types to ISO C99 in linux/kstrtox.h Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D45465 --- sys/compat/linuxkpi/common/include/linux/kstrtox.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/kstrtox.h b/sys/compat/linuxkpi/common/include/linux/kstrtox.h index b723bd4a6fd0..0567aa99f7a4 100644 --- a/sys/compat/linuxkpi/common/include/linux/kstrtox.h +++ b/sys/compat/linuxkpi/common/include/linux/kstrtox.h @@ -137,7 +137,7 @@ kstrtouint(const char *cp, unsigned int base, unsigned int *res) } static inline int -kstrtou8(const char *cp, unsigned int base, u8 *res) +kstrtou8(const char *cp, unsigned int base, uint8_t *res) { char *end; unsigned long temp; @@ -149,13 +149,13 @@ kstrtou8(const char *cp, unsigned int base, u8 *res) end++; if (*cp == 0 || *end != 0) return (-EINVAL); - if (temp != (u8)temp) + if (temp != (uint8_t)temp) return (-ERANGE); return (0); } static inline int -kstrtou16(const char *cp, unsigned int base, u16 *res) +kstrtou16(const char *cp, unsigned int base, uint16_t *res) { char *end; unsigned long temp; @@ -167,20 +167,20 @@ kstrtou16(const char *cp, unsigned int base, u16 *res) end++; if (*cp == 0 || *end != 0) return (-EINVAL); - if (temp != (u16)temp) + if (temp != (uint16_t)temp) return (-ERANGE); return (0); } static inline int -kstrtou32(const char *cp, unsigned int base, u32 *res) +kstrtou32(const char *cp, unsigned int base, uint32_t *res) { return (kstrtouint(cp, base, res)); } static inline int -kstrtos64(const char *cp, unsigned int base, s64 *res) +kstrtos64(const char *cp, unsigned int base, int64_t *res) { char *end; @@ -197,7 +197,7 @@ kstrtos64(const char *cp, unsigned int base, s64 *res) static inline int kstrtoll(const char *cp, unsigned int base, long long *res) { - return (kstrtos64(cp, base, (s64 *)res)); + return (kstrtos64(cp, base, (int64_t *)res)); } static inline int @@ -218,7 +218,7 @@ kstrtou64(const char *cp, unsigned int base, u64 *res) static inline int kstrtoull(const char *cp, unsigned int base, unsigned long long *res) { - return (kstrtou64(cp, base, (u64 *)res)); + return (kstrtou64(cp, base, (uint64_t *)res)); } static inline int @@ -301,7 +301,7 @@ kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, static inline int kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, - u8 *p) + uint8_t *p) { char buf[8] = {}; From nobody Thu Jun 6 20:43: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 4VwGVw6J5hz5MxKX; Thu, 06 Jun 2024 20:43: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 4VwGVw563Gz4qYL; Thu, 6 Jun 2024 20:43:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717706584; 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=Seh+o5wScyzaCiwZCWETGQJI204LpxpYWBkfpzM/5RY=; b=GgbMVKpe2qkiAjU0/3Sx3IwESW7JMfyZOTwk+Ofp4NgYX+v8lWSagHWbQq6lBhDhPbt55H /Pv5W0pCKoAaIE3PCjp9RelxKoYLcZ8oXxsv35ij4nnamg3vp+MXz+AF3aFQfXlS4p386g 9FvWYe6HG0nlE6AG2sOQCSvqmMslql85A5bmGeZNyC6mesx9GEdsLw+dAVOQnocHEGIlwQ WqMwk1ik+1OJUj7a06MYtFsSX4Cm9FrAqQUsWn7Lz/+NJVR38kzW2O+BJ2TTZLEwK84Nfb DBc0bfeP8IY3qe9G91gnoSl6yMS1Z9GEhCB2BgPYUO6/Tkg8zSeKLlwDY2dVTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717706584; a=rsa-sha256; cv=none; b=ELuX4oUA5Jxcu1j45t0Zoufpmy87SOGIz/lCT/HbyPEVniw6wmtZKL2DsDAnPfoxBPYyVd TfTWqz57zTbjY0A/NRK+2VsqqDkQaxX1mjhe8i3a31z/gM02fEneseRczX9rQAsR/PLPEY UjzxqNyCmqISc0CK7hVHM2+audOb7JOylaiwuBnQ3xssGE8wYB31PQXd+0MzVyAfIrEmQr n7qetMX5GUUzZg/goZWJY5/yAoLKq64aUVTRB8wXq+l4r4YgGFCXbDFTcpL0rG1RPsyN2a F10wkBaT605XFbHh+0HohHDW2WhJuSKsWXp0aY3t36CUKY+MYLhiHbgX6Sat2w== 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=1717706584; 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=Seh+o5wScyzaCiwZCWETGQJI204LpxpYWBkfpzM/5RY=; b=G2JP4ZLXaatPKEOJwmrWKO8sM/gU9UMSSOJrcJY4qgdJa9R458ZYYsyHoG1cm0Un3hi/Rp 6zdyoU5Xeagzn6c6ybWLszYdNrbQ1b6dpUnwLxq/6pJReQb67xxVo7A3MUiniUcQt9LleJ RqyLobcBXdgKFgbH4dik24MIslN7HDkEKVLvr+UvYYzgQB7m5eEy4BJGHXUa7WYmWT5H0h dP5K7X2XpANykovd/U++lSHGH+Fae4tE/JEYPu6rH6j9LHH/OmshVD44XHgTWyePkVx0wU oUl/MKPUDXvZV+wXH/HfxwRNx1vFDA4cev2bG6TiJ53jGqYcTqoCToZGwHr5aw== 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 4VwGVw4jG5z10qr; Thu, 6 Jun 2024 20:43: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 456Kh4T0046455; Thu, 6 Jun 2024 20:43:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Kh4BI046452; Thu, 6 Jun 2024 20:43:04 GMT (envelope-from git) Date: Thu, 6 Jun 2024 20:43:04 GMT Message-Id: <202406062043.456Kh4BI046452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: d207a2dee332 - main - LinuxKPI: Add kstrtoll to linux/kstrtox.h List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: d207a2dee332706c352bf35c7e6ecea5240b1ceb Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=d207a2dee332706c352bf35c7e6ecea5240b1ceb commit d207a2dee332706c352bf35c7e6ecea5240b1ceb Author: Vladimir Kondratyev AuthorDate: 2024-06-06 20:42:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-06-06 20:42:07 +0000 LinuxKPI: Add kstrtoll to linux/kstrtox.h kstrtoll converts a string to a long long. Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D45455 --- sys/compat/linuxkpi/common/include/linux/kstrtox.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/kstrtox.h b/sys/compat/linuxkpi/common/include/linux/kstrtox.h index 5dfc56d40d6e..b723bd4a6fd0 100644 --- a/sys/compat/linuxkpi/common/include/linux/kstrtox.h +++ b/sys/compat/linuxkpi/common/include/linux/kstrtox.h @@ -7,6 +7,7 @@ * Copyright (c) 2018 Johannes Lundberg * Copyright (c) 2020-2022 The FreeBSD Foundation * Copyright (c) 2021 Vladimir Kondratyev + * Copyright (c) 2023 Serenity Cyber Security, LLC * * Portions of this software were developed by Bjoern A. Zeeb and * Emmanuel Vadot under sponsorship from the FreeBSD Foundation. @@ -193,6 +194,12 @@ kstrtos64(const char *cp, unsigned int base, s64 *res) return (0); } +static inline int +kstrtoll(const char *cp, unsigned int base, long long *res) +{ + return (kstrtos64(cp, base, (s64 *)res)); +} + static inline int kstrtou64(const char *cp, unsigned int base, u64 *res) { From nobody Thu Jun 6 21:45: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 4VwHvC1bC8z5N4WK; Thu, 06 Jun 2024 21:45: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 4VwHvC14hlz42sc; Thu, 6 Jun 2024 21:45:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717710343; 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=shIXXEWC6pV5OKtziTlZUjyJybo/5NFZMkbFsyWbIcs=; b=Gai27TXE1ZzYQqB4+XgLflXIfyihr2DKvRgje46wAB6fCk2bHGz3ir5Q0GT6LGUSXXi72S xEhGX/q5d58/bv/XZXxlkEVWMKaBryOWeQ9OJAqcCaveWFR/BR7iStIe3EsQSi1HKaHan/ MYyM8nqc2Ne36HVthFFZWTdhWe49XlwKugG2lNt2uFP25ronZfKKA0mqt6QwS2ZojpHT+q EJ0yCDwUqV1xhiWgCXmU48Tp9r1xspVEl2SAzkvAVWvDM6UzaOFvIMI+U/RJBefW2Ies7M KKG+VMmalYwYBQqkHjfMnEdHpjGSP6vj7wPdJIlZ25bH3ynNiTuJsj46v4XX6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717710343; a=rsa-sha256; cv=none; b=fUNRPis6UxC13sColFJ0QuONbEaIDrqEGXmVgpEdogTcqRpAsblB5czXKJ/YnYh7mUfnLQ TegHoUc/oyjHB6JoVLiWQnlo/p7KEKLa7s+wJv2Mjv0SJfARZKXGL9VJbn/YCV/4Vb5fsk SLakhg5QVcmDHp2Vif/JfFWFYiypHDOVxUzjDoFnwYltoYHZxjottgbrBcr+9hFXOhX1Yc ZCt3CT0Hu6U6TtEHGs6rI4qh2Fk0tT00HY+DH+w9/3sSwvod/lbmER7tAIfLon1icXTqEG eL4Sf9Ccaud1R2LGOOGZrTv36Fs7XoZtiotWg0iNgYkv4xTCEz0WJXlV0jOv5Q== 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=1717710343; 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=shIXXEWC6pV5OKtziTlZUjyJybo/5NFZMkbFsyWbIcs=; b=xzkWCWzna39Jds6j8DoX7Qp0sf3jeV5CHraIcBSSP0IR4bHU0wKMPF1pX5P53zk5B5SNAh m2hkHft/9h2KRqL6KFOKUYaj4KcvkQGQYaGb+7KXHKsKdYYcA8fPqeTtd+jsCdwWZu262D 6TmNJMIqUxJ3unHSx+PsFpx3LaTcNko6kdXZRqe3Ltc1YtF5iuYpTofOv1+OOTh93zN3hG 8Stchr9Z96nh0q9v6GOurynHsG7UEA887ITWhPSyIbJR1gFM7EhYrjskVu5cT1Oftv4gJh EiY2Bd6EiDMdj0rsSUxGwpSDdPpEXn8L3WrvSMLIr2CjLspOwsALThH/N2V42A== 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 4VwHvC0h3nz132W; Thu, 6 Jun 2024 21:45: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 456LjgtB048481; Thu, 6 Jun 2024 21:45:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456LjgOV048478; Thu, 6 Jun 2024 21:45:42 GMT (envelope-from git) Date: Thu, 6 Jun 2024 21:45:42 GMT Message-Id: <202406062145.456LjgOV048478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a2c88e0d47ac - main - git-arc: Use a helper function to fetch boolean config variables List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: a2c88e0d47acb1a33016cbb7a821465fa1e357a6 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a2c88e0d47acb1a33016cbb7a821465fa1e357a6 commit a2c88e0d47acb1a33016cbb7a821465fa1e357a6 Author: John Baldwin AuthorDate: 2024-06-06 21:45:30 +0000 Commit: John Baldwin CommitDate: 2024-06-06 21:45:30 +0000 git-arc: Use a helper function to fetch boolean config variables Requested by: markj Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45104 --- tools/tools/git/git-arc.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index e8da1f1ed32a..e9398a60d2f7 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -147,6 +147,16 @@ __EOF__ exit 1 } +# +# Fetch the value of a boolean config variable ($1) and return true +# (0) if the variable is true. The default value to use if the +# variable is not set is passed in $2. +# +get_bool_config() +{ + test "$(git config --bool --get $1 2>/dev/null || echo $2)" != "false" +} + # # Filter the output of call-conduit to remove the warnings that are generated # for some installations where openssl module is mysteriously installed twice so @@ -378,7 +388,7 @@ gitarc__create() list= prev="" - if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != "false" ]; then + if get_bool_config arc.list false; then list=1 fi doprompt=1 @@ -672,7 +682,7 @@ gitarc__update() local commit commits diff doprompt have_msg list o msg list= - if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != "false" ]; then + if get_bool_config arc.list false; then list=1 fi doprompt=1 @@ -727,7 +737,7 @@ gitarc__update() set -e ASSUME_YES= -if [ "$(git config --bool --get arc.assume-yes 2>/dev/null || echo false)" != "false" ]; then +if get_bool_config arc.assume-yes false; then ASSUME_YES=1 fi @@ -801,7 +811,7 @@ list|patch) ;; esac -if [ "$(git config --bool --get arc.browse 2>/dev/null || echo false)" != "false" ]; then +if get_bool_config arc.browse false; then BROWSE=--browse fi From nobody Thu Jun 6 21:49: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 4VwHz65Mlgz5N5LS; Thu, 06 Jun 2024 21:49: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 4VwHz657pgz4387; Thu, 6 Jun 2024 21:49:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717710546; 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=9p7VBa/eKQF0ilA3rEbRYSEWPP36Bt5b5OCru0Y0i40=; b=XeseJwQqS8S5PSgomFf5rHasgUKFP29yu6Bi8H/DPR/5SRqDW/OU0LzUrGkc+BArMG9MUN T8RdpAu9D+ob9KSyJqiSNdkyW7bNezTniPE9M4gHXGX0UEVJRDZLi/QZntYkD+4HQU84qY zwG+B4zop3EIekjPeKpYJHY4iEggfHxm07TDCU5KYRlvdgyGeNpZ4qXd02Lt4NeGvRyhQK DhIswR1XD9bbzq06CscxTmH8zX6wG4ymG3olddauwSQj4D06SCoAhPb+1UU3nEBp8nUkcY S2fqd2eML6VkkCoL3LCCv0Lr6jCMeTVJh8dEaT0+rsquimrE6uU1IvVaaG+s2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717710546; a=rsa-sha256; cv=none; b=bnt8XYYF25R+JjMfE3AYmlWlD8m6Ua+J41VSkJudI06h4JG2rJmqDPvR0LvThHgkezjSem zZBm6GPNJJcUM+kEPA6IiO7IRBotrxmrvVjdLxUqPjb5KaYWEuO3h6Crg6Q9jk8DKzEmYe mcmMBud+hRPyF1XXqpnuq8wujUgjOkB03ms52T6maOS2JgRIlU+s8dggdsRb9fUeOpORE/ tjFrg7ihncQGzT+uGypegtc8GF7AhKuBbTaH5IjxF4jvQscN5pkPsVj1Mmaxxwi94moCsU r7OoyD2GaP1wR6CbWAZNp1OCBM8SaplgBWjWoxeHx/yVwcKjV5x9YuIZ/EouKw== 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=1717710546; 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=9p7VBa/eKQF0ilA3rEbRYSEWPP36Bt5b5OCru0Y0i40=; b=Jzy2iqcZPMy9uGUkw5+Z+1UFNRAvSyD/ThU/Y380Qn27V+zuL8Sz+s+sKS9Qjc3NxpBPth H25GW/10rkNnMvJXeJ3kVBKLVZvuSCnoHEbn3xcQPzttkN5YkDxfThv+uGMznatwn6xwXq D0Co96J3UrbQHdpBPyd2xCqFOKreNGXATwaYvqf7XY2aZXp7F1W6sByqr25/+dKFpXReqO aSyY6ijUjjYYZvI39RUXvjMQ1LJMA4O8UTGVEeMVWKwJIeTW3LHLA0vh43ZJQZHcSfd7G2 DcjzLJLeEq8pxvQSbdXk+djSe9bvO71N4W16JWVeZTqh0e3eMivzzyh8O/C5VQ== 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 4VwHz64kzwz130Y; Thu, 6 Jun 2024 21:49: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 456Ln672049099; Thu, 6 Jun 2024 21:49:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Ln6qN049096; Thu, 6 Jun 2024 21:49:06 GMT (envelope-from git) Date: Thu, 6 Jun 2024 21:49:06 GMT Message-Id: <202406062149.456Ln6qN049096@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: b0e7358bf8b9 - main - cryptocheck: Don't treat OpenSSL errors as fatal List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: b0e7358bf8b9791aaaf38807c841953946b88785 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=b0e7358bf8b9791aaaf38807c841953946b88785 commit b0e7358bf8b9791aaaf38807c841953946b88785 Author: John Baldwin AuthorDate: 2024-06-06 21:47:04 +0000 Commit: John Baldwin CommitDate: 2024-06-06 21:48:38 +0000 cryptocheck: Don't treat OpenSSL errors as fatal Abort the current test but keep running additional tests if OpenSSL reports an error during a test. This matches the behavior for other tests such as an error from OCF. Reviewed by: markj Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D45279 --- tools/tools/crypto/cryptocheck.c | 322 ++++++++++++++++++++++++++------------- 1 file changed, 220 insertions(+), 102 deletions(-) diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index ef3e225e94f6..6506671455ac 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -537,7 +537,7 @@ ocf_hash(const struct alg *alg, const char *buffer, size_t size, char *digest, return (true); } -static void +static bool openssl_hash(const struct alg *alg, const EVP_MD *md, const void *buffer, size_t size, void *digest_out, unsigned *digest_sz_out) { @@ -564,11 +564,12 @@ openssl_hash(const struct alg *alg, const EVP_MD *md, const void *buffer, goto err_out; EVP_MD_CTX_destroy(mdctx); - return; + return (true); err_out: - errx(1, "OpenSSL %s HASH failed%s: %s", alg->name, errs, + warnx("OpenSSL %s HASH failed%s: %s", alg->name, errs, ERR_error_string(ERR_get_error(), NULL)); + return (false); } static void @@ -590,7 +591,8 @@ run_hash_test(const struct alg *alg, size_t size) /* OpenSSL HASH. */ digest_len = sizeof(control_digest); - openssl_hash(alg, md, buffer, size, control_digest, &digest_len); + if (!openssl_hash(alg, md, buffer, size, control_digest, &digest_len)) + goto out; /* cryptodev HASH. */ if (!ocf_hash(alg, buffer, size, test_digest, &crid)) @@ -671,9 +673,11 @@ run_hmac_test(const struct alg *alg, size_t size) /* OpenSSL HMAC. */ digest_len = sizeof(control_digest); if (HMAC(md, key, key_len, (u_char *)buffer, size, - (u_char *)control_digest, &digest_len) == NULL) - errx(1, "OpenSSL %s (%zu) HMAC failed: %s", alg->name, + (u_char *)control_digest, &digest_len) == NULL) { + warnx("OpenSSL %s (%zu) HMAC failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto out; + } /* cryptodev HMAC. */ if (!ocf_hmac(alg, buffer, size, key, key_len, test_digest, &crid)) @@ -700,7 +704,7 @@ out: free(key); } -static void +static bool openssl_cipher(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, const char *input, char *output, size_t size, int enc) { @@ -708,27 +712,42 @@ openssl_cipher(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, int outl, total; ctx = EVP_CIPHER_CTX_new(); - if (ctx == NULL) - errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + if (ctx == NULL) { + warnx("OpenSSL %s (%zu) ctx new failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + return (false); + } if (EVP_CipherInit_ex(ctx, cipher, NULL, (const u_char *)key, - (const u_char *)iv, enc) != 1) - errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + (const u_char *)iv, enc) != 1) { + warnx("OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } EVP_CIPHER_CTX_set_padding(ctx, 0); if (EVP_CipherUpdate(ctx, (u_char *)output, &outl, - (const u_char *)input, size) != 1) - errx(1, "OpenSSL %s (%zu) cipher update failed: %s", alg->name, + (const u_char *)input, size) != 1) { + warnx("OpenSSL %s (%zu) cipher update failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } total = outl; - if (EVP_CipherFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) - errx(1, "OpenSSL %s (%zu) cipher final failed: %s", alg->name, + if (EVP_CipherFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) { + warnx("OpenSSL %s (%zu) cipher final failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } total += outl; - if ((size_t)total != size) - errx(1, "OpenSSL %s (%zu) cipher size mismatch: %d", alg->name, + if ((size_t)total != size) { + warnx("OpenSSL %s (%zu) cipher size mismatch: %d", alg->name, size, total); + goto error; + } + EVP_CIPHER_CTX_free(ctx); + return (true); + +error: EVP_CIPHER_CTX_free(ctx); + return (false); } static bool @@ -808,22 +827,27 @@ run_cipher_test(const struct alg *alg, size_t size) ciphertext = malloc(size); /* OpenSSL cipher. */ - openssl_cipher(alg, cipher, key, iv, cleartext, ciphertext, size, 1); - if (size > 0 && memcmp(cleartext, ciphertext, size) == 0) + if (!openssl_cipher(alg, cipher, key, iv, cleartext, ciphertext, size, + 1)) + goto out_noocf; + if (size > 0 && memcmp(cleartext, ciphertext, size) == 0) { warnx("OpenSSL %s (%zu): cipher text unchanged", alg->name, size); - openssl_cipher(alg, cipher, key, iv, ciphertext, buffer, size, 0); + goto out_noocf; + } + if (!openssl_cipher(alg, cipher, key, iv, ciphertext, buffer, size, 0)) + goto out_noocf; if (memcmp(cleartext, buffer, size) != 0) { printf("OpenSSL %s (%zu): cipher mismatch:", alg->name, size); printf("original:\n"); hexdump(cleartext, size, NULL, 0); printf("decrypted:\n"); hexdump(buffer, size, NULL, 0); - exit(1); + goto out_noocf; } if (!ocf_init_cipher_session(alg, key, key_len, &ses)) - goto out; + goto out_noocf; /* OCF encrypt. */ if (!ocf_cipher(&ses, alg, iv, cleartext, buffer, size, COP_ENCRYPT)) @@ -855,6 +879,7 @@ run_cipher_test(const struct alg *alg, size_t size) out: ocf_destroy_session(&ses); +out_noocf: free(ciphertext); free(buffer); free(cleartext); @@ -970,21 +995,26 @@ run_eta_test(const struct alg *alg, size_t aad_len, size_t size) /* OpenSSL encrypt + HMAC. */ if (aad_len != 0) memcpy(ciphertext, cleartext, aad_len); - openssl_cipher(alg, cipher, cipher_key, iv, cleartext + aad_len, - ciphertext + aad_len, size, 1); + if (!openssl_cipher(alg, cipher, cipher_key, iv, cleartext + aad_len, + ciphertext + aad_len, size, 1)) + goto out_noocf; if (size > 0 && memcmp(cleartext + aad_len, ciphertext + aad_len, - size) == 0) + size) == 0) { warnx("OpenSSL %s (%zu, %zu): cipher text unchanged", alg->name, aad_len, size); + goto out_noocf; + } digest_len = sizeof(control_digest); if (HMAC(md, auth_key, auth_key_len, (u_char *)ciphertext, - aad_len + size, (u_char *)control_digest, &digest_len) == NULL) - errx(1, "OpenSSL %s (%zu, %zu) HMAC failed: %s", alg->name, + aad_len + size, (u_char *)control_digest, &digest_len) == NULL) { + warnx("OpenSSL %s (%zu, %zu) HMAC failed: %s", alg->name, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); + goto out_noocf; + } if (!ocf_init_eta_session(alg, cipher_key, cipher_key_len, auth_key, auth_key_len, &ses)) - goto out; + goto out_noocf; /* OCF encrypt + HMAC. */ error = ocf_eta(&ses, iv, iv_len, aad_len != 0 ? cleartext : NULL, @@ -1060,6 +1090,7 @@ run_eta_test(const struct alg *alg, size_t aad_len, size_t size) out: ocf_destroy_session(&ses); +out_noocf: free(ciphertext); free(buffer); free(cleartext); @@ -1068,7 +1099,7 @@ out: free(cipher_key); } -static void +static bool openssl_gmac(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, const char *input, size_t size, char *tag) { @@ -1076,26 +1107,41 @@ openssl_gmac(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, int outl; ctx = EVP_CIPHER_CTX_new(); - if (ctx == NULL) - errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + if (ctx == NULL) { + warnx("OpenSSL %s (%zu) ctx new failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + return (false); + } if (EVP_EncryptInit_ex(ctx, cipher, NULL, (const u_char *)key, - (const u_char *)iv) != 1) - errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + (const u_char *)iv) != 1) { + warnx("OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } EVP_CIPHER_CTX_set_padding(ctx, 0); if (EVP_EncryptUpdate(ctx, NULL, &outl, (const u_char *)input, - size) != 1) - errx(1, "OpenSSL %s (%zu) update failed: %s", + size) != 1) { + warnx("OpenSSL %s (%zu) update failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_EncryptFinal_ex(ctx, NULL, &outl) != 1) - errx(1, "OpenSSL %s (%zu) final failed: %s", alg->name, + goto error; + } + if (EVP_EncryptFinal_ex(ctx, NULL, &outl) != 1) { + warnx("OpenSSL %s (%zu) final failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, alg->tag_len, - tag) != 1) - errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, + tag) != 1) { + warnx("OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } EVP_CIPHER_CTX_free(ctx); + return (true); + +error: + EVP_CIPHER_CTX_free(ctx); + return (false); } static bool @@ -1154,7 +1200,8 @@ run_gmac_test(const struct alg *alg, size_t size) buffer = alloc_buffer(size); /* OpenSSL GMAC. */ - openssl_gmac(alg, cipher, key, iv, buffer, size, control_tag); + if (!openssl_gmac(alg, cipher, key, iv, buffer, size, control_tag)) + goto out; /* OCF GMAC. */ if (!ocf_mac(alg, buffer, size, key, key_len, iv, test_tag, &crid)) @@ -1178,7 +1225,7 @@ out: free(key); } -static void +static bool openssl_digest(const struct alg *alg, const char *key, u_int key_len, const char *input, size_t size, char *tag, u_int tag_len) { @@ -1187,25 +1234,42 @@ openssl_digest(const struct alg *alg, const char *key, u_int key_len, size_t len; pkey = EVP_PKEY_new_raw_private_key(alg->pkey, NULL, key, key_len); - if (pkey == NULL) - errx(1, "OpenSSL %s (%zu) pkey new failed: %s", alg->name, + if (pkey == NULL) { + warnx("OpenSSL %s (%zu) pkey new failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + return (false); + } mdctx = EVP_MD_CTX_new(); - if (mdctx == NULL) - errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + if (mdctx == NULL) { + warnx("OpenSSL %s (%zu) ctx new failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_DigestSignInit(mdctx, NULL, NULL, NULL, pkey) != 1) - errx(1, "OpenSSL %s (%zu) digest sign init failed: %s", + EVP_PKEY_free(pkey); + return (false); + } + if (EVP_DigestSignInit(mdctx, NULL, NULL, NULL, pkey) != 1) { + warnx("OpenSSL %s (%zu) digest sign init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_DigestSignUpdate(mdctx, input, size) != 1) - errx(1, "OpenSSL %s (%zu) digest update failed: %s", alg->name, + goto error; + } + if (EVP_DigestSignUpdate(mdctx, input, size) != 1) { + warnx("OpenSSL %s (%zu) digest update failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } len = tag_len; - if (EVP_DigestSignFinal(mdctx, tag, &len) != 1) - errx(1, "OpenSSL %s (%zu) digest final failed: %s", alg->name, + if (EVP_DigestSignFinal(mdctx, tag, &len) != 1) { + warnx("OpenSSL %s (%zu) digest final failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } EVP_MD_CTX_free(mdctx); EVP_PKEY_free(pkey); + return (true); + +error: + EVP_MD_CTX_free(mdctx); + EVP_PKEY_free(pkey); + return (false); } static void @@ -1225,8 +1289,9 @@ run_digest_test(const struct alg *alg, size_t size) buffer = alloc_buffer(size); /* OpenSSL Poly1305. */ - openssl_digest(alg, key, key_len, buffer, size, control_tag, - sizeof(control_tag)); + if (!openssl_digest(alg, key, key_len, buffer, size, control_tag, + sizeof(control_tag))) + goto out; /* OCF Poly1305. */ if (!ocf_mac(alg, buffer, size, key, key_len, NULL, test_tag, &crid)) @@ -1249,7 +1314,7 @@ out: free(key); } -static void +static bool openssl_aead_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, size_t iv_len, const char *aad, size_t aad_len, const char *input, char *output, size_t size, char *tag) @@ -1258,44 +1323,68 @@ openssl_aead_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, int outl, total; ctx = EVP_CIPHER_CTX_new(); - if (ctx == NULL) - errx(1, "OpenSSL %s (%zu) ctx new failed: %s", alg->name, + if (ctx == NULL) { + warnx("OpenSSL %s (%zu) ctx new failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) - errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + return (false); + } + if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) { + warnx("OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != 1) - errx(1, "OpenSSL %s (%zu) setting iv length failed: %s", alg->name, + goto error; + } + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != + 1) { + warnx("OpenSSL %s (%zu) setting iv length failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } if (EVP_EncryptInit_ex(ctx, NULL, NULL, (const u_char *)key, - (const u_char *)iv) != 1) - errx(1, "OpenSSL %s (%zu) ctx init failed: %s", alg->name, + (const u_char *)iv) != 1) { + warnx("OpenSSL %s (%zu) ctx init failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } EVP_CIPHER_CTX_set_padding(ctx, 0); if (aad != NULL) { if (EVP_EncryptUpdate(ctx, NULL, &outl, (const u_char *)aad, - aad_len) != 1) - errx(1, "OpenSSL %s (%zu) aad update failed: %s", + aad_len) != 1) { + warnx("OpenSSL %s (%zu) aad update failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } } if (EVP_EncryptUpdate(ctx, (u_char *)output, &outl, - (const u_char *)input, size) != 1) - errx(1, "OpenSSL %s (%zu) encrypt update failed: %s", alg->name, + (const u_char *)input, size) != 1) { + warnx("OpenSSL %s (%zu) encrypt update failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } total = outl; - if (EVP_EncryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) - errx(1, "OpenSSL %s (%zu) encrypt final failed: %s", alg->name, + if (EVP_EncryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) { + warnx("OpenSSL %s (%zu) encrypt final failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } total += outl; - if ((size_t)total != size) - errx(1, "OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, + if ((size_t)total != size) { + warnx("OpenSSL %s (%zu) encrypt size mismatch: %d", alg->name, size, total); + goto error; + } if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, alg->tag_len, - tag) != 1) - errx(1, "OpenSSL %s (%zu) get tag failed: %s", alg->name, + tag) != 1) { + warnx("OpenSSL %s (%zu) get tag failed: %s", alg->name, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } + EVP_CIPHER_CTX_free(ctx); + return (true); + +error: EVP_CIPHER_CTX_free(ctx); + return (false); } #ifdef notused @@ -1343,7 +1432,7 @@ openssl_aead_decrypt(const struct alg *alg, const EVP_CIPHER *cipher, } #endif -static void +static bool openssl_ccm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, const char *key, const char *iv, size_t iv_len, const char *aad, size_t aad_len, const char *input, char *output, size_t size, char *tag) @@ -1352,63 +1441,88 @@ openssl_ccm_encrypt(const struct alg *alg, const EVP_CIPHER *cipher, int outl, total; ctx = EVP_CIPHER_CTX_new(); - if (ctx == NULL) - errx(1, "OpenSSL %s/%zu (%zu, %zu) ctx new failed: %s", + if (ctx == NULL) { + warnx("OpenSSL %s/%zu (%zu, %zu) ctx new failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) - errx(1, "OpenSSL %s/%zu (%zu, %zu) ctx init failed: %s", + return (false); + } + if (EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) ctx init failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != 1) - errx(1, - "OpenSSL %s/%zu (%zu, %zu) setting iv length failed: %s", + goto error; + } + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN, iv_len, NULL) != + 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) setting iv length failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, AES_CBC_MAC_HASH_LEN, NULL) != 1) - errx(1, - "OpenSSL %s/%zu (%zu, %zu) setting tag length failed: %s", + goto error; + } + if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, AES_CBC_MAC_HASH_LEN, + NULL) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) setting tag length failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } if (EVP_EncryptInit_ex(ctx, NULL, NULL, (const u_char *)key, - (const u_char *)iv) != 1) - errx(1, "OpenSSL %s/%zu (%zu, %zu) ctx init failed: %s", + (const u_char *)iv) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) ctx init failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); - if (EVP_EncryptUpdate(ctx, NULL, &outl, NULL, size) != 1) - errx(1, - "OpenSSL %s/%zu (%zu, %zu) unable to set data length: %s", + goto error; + } + if (EVP_EncryptUpdate(ctx, NULL, &outl, NULL, size) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) unable to set data length: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } if (aad != NULL) { if (EVP_EncryptUpdate(ctx, NULL, &outl, (const u_char *)aad, - aad_len) != 1) - errx(1, - "OpenSSL %s/%zu (%zu, %zu) aad update failed: %s", + aad_len) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) aad update failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } } if (EVP_EncryptUpdate(ctx, (u_char *)output, &outl, - (const u_char *)input, size) != 1) - errx(1, "OpenSSL %s/%zu (%zu, %zu) encrypt update failed: %s", + (const u_char *)input, size) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) encrypt update failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } total = outl; - if (EVP_EncryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) - errx(1, "OpenSSL %s/%zu (%zu, %zu) encrypt final failed: %s", + if (EVP_EncryptFinal_ex(ctx, (u_char *)output + outl, &outl) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) encrypt final failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } total += outl; - if ((size_t)total != size) - errx(1, "OpenSSL %s/%zu (%zu, %zu) encrypt size mismatch: %d", + if ((size_t)total != size) { + warnx("OpenSSL %s/%zu (%zu, %zu) encrypt size mismatch: %d", alg->name, iv_len, aad_len, size, total); + goto error; + } if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, AES_CBC_MAC_HASH_LEN, - tag) != 1) - errx(1, "OpenSSL %s/%zu (%zu, %zu) get tag failed: %s", + tag) != 1) { + warnx("OpenSSL %s/%zu (%zu, %zu) get tag failed: %s", alg->name, iv_len, aad_len, size, ERR_error_string(ERR_get_error(), NULL)); + goto error; + } + EVP_CIPHER_CTX_free(ctx); + return (true); + +error: EVP_CIPHER_CTX_free(ctx); + return (false); } static bool @@ -1490,6 +1604,7 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size, u_int key_len; int error; char control_tag[AEAD_MAX_TAG_LEN], test_tag[AEAD_MAX_TAG_LEN]; + bool ok; cipher = alg->evp_cipher(); if (size % EVP_CIPHER_block_size(cipher) != 0) { @@ -1526,14 +1641,16 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size, /* OpenSSL encrypt */ if (EVP_CIPHER_mode(cipher) == EVP_CIPH_CCM_MODE) - openssl_ccm_encrypt(alg, cipher, key, iv, iv_len, aad, + ok = openssl_ccm_encrypt(alg, cipher, key, iv, iv_len, aad, aad_len, cleartext, ciphertext, size, control_tag); else - openssl_aead_encrypt(alg, cipher, key, iv, iv_len, aad, + ok = openssl_aead_encrypt(alg, cipher, key, iv, iv_len, aad, aad_len, cleartext, ciphertext, size, control_tag); + if (!ok) + goto out_noocf; if (!ocf_init_aead_session(alg, key, key_len, iv_len, &ses)) - goto out; + goto out_noocf; /* OCF encrypt */ error = ocf_aead(&ses, iv, iv_len, aad, aad_len, cleartext, buffer, @@ -1602,6 +1719,7 @@ run_aead_test(const struct alg *alg, size_t aad_len, size_t size, out: ocf_destroy_session(&ses); +out_noocf: free(aad); free(ciphertext); free(buffer); From nobody Thu Jun 6 21:50: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 4VwJ190JJlz5N59n; Thu, 06 Jun 2024 21:50: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 4VwJ186cRPz43g3; Thu, 6 Jun 2024 21:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717710652; 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=cA89qArgBkFm+zzus8w4hN2j0iq42hxABvJUCsMAAJE=; b=YX6SmWK2cQk+/OwKhs51gUyX0fpaK49K5MEV01JwsKyTDoPk8kEJ6lIhEu4KoDikKgiTso NykG1NWlt2i6YBoDu7lie5qMcllfXaJJ2ad7TjHlyprUh4seLyeMxSMtYCbzXoN5ypPcTU IPuybbhWpIKHkN1V8KSNztPQVAASv/5vKgfkGTYx56lYmG5AGBzqmvAobDmX/84VC4MbaC mzCazyX99CmNDqk3g6L9zbL/xisJ3IHQwo5jc2xbkzp53+p0i+GHi/2TfGD/S2Sfyzwx68 hyoCOUG5GvjzxE6mtTtCWeft/zSXyucYjoWk9PsQhTbaCv4hivh6ifk+gFL7Rw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717710652; a=rsa-sha256; cv=none; b=qvxOWu1O3HWB54ztiyxRTS4uvKjsPYKIuvemDg+qHqguFkcXAeQ9DssXHLDXtmdKwYZsJm FcqTylSx0vfFXD8VGZHss3/5DbRv6G7J/HtDDrC/1e258ZapoWAIJi+wbdSSnH6Ggq1bJC JKlFsDShqreRcx4bv3F0Bp9QB1FWgn1MXmy0gdRefNEV/v2+n67gzCwaoO73dCr4ChMKut JCD1A7vIod9JviZlNfWNEFFbcS0jcuueqZ0hQgcgS3etNJHyPtvLwiRSdJuR7LuiDSdZYl qvfGHzRjMIXnWI7rEOXYaYiQCve7V09jPrHpKozOrP5bHClyIQlmCok/aaM6fw== 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=1717710652; 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=cA89qArgBkFm+zzus8w4hN2j0iq42hxABvJUCsMAAJE=; b=NF7SxC1gRUe8TW80yCTI1giULcOgNlCCsLXMTDyPB/q8m4xOiiUtP5mNRp+e54y88mUjp1 GgeafggUWMtEHGVCVEEiPxSJpUfs18vNefUNLUJFUGsCfStuNItoTZMHlKc21/Ulveo2T/ 2nmF++SrnG4HvBmeSx8TdnOEvcGSXVl7/RzPI9+sRK6b9lA0WExWFUwMXv4J9oQnlcmpTb jcX3fvjAOxar3CzYx85uw7TneLXo/p0hTiJMstZ63i7x5NUXaBr6id/zND7OAV5erp8EPS 4AhLJBnFdYoIZuA7zUXGv77A607h4Go0wyU8j7RFCzTACk0RG1SATk8SYTgGVQ== 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 4VwJ186DhWz13F7; Thu, 6 Jun 2024 21:50:52 +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 456Loqnn058013; Thu, 6 Jun 2024 21:50:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456Loqn1058010; Thu, 6 Jun 2024 21:50:52 GMT (envelope-from git) Date: Thu, 6 Jun 2024 21:50:52 GMT Message-Id: <202406062150.456Loqn1058010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: c0c066f86dd1 - main - config: Remove redundant code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: c0c066f86dd19c4802812b3ae28b019ca4909c56 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=c0c066f86dd19c4802812b3ae28b019ca4909c56 commit c0c066f86dd19c4802812b3ae28b019ca4909c56 Author: Warner Losh AuthorDate: 2024-06-03 18:37:02 +0000 Commit: Warner Losh CommitDate: 2024-06-06 21:48:38 +0000 config: Remove redundant code since errx is marked dead2, we don't need this. Noticed by: jrtc27 Sponsored by: Netflix --- usr.sbin/config/config.y | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index 148959fbff2e..4120ffa54b1c 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -304,8 +304,6 @@ yyerror(const char *s) { errx(1, "%s:%d: %s", yyfile, yyline + 1, s); - __unreachable(); - return (0); } int From nobody Thu Jun 6 21:50: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 4VwJ1B1tVJz5N5Cf; Thu, 06 Jun 2024 21:50: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 4VwJ1B0cRnz43jW; Thu, 6 Jun 2024 21:50:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717710654; 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=eCwid2u4q7Rcb2ApE/yU1JZeJu0e5XXmz/sXN+zLLhE=; b=hUztkBiGdoFAVoIoOWk+YLOWiVcL0IAN40wTNpFGKR3DAOHchyI3bbWBBWvpITwd7WNckV lSjSL6hRWP1hcUtz+1ykPrGB/50KjfLwzqky99OFLkMHGUapZP034R8LdyTQIcw4GLgNli XxyP3W0R0N02nULklZuFF/GKyX3xkPREOpDMIYDopskYb19fYvYr11J/uqgeJWMuClhccK 5EnOzSTlSITuc3MoRV+B6KSr1KU0dT9eUnhwibzpqJjgwyKYD3limHva2nnVY/MMS8OR0F x1I5RcZBy618plCiRSa0idoH1V/0Ce9BHezTqDF/bmg8VpCOnf/WgoOIm1oafw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717710654; a=rsa-sha256; cv=none; b=L7j7IJHQ9bgqhMvssx12UTWDnsH0mWAOaabnSq+1LS5xDPlq6kI10guwfognie+A00ITBH pLa2u85wc7VehDJWGnGJPBJ8hGZ6ursBYgWU4m3n8npveOmBFJXl9sAx+6lPJHEKt45MoB dnSexLleRq+WPPNPiVMG7o4Ip8lbjkMZaogJOt01MGs8ZYZ+8ubuTodmnO4H1zSztbj1f4 pNrrmiPRZTr6NXna10pd52dIV1g+3t1AOHeHBjcHvwHiNBjNTdv3U7WHJDhcDO6YpLOVp6 PcOkCMgZ+hzIeAYwgmRBifTDe+Zr2XmDHC8PDP7R//EZs52PWl2DsjOtl/OAZg== 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=1717710654; 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=eCwid2u4q7Rcb2ApE/yU1JZeJu0e5XXmz/sXN+zLLhE=; b=TgEJ2SkW6QwDyhI7EB88hCSklusXUBiH53TZXlfGkQKodyDEtPvv/gRySXcTirHGdxOdEQ j/LJ09s9xDVqGzDxRMNl/hw7M7ORNZQerFbyP5mCPYqidZcJBxFFh0DzJ3cDglu7lVEUIn ddednxwgN4GJMxYR5BDdZMbuigX2CQPyAWs/A0kPgjrW/1JPzMYd6I3Jp3HMOtSPx2FBYf RMN9X1onoTCI3Hp5tgE5kxg+SFaSXceBYF04/ZQTFCTV6CpKj1L7N/qA6Lx+987DGppAkp VOYhiCXptC+GltC0gf2csYHiYmK7v27M3o3sJztxKmpvXl9YTznjBikNQ1XdhA== 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 4VwJ1B0DSzz13F8; Thu, 6 Jun 2024 21:50: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 456Lorsw058079; Thu, 6 Jun 2024 21:50:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456LorpK058076; Thu, 6 Jun 2024 21:50:53 GMT (envelope-from git) Date: Thu, 6 Jun 2024 21:50:53 GMT Message-Id: <202406062150.456LorpK058076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7cae020b9c97 - main - Simplify signal handling code in libthr by removing use of SYS_sigreturn List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 7cae020b9c977c11881363d726b13d1cd2feec5e Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7cae020b9c977c11881363d726b13d1cd2feec5e commit 7cae020b9c977c11881363d726b13d1cd2feec5e Author: Dapeng Gao AuthorDate: 2024-06-03 18:18:13 +0000 Commit: Warner Losh CommitDate: 2024-06-06 21:48:39 +0000 Simplify signal handling code in libthr by removing use of SYS_sigreturn The use of SYS_sigreturn is unnecessary here. If handle_signal is called when a signal is delivered, it can just return normally back to sigcode which will call sigreturn anyway. In case handle_signal is called by check_deferred_signal, using setcontext is better than SYS_sigreturn because that is the correct system call to pair with the earlier getcontext. Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D44893 --- lib/libthr/thread/thr_sig.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index ad291d106001..b953c430158c 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -247,7 +247,6 @@ static void handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t *ucp) { struct pthread *curthread = _get_curthread(); - ucontext_t uc2; __siginfohandler_t *sigfunc; int cancel_point; int cancel_async; @@ -307,13 +306,11 @@ handle_signal(struct sigaction *actp, int sig, siginfo_t *info, ucontext_t *ucp) curthread->cancel_point = cancel_point; curthread->cancel_enable = cancel_enable; - memcpy(&uc2, ucp, sizeof(uc2)); - SIGDELSET(uc2.uc_sigmask, SIGCANCEL); + SIGDELSET(ucp->uc_sigmask, SIGCANCEL); /* reschedule cancellation */ - check_cancel(curthread, &uc2); + check_cancel(curthread, ucp); errno = err; - syscall(SYS_sigreturn, &uc2); } void @@ -400,6 +397,7 @@ check_deferred_signal(struct pthread *curthread) /* remove signal */ curthread->deferred_siginfo.si_signo = 0; handle_signal(&act, info.si_signo, &info, uc); + syscall(SYS_sigreturn, uc); } static void From nobody Thu Jun 6 21:50: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 4VwJ1C42d0z5N5GG; Thu, 06 Jun 2024 21:50: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 4VwJ1C1fMjz43VL; Thu, 6 Jun 2024 21:50:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717710655; 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=UgfcxyZhXN7ImrrGXzzkn4izaMirOrPHZFyGhc4Ql/k=; b=bBZaYpFeA1QtDLfNvr0qZ+/726b6uqsCDOpOJVCu9yYU9UWbuGS7PSL7MO79RcPq3rNL2d QQ86F+nzV7DuLgd7AwnDKPiYJWDa2r7P9YUsDggBUoLZBqYtZrEdz3IDFSwf4DH2MXORxn nIFSyfTHZMqy3ljBg7mZk4ztlmnmGmB5rltgwUcAJxxWxAdn4sIxe3WtUhPCY+GngaxLSL G0uNEsB3ZkxxbuVJ68n6hxD7mbdLAqsGBzzL+gV3hBHy0B0uZmh3JWatPRElJiSwHGUtjW uOjmhjvaD10BIaAEwZA/sbnDMa9jay1zUts5LqYAusyJ+WBsazushnRSLotAOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717710655; a=rsa-sha256; cv=none; b=ppSW/ZHZHy2XNeCgp4ZT3Kb35mwx6d3YWSI0zjVf5wkDj8GqSJDHlCpvXoYnHmA5n/gDZI v1UWnyK89RL9b7EHlhDC/Ty/P5M4HH5k1vi1DAjRPzk8sEp0CrQWybstAJ4YKSVQNFdNds GFZJBSDcz2Lz2S3+2JdYmHw5J7QOWOgs2Ptm86U10RxHoo2AzPr8SECDorSnQMHHQKbN3n FZ4l9egKryGH5gV5UFcHA5digK2kFCd/NuIP8EN7koZTPVxqhH1d0zyy3qfct/v0ZI0XIF Y0JLuoHhC51khqW6N9oKgzAqSSZ/To+4BkZM6IVzqwSIaFHypaM+XQlEv7Rqzw== 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=1717710655; 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=UgfcxyZhXN7ImrrGXzzkn4izaMirOrPHZFyGhc4Ql/k=; b=sNESSrF1M0o0NWSxrtYdJYcRf7tCmVXEEv9MpdBX+B/7N2Na7rPjoJREP6Ir85fCJ/hIMu vE7d0ruAT3UT7gPEKnYG1KLjjU5JBbQmP2oygo3oLzVXTOrl9F7CbZR8ojZum05AKQpx2o 0OB9thdewifDUsd/ouricytIo6q4B8bqWhWX4Av/2oH/QJIYAmgpzzdeZC7GjKZlg5NyS5 FxTehNhPxbgnvAs53oraf0nOLRDhrl5/fP92apLyAMw1Ck1U8M9SLiynbpJUbUVyyBPJK3 E25Z8MPpH5Pzan/WiBXBmANWe9HidXoQsFA3SkixzZ3116oBO+6/kbbCQ/fzqA== 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 4VwJ1C1Db8z13Sl; Thu, 6 Jun 2024 21:50: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 456LotU0058124; Thu, 6 Jun 2024 21:50:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456LoteN058121; Thu, 6 Jun 2024 21:50:55 GMT (envelope-from git) Date: Thu, 6 Jun 2024 21:50:55 GMT Message-Id: <202406062150.456LoteN058121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 21faf821a304 - main - ifconfig(8): wordsmith -G and -g descriptions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 21faf821a3046f2522dc8d49797f1c1ec74c6b0f Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=21faf821a3046f2522dc8d49797f1c1ec74c6b0f commit 21faf821a3046f2522dc8d49797f1c1ec74c6b0f Author: Pau Amma AuthorDate: 2024-06-06 21:12:53 +0000 Commit: Warner Losh CommitDate: 2024-06-06 21:48:39 +0000 ifconfig(8): wordsmith -G and -g descriptions Remove spurious ".Ar groupname". Add missing full stops. While there, tweak word order for better grammar. MFC after: 3 days Reviewed by: Alexander Ziaee, Mina Galić, allanjude, imp Differential Revision: https://reviews.freebsd.org/D45092 --- sbin/ifconfig/ifconfig.8 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sbin/ifconfig/ifconfig.8 b/sbin/ifconfig/ifconfig.8 index e91dff6e59fd..c9861ccc6481 100644 --- a/sbin/ifconfig/ifconfig.8 +++ b/sbin/ifconfig/ifconfig.8 @@ -1,3 +1,6 @@ +.\"- +.\" SPDX-License-Identifier: BSD-3-Clause +.\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -25,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 12, 2024 +.Dd June 6, 2024 .Dt IFCONFIG 8 .Os .Sh NAME @@ -214,11 +217,10 @@ Shortcut notation for Exclude members of the specified .Ar groupname from the output. -.Ar groupname . .Pp -Only one option +Only one .Fl G -should be specified as later override previous ones +option should be specified as later ones override earlier ones. .Ar groupname may contain shell patterns in which case it should be quoted. .Pp @@ -244,9 +246,9 @@ lists names of interfaces belonging to .Ar groupname . Any other flags and arguments are ignored in this case. .Pp -Only one option +Only one .Fl g -should be specified as later override previous ones +option should be specified as later ones override earlier ones. .Ar groupname may contain shell patterns in which case it should be quoted. .Pp From nobody Fri Jun 7 08:01: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 4VwYYT4rM7z5N2WF; Fri, 07 Jun 2024 08:01:17 +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 4VwYYT4dq8z40RF; Fri, 7 Jun 2024 08:01:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717747277; 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=cqt4eOpeKj4Uv3EQ1WKCO4TJn8Kl7zCoZ5NeJQPpPvg=; b=Mjk4PSBkEPFXFlamQbtEBndp5lqnkdx5Rgyokftno9DjVkHdM9fP5Jl5NZQD7C6v6M2CJ+ btC4nzYpHnva+WPBjd1LP4Jttg6hroIKEvQ0QbK5d7t+bYpcrwR2YEsQokBsogzUQmuuqZ DIUmFLixrgPwcC8eQ6zB/IPvDFb28moYWhQGkbzYv28FKGIx7mOFkNEM94aVOKSTTqJvkx Zv7l1i+beNW4eF948IDXj7Evq4dLYqfHCni3yiNwr4fkhWArxzOTESeQYlC71P7W5P/cl0 pQmXnBhASyk3dMeSU9NM1XWZl4tsqjStPjlo30caWLT7mDAyl10+L3rfBzduiw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717747277; a=rsa-sha256; cv=none; b=yWbkud5vUGI1niBY6BHrDkkIImIJYkt9ORtsy7jHD51XU1z10jGi43QmedeNe3ebF278v1 Bqkg09wDVwiTH8K9ptpYF6R6tc0ObHrv/3Onfn1h63mWZapFaDEbX//KV9G5r15jQQn5we zAiCjPXJtpyDie1TJuw3IjRt3AZ0H4EXqSUiZ7KAKm+so8YNMm41gTUUgd2rdtJ2V4Zrw6 03GFUViNjzqEcKVUguYH/zxd9VZCkec0U8my8+06gE4B0GlC0lpFxnN1R4+5wqsm1cOtq1 wGoggeMIHGvQ69N+IlU1OHPSizRkf5MJoFZ94zHG9OLcMgM24vVnVj6C4m3Knw== 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=1717747277; 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=cqt4eOpeKj4Uv3EQ1WKCO4TJn8Kl7zCoZ5NeJQPpPvg=; b=RQM92qh02WXuVen/qR1eYPcyHK8ZjZ69MOWx4v2W/0u6zWVzgY9LDqHUv0Fiv/Fu0MPF83 FJ4SSTeJw7oVKAEzIbM+1aCIBamcbN0s4QngIFO9l9PqV4uRkErwkwE8cED3Es6B9AnKaF /MU5PygUF0EaAvsg5PLXCldBpD8ORNTWpZ6ZvmSHfU/taRIMLczauKK+L22Nist73dHuRq IP+aHAAmSYhW9/IMgU3qGUIvxi/4xyzVaL9tnCEJIDGx0OrFOmYUA0O/zae0QbrEZLGuys 3HuWFmWv2+RCD8hKtDh97+qm7cfbqImngbXpfF2Lf+LBNa7iPxKxBrSfQsLWVw== 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 4VwYYT4DwSz1LLT; Fri, 7 Jun 2024 08:01: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 45781Hv4090522; Fri, 7 Jun 2024 08:01:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45781Haa090505; Fri, 7 Jun 2024 08:01:17 GMT (envelope-from git) Date: Fri, 7 Jun 2024 08:01:17 GMT Message-Id: <202406070801.45781Haa090505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 2b887687edc2 - main - Hyper-V: TLB flush enlightment using hypercall List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 2b887687edc25bb4553f0d8a1183f454a85d413d Auto-Submitted: auto-generated The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=2b887687edc25bb4553f0d8a1183f454a85d413d commit 2b887687edc25bb4553f0d8a1183f454a85d413d Author: Souradeep Chakrabarti AuthorDate: 2024-06-07 07:56:07 +0000 Commit: Wei Hu CommitDate: 2024-06-07 07:56:07 +0000 Hyper-V: TLB flush enlightment using hypercall Currently FreeBSD uses IPI based TLB flushing for remote TLB flushing. Hyper-V allows hypercalls to flush local and remote TLB. The use of Hyper-V hypercalls gives significant performance improvement in TLB operations. This patch set during test has shown near to 40 percent TLB performance improvement. Also this patch adds rep hypercall implementation as well. Reviewed by: whu, kib Tested by: whu Authored-by: Souradeep Chakrabarti Co-Authored-by: Erni Sri Satya Vennela MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D45521 --- sys/conf/files.amd64 | 5 +- sys/dev/hyperv/vmbus/hyperv.c | 63 ++++++++ sys/dev/hyperv/vmbus/hyperv_mmu.c | 309 ++++++++++++++++++++++++++++++++++++++ sys/dev/hyperv/vmbus/hyperv_mmu.h | 57 +++++++ sys/dev/hyperv/vmbus/hyperv_var.h | 11 ++ sys/dev/hyperv/vmbus/vmbus.c | 36 +++++ sys/dev/hyperv/vmbus/vmbus_var.h | 54 +++++++ sys/modules/hyperv/vmbus/Makefile | 4 +- 8 files changed, 535 insertions(+), 4 deletions(-) diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index add27418ce08..19a16d42043f 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -128,8 +128,9 @@ dev/enic/vnic_intr.c optional enic dev/enic/vnic_rq.c optional enic dev/enic/vnic_wq.c optional enic dev/ftgpio/ftgpio.c optional ftgpio superio -dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv -dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv +dev/hyperv/vmbus/amd64/hyperv_machdep.c optional hyperv +dev/hyperv/vmbus/amd64/vmbus_vector.S optional hyperv +dev/hyperv/vmbus/hyperv_mmu.c optional hyperv dev/iavf/if_iavf_iflib.c optional iavf pci \ compile-with "${NORMAL_C} -I$S/dev/iavf" dev/iavf/iavf_lib.c optional iavf pci \ diff --git a/sys/dev/hyperv/vmbus/hyperv.c b/sys/dev/hyperv/vmbus/hyperv.c index e0e85a022090..1f85203146d0 100644 --- a/sys/dev/hyperv/vmbus/hyperv.c +++ b/sys/dev/hyperv/vmbus/hyperv.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,7 @@ #include #include #endif +#include #include #include @@ -72,10 +74,12 @@ MSR_HV_GUESTID_OSID_FREEBSD | \ MSR_HV_GUESTID_OSTYPE_FREEBSD) + static bool hyperv_identify(void); static void hypercall_memfree(void); static struct hypercall_ctx hypercall_context; + uint64_t hypercall_post_message(bus_addr_t msg_paddr) { @@ -90,6 +94,65 @@ hypercall_signal_event(bus_addr_t monprm_paddr) HYPERCALL_SIGNAL_EVENT, monprm_paddr, 0); } +static inline int hv_result(uint64_t status) +{ + return status & HV_HYPERCALL_RESULT_MASK; +} + +static inline bool hv_result_success(uint64_t status) +{ + return hv_result(status) == HV_STATUS_SUCCESS; +} + +static inline unsigned int hv_repcomp(uint64_t status) +{ + /* Bits [43:32] of status have 'Reps completed' data. */ + return ((status & HV_HYPERCALL_REP_COMP_MASK) >> + HV_HYPERCALL_REP_COMP_OFFSET); +} + +/* + * Rep hypercalls. Callers of this functions are supposed to ensure that + * rep_count and varhead_size comply with Hyper-V hypercall definition. + */ +uint64_t +hv_do_rep_hypercall(uint16_t code, uint16_t rep_count, uint16_t varhead_size, + uint64_t input, uint64_t output) +{ + uint64_t control = code; + uint64_t status; + uint16_t rep_comp; + + control |= (uint64_t)varhead_size << HV_HYPERCALL_VARHEAD_OFFSET; + control |= (uint64_t)rep_count << HV_HYPERCALL_REP_COMP_OFFSET; + + do { + status = hypercall_do_md(control, input, output); + if (!hv_result_success(status)) + return status; + + rep_comp = hv_repcomp(status); + + control &= ~HV_HYPERCALL_REP_START_MASK; + control |= (uint64_t)rep_comp << HV_HYPERCALL_REP_START_OFFSET; + + } while (rep_comp < rep_count); + if (hv_result_success(status)) + return HV_STATUS_SUCCESS; + + return status; +} + +uint64_t +hypercall_do_md(uint64_t input_val, uint64_t input_addr, uint64_t out_addr) +{ + uint64_t phys_inaddr, phys_outaddr; + phys_inaddr = input_addr ? vtophys(input_addr) : 0; + phys_outaddr = out_addr ? vtophys(out_addr) : 0; + return hypercall_md(hypercall_context.hc_addr, + input_val, phys_inaddr, phys_outaddr); +} + int hyperv_guid2str(const struct hyperv_guid *guid, char *buf, size_t sz) { diff --git a/sys/dev/hyperv/vmbus/hyperv_mmu.c b/sys/dev/hyperv/vmbus/hyperv_mmu.c new file mode 100644 index 000000000000..13b1f52fa1f6 --- /dev/null +++ b/sys/dev/hyperv/vmbus/hyperv_mmu.c @@ -0,0 +1,309 @@ +/*- + * Copyright (c) 2009-2012,2016-2024 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "hyperv_mmu.h" + +static inline int fill_gva_list(uint64_t gva_list[], + unsigned long start, unsigned long end) +{ + int gva_n = 0; + unsigned long cur = start, diff; + + do { + diff = end > cur ? end - cur : 0; + + gva_list[gva_n] = cur; + /* + * Lower 12 bits encode the number of additional + * pages to flush (in addition to the 'cur' page). + */ + if (diff >= HV_TLB_FLUSH_UNIT) { + gva_list[gva_n] |= PAGE_MASK; + cur += HV_TLB_FLUSH_UNIT; + } else if (diff) { + gva_list[gva_n] |= (diff - 1) >> PAGE_SHIFT; + cur = end; + } + + gva_n++; + + } while (cur < end); + + return gva_n; +} + + +inline int hv_cpumask_to_vpset(struct hv_vpset *vpset, + const cpuset_t *cpus, struct vmbus_softc * sc) +{ + int cpu, vcpu, vcpu_bank, vcpu_offset, nr_bank = 1; + int max_vcpu_bank = hv_max_vp_index / HV_VCPUS_PER_SPARSE_BANK; + + /* + * vpset.valid_bank_mask can represent up to + * HV_MAX_SPARSE_VCPU_BANKS banks + */ + if (max_vcpu_bank >= HV_MAX_SPARSE_VCPU_BANKS) + return 0; + + /* + * Clear all banks up to the maximum possible bank as hv_tlb_flush_ex + * structs are not cleared between calls, we risk flushing unneeded + * vCPUs otherwise. + */ + for (vcpu_bank = 0; vcpu_bank <= max_vcpu_bank; vcpu_bank++) + vpset->bank_contents[vcpu_bank] = 0; + + /* + * Some banks may end up being empty but this is acceptable. + */ + CPU_FOREACH_ISSET(cpu, cpus) { + vcpu = VMBUS_PCPU_GET(sc, vcpuid, cpu); + if (vcpu == -1) + return -1; + vcpu_bank = vcpu / HV_VCPUS_PER_SPARSE_BANK; + vcpu_offset = vcpu % HV_VCPUS_PER_SPARSE_BANK; + set_bit(vcpu_offset, (unsigned long *) + &vpset->bank_contents[vcpu_bank]); + if (vcpu_bank >= nr_bank) + nr_bank = vcpu_bank + 1; + } + vpset->valid_bank_mask = GENMASK_ULL(nr_bank - 1, 0); + return nr_bank; +} + + + + +void +hv_vm_tlb_flush(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, + enum invl_op_codes op, struct vmbus_softc *sc, smp_invl_local_cb_t curcpu_cb) +{ + cpuset_t tmp_mask, mask; + struct hyperv_tlb_flush *flush; + int cpu, vcpu; + int max_gvas, gva_n; + uint64_t status = 0; + uint64_t cr3; + + /* + * Hyper-V doesn't handle the invalidating cache. Let system handle it. + */ + if (op == INVL_OP_CACHE) + return smp_targeted_tlb_shootdown_native(pmap, addr1, addr2, + curcpu_cb, op); + + flush = *DPCPU_PTR(hv_pcpu_mem); + if (flush == NULL) + return smp_targeted_tlb_shootdown_native(pmap, addr1, addr2, + curcpu_cb, op); + /* + * It is not necessary to signal other CPUs while booting or + * when in the debugger. + */ + if (__predict_false(kdb_active || KERNEL_PANICKED() || !smp_started)) + goto local_cb; + + KASSERT(curthread->td_pinned > 0, ("curthread not pinned")); + + /* + * Make a stable copy of the set of CPUs on which the pmap is active. + * See if we have to interrupt other CPUs. + */ + CPU_COPY(pmap_invalidate_cpu_mask(pmap), &tmp_mask); + CPU_COPY(pmap_invalidate_cpu_mask(pmap), &mask); + CPU_CLR(curcpu, &tmp_mask); + if (CPU_EMPTY(&tmp_mask)) + goto local_cb; + + /* + * Initiator must have interrupts enabled, which prevents + * non-invalidation IPIs that take smp_ipi_mtx spinlock, + * from deadlocking with us. On the other hand, preemption + * must be disabled to pin initiator to the instance of the + * pcpu pc_smp_tlb data and scoreboard line. + */ + KASSERT((read_rflags() & PSL_I) != 0, + ("hv_tlb_flush: interrupts disabled")); + critical_enter(); + flush->processor_mask = 0; + cr3 = pmap->pm_cr3; + + if (op == INVL_OP_TLB || op == INVL_OP_TLB_INVPCID || + op == INVL_OP_TLB_INVPCID_PTI || op == INVL_OP_TLB_PCID) { + flush->address_space = 0; + flush->flags = HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES; + } else { + + flush->address_space = cr3; + flush->address_space &= ~CR3_PCID_MASK; + flush->flags = 0; + } + if(CPU_CMP(&mask, &all_cpus) == 0) { + flush->flags |= HV_FLUSH_ALL_PROCESSORS; + } else { + if (CPU_FLS(&mask) < mp_ncpus && CPU_FLS(&mask) >= 64) + goto do_ex_hypercall; + + CPU_FOREACH_ISSET(cpu, &mask) { + vcpu = VMBUS_PCPU_GET(sc, vcpuid, cpu); + if (vcpu >= 64) + goto do_ex_hypercall; + + set_bit(vcpu, &flush->processor_mask); + } + if (!flush->processor_mask ) + goto native; + } + max_gvas = (PAGE_SIZE - sizeof(*flush)) / sizeof(flush->gva_list[0]); + if (addr2 == 0) { + flush->flags |= HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY; + status = hypercall_do_md(HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE, + (uint64_t)flush, (uint64_t)NULL); + } else if ((addr2 && (addr2 -addr1)/HV_TLB_FLUSH_UNIT) > max_gvas) { + status = hypercall_do_md(HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE, + (uint64_t)flush, (uint64_t)NULL); + } else { + gva_n = fill_gva_list(flush->gva_list, addr1, addr2); + + status = hv_do_rep_hypercall(HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST, + gva_n, 0, (uint64_t)flush, (uint64_t)NULL); + + } + if(status) + goto native; + sched_unpin(); + critical_exit(); + return; + +local_cb: + critical_enter(); + curcpu_cb(pmap, addr1, addr2); + sched_unpin(); + critical_exit(); + return; +do_ex_hypercall: + status = hv_flush_tlb_others_ex(pmap, addr1, addr2, mask, op, sc); + if (status) + goto native; + sched_unpin(); + critical_exit(); + return; +native: + sched_unpin(); + critical_exit(); + return smp_targeted_tlb_shootdown_native(pmap, addr1, + addr2, curcpu_cb, op); +} + +uint64_t +hv_flush_tlb_others_ex(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, + const cpuset_t mask, enum invl_op_codes op, struct vmbus_softc *sc) +{ + int nr_bank = 0, max_gvas, gva_n; + struct hv_tlb_flush_ex *flush; + if(*DPCPU_PTR(hv_pcpu_mem) == NULL) + return EINVAL; + flush = *DPCPU_PTR(hv_pcpu_mem); + uint64_t status = 0; + uint64_t cr3; + + if (!(hyperv_recommends & HYPERV_X64_EX_PROCESSOR_MASKS_RECOMMENDED)) + return EINVAL; + + cr3 = pmap->pm_cr3; + if (op == INVL_OP_TLB) { + flush->address_space = 0; + flush->flags = HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES; + } else { + + flush->address_space = cr3; + flush->address_space &= ~CR3_PCID_MASK; + flush->flags = 0; + } + + flush->hv_vp_set.valid_bank_mask = 0; + + flush->hv_vp_set.format = HV_GENERIC_SET_SPARSE_4K; + nr_bank = hv_cpumask_to_vpset(&flush->hv_vp_set, &mask, sc); + if (nr_bank < 0) + return EINVAL; + + /* + * We can flush not more than max_gvas with one hypercall. Flush the + * whole address space if we were asked to do more. + */ + max_gvas = (PAGE_SIZE - sizeof(*flush) - nr_bank * + sizeof(flush->hv_vp_set.bank_contents[0])) / + sizeof(flush->hv_vp_set.bank_contents[0]); + + if (addr2 == 0) { + flush->flags |= HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY; + status = hv_do_rep_hypercall( + HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX, + 0, nr_bank, (uint64_t)flush, (uint64_t)NULL); + } else if (addr2 && + ((addr2 - addr1)/HV_TLB_FLUSH_UNIT) > max_gvas) { + status = hv_do_rep_hypercall( + HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX, + 0, nr_bank, (uint64_t)flush, (uint64_t)NULL); + } else { + gva_n = fill_gva_list(&flush->hv_vp_set.bank_contents[nr_bank], + addr1, addr2); + status = hv_do_rep_hypercall( + HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX, + gva_n, nr_bank, (uint64_t)flush, (uint64_t)NULL); + } + return status; +} diff --git a/sys/dev/hyperv/vmbus/hyperv_mmu.h b/sys/dev/hyperv/vmbus/hyperv_mmu.h new file mode 100644 index 000000000000..e62948d74181 --- /dev/null +++ b/sys/dev/hyperv/vmbus/hyperv_mmu.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 2009-2012,2016-2024 Microsoft Corp. + * Copyright (c) 2012 NetApp Inc. + * Copyright (c) 2012 Citrix Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _HYPERV_MMU_H_ +#define _HYPERV_MMU_H_ + +#include "vmbus_var.h" + +#define HV_VCPUS_PER_SPARSE_BANK (64) +#define HV_MAX_SPARSE_VCPU_BANKS (64) + + +struct hyperv_tlb_flush { + uint64_t address_space; + uint64_t flags; + uint64_t processor_mask; + uint64_t gva_list[]; +}__packed; + +struct hv_vpset { + uint64_t format; + uint64_t valid_bank_mask; + uint64_t bank_contents[]; +} __packed; + +struct hv_tlb_flush_ex { + uint64_t address_space; + uint64_t flags; + struct hv_vpset hv_vp_set; +} __packed; + +#endif diff --git a/sys/dev/hyperv/vmbus/hyperv_var.h b/sys/dev/hyperv/vmbus/hyperv_var.h index 67f6cc4ef706..62cce9026ab0 100644 --- a/sys/dev/hyperv/vmbus/hyperv_var.h +++ b/sys/dev/hyperv/vmbus/hyperv_var.h @@ -33,7 +33,18 @@ struct hypercall_ctx { void *hc_addr; vm_paddr_t hc_paddr; }; + uint64_t hypercall_post_message(bus_addr_t msg_paddr); uint64_t hypercall_signal_event(bus_addr_t monprm_paddr); +uint64_t hypercall_do_md(uint64_t input, uint64_t in_addr, + uint64_t out_addr); +struct hv_vpset; +struct vmbus_softc; +uint64_t +hv_do_rep_hypercall(uint16_t code, uint16_t rep_count, uint16_t varhead_size, + uint64_t input, uint64_t output); +int +hv_cpumask_to_vpset(struct hv_vpset *vpset, const cpuset_t *cpus, + struct vmbus_softc *sc); #endif /* !_HYPERV_VAR_H_ */ diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index 3cc210a5003c..a3daed05c21a 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -139,6 +139,8 @@ static void vmbus_event_proc_dummy(struct vmbus_softc *, int); static bus_dma_tag_t vmbus_get_dma_tag(device_t parent, device_t child); static struct vmbus_softc *vmbus_sc; +static void free_pcpu_ptr(void); +static void alloc_pcpu_ptr(void); SYSCTL_NODE(_hw, OID_AUTO, vmbus, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Hyper-V vmbus"); @@ -208,6 +210,9 @@ static driver_t vmbus_driver = { sizeof(struct vmbus_softc) }; +uint32_t hv_max_vp_index; +DPCPU_DEFINE(void *, hv_pcpu_mem); + DRIVER_MODULE(vmbus, pcib, vmbus_driver, NULL, NULL); DRIVER_MODULE(vmbus, acpi_syscontainer, vmbus_driver, NULL, NULL); @@ -739,6 +744,7 @@ vmbus_synic_setup(void *xsc) int cpu = curcpu; uint64_t val, orig; uint32_t sint; + void **hv_cpu_mem; if (hyperv_features & CPUID_HV_MSR_VP_INDEX) { /* Save virtual processor id. */ @@ -748,6 +754,11 @@ vmbus_synic_setup(void *xsc) VMBUS_PCPU_GET(sc, vcpuid, cpu) = 0; } + if (VMBUS_PCPU_GET(sc, vcpuid, cpu) > hv_max_vp_index) + hv_max_vp_index = VMBUS_PCPU_GET(sc, vcpuid, cpu); + hv_cpu_mem = DPCPU_ID_PTR(cpu, hv_pcpu_mem); + *hv_cpu_mem = contigmalloc(PAGE_SIZE, M_DEVBUF, M_WAITOK | M_ZERO, + 0ul, ~0ul, PAGE_SIZE, 0); /* * Setup the SynIC message. */ @@ -786,6 +797,16 @@ vmbus_synic_setup(void *xsc) WRMSR(MSR_HV_SCONTROL, val); } +#if defined(__x86_64__) +void +hyperv_vm_tlb_flush(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, + smp_invl_local_cb_t curcpu_cb, enum invl_op_codes op) +{ + struct vmbus_softc *sc = vmbus_get_softc(); + return hv_vm_tlb_flush(pmap, addr1, addr2, op, sc, curcpu_cb); +} +#endif /*__x86_64__*/ + static void vmbus_synic_teardown(void *arg) { @@ -820,6 +841,7 @@ vmbus_synic_teardown(void *arg) */ orig = RDMSR(MSR_HV_SIEFP); WRMSR(MSR_HV_SIEFP, (orig & MSR_HV_SIEFP_RSVD_MASK)); + free_pcpu_ptr(); } static int @@ -1373,6 +1395,16 @@ vmbus_probe(device_t dev) return (BUS_PROBE_DEFAULT); } + +static void free_pcpu_ptr(void) +{ + int cpu = curcpu; + void **hv_cpu_mem; + hv_cpu_mem = DPCPU_ID_PTR(cpu, hv_pcpu_mem); + if(*hv_cpu_mem) + contigfree(*hv_cpu_mem, PAGE_SIZE, M_DEVBUF); +} + /** * @brief Main vmbus driver initialization routine. * @@ -1470,6 +1502,10 @@ vmbus_doattach(struct vmbus_softc *sc) smp_rendezvous(NULL, vmbus_synic_setup, NULL, sc); sc->vmbus_flags |= VMBUS_FLAG_SYNIC; +#if defined(__x86_64__) + smp_targeted_tlb_shootdown = &hyperv_vm_tlb_flush; +#endif + /* * Initialize vmbus, e.g. connect to Hypervisor. */ diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h b/sys/dev/hyperv/vmbus/vmbus_var.h index 023d27c52cea..4f0668476716 100644 --- a/sys/dev/hyperv/vmbus/vmbus_var.h +++ b/sys/dev/hyperv/vmbus/vmbus_var.h @@ -32,6 +32,11 @@ #include #include +#include +#include +#include +#include + #include #include @@ -137,6 +142,40 @@ struct vmbus_softc { #define VMBUS_PCPU_GET(sc, field, cpu) (sc)->vmbus_pcpu[(cpu)].field #define VMBUS_PCPU_PTR(sc, field, cpu) &(sc)->vmbus_pcpu[(cpu)].field +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE 0x0002 +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX 0x0013 +#define HV_FLUSH_ALL_PROCESSORS BIT(0) +#define HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES BIT(1) +#define HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY BIT(2) +#define HV_TLB_FLUSH_UNIT (4096 * PAGE_SIZE) + + +#define BIT(n) (1ULL << (n)) +#define BITS_PER_LONG (sizeof(long) * NBBY) +#define BIT_MASK(nr) (1UL << ((nr) & (BITS_PER_LONG - 1))) +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) +#define set_bit(i, a) \ + atomic_set_long(&((volatile unsigned long *)(a))[BIT_WORD(i)], BIT_MASK(i)) + +#define GENMASK_ULL(h, l) (((~0ULL) >> (64 - (h) - 1)) & ((~0ULL) << (l))) + +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST 0x0003 +#define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX 0x0014 +#define HYPERV_X64_EX_PROCESSOR_MASKS_RECOMMENDED BIT(11) +#define HV_HYPERCALL_RESULT_MASK GENMASK_ULL(15, 0) +#define HV_STATUS_SUCCESS 0 +#define HV_HYPERCALL_REP_COMP_MASK GENMASK_ULL(43, 32) +#define HV_HYPERCALL_REP_COMP_OFFSET 32 + +#define HV_HYPERCALL_VARHEAD_OFFSET 17 + +#define HV_HYPERCALL_REP_START_MASK GENMASK_ULL(59, 48) +#define HV_HYPERCALL_REP_START_OFFSET 48 + +enum HV_GENERIC_SET_FORMAT { + HV_GENERIC_SET_SPARSE_4K, + HV_GENERIC_SET_ALL, +}; struct vmbus_channel; struct trapframe; @@ -176,4 +215,19 @@ void vmbus_synic_setup1(void *xsc); void vmbus_synic_teardown1(void); int vmbus_setup_intr1(struct vmbus_softc *sc); void vmbus_intr_teardown1(struct vmbus_softc *sc); + +DPCPU_DECLARE(void *, hv_pcpu_mem); + +extern uint32_t hv_max_vp_index; + + +#if defined(__x86_64__) +void hyperv_vm_tlb_flush(pmap_t, vm_offset_t, + vm_offset_t, smp_invl_local_cb_t, enum invl_op_codes); +uint64_t hv_flush_tlb_others_ex(pmap_t, vm_offset_t, vm_offset_t, + cpuset_t, enum invl_op_codes, struct vmbus_softc *); +void hv_vm_tlb_flush(pmap_t, vm_offset_t, vm_offset_t, + enum invl_op_codes, struct vmbus_softc *, + smp_invl_local_cb_t); +#endif /* __x86_64__ */ #endif /* !_VMBUS_VAR_H_ */ diff --git a/sys/modules/hyperv/vmbus/Makefile b/sys/modules/hyperv/vmbus/Makefile index 1659d5186493..9863f4db46ca 100644 --- a/sys/modules/hyperv/vmbus/Makefile +++ b/sys/modules/hyperv/vmbus/Makefile @@ -14,8 +14,8 @@ SRCS= hyperv.c \ vmbus_res.c \ vmbus_xact.c -.if ${MACHINE_CPUARCH} != "i386" && ${MACHINE_CPUARCH} != "aarch64" -SRCS+= vmbus_vector.S +.if ${MACHINE_CPUARCH} == "amd64" +SRCS+= vmbus_vector.S hyperv_mmu.c .endif .if ${MACHINE_CPUARCH} != "aarch64" SRCS+= vmbus_et.c hyperv_x86.c vmbus_x86.c From nobody Fri Jun 7 15:07: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 4Vwl1L3tgnz5Ndym; Fri, 07 Jun 2024 15:07: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 4Vwl1L3NgQz4gXT; Fri, 7 Jun 2024 15:07:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717772854; 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=q1K06n1J9Y5uk3VGA8eZSuFKAaor4Vn3uOSGN4/62XY=; b=CZNh1+eG311J1whpq7u6xa2QdCuTKY+tQd7FIzRA0uky87yR8vJBj2iIL/Q0pU06oKHzCW HDrkq537lY8uSOTTadrY6CQYT81hAdXpfP5IiQZ57/eGQ/uMTn9se3/gD4Bc4l6CATLiea /ZEK1xlKJgV1pjySygncE73i66nNQmyPrjqCoEb8ZBL2g+f3DyHBFburQSz2KFywZd9Kxu 8lYUwAZ3e7W3/u7i+m4/4yd9CEOwfWcpM0eXSD0q3kC8mF1V3r5ELeyF2yhzhdT7syTEPa WXHSTstGIfVq8lsmDh43p6D0uWQXkkFtYsi3kWVg/PXuPLyWSl6tJBVGoQGOFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717772854; a=rsa-sha256; cv=none; b=GEM7AoSZri/DVDlJxX393yHlQ4YjpmGaJluRs4aXJPxkgrJFomiiLydrv6D1h+jHKxeywE OOWnJ4/JPCZvEDQpKMEl+Lr8Xgmi4VaG2MO4bFzBQyy7ba9d/vUuKlmkB+J8VNEkbo8cWJ FjSCCKIFNillJnXKojXeNAlZJtytE+hXFL8gQN03wcrjwuCE+XkF22p5ea5M89EUOT3Vur PTwIGmww0Lp7nwTnRYQL5f05weCxnS95aUI/L95V1gNaXiVuc+chBz3HSwQNAIfDMkJJpF FuKkRhk9EkGVC0hRLehROBdnCG7dQs2X05iDxkK0rM4jtDZauJbYcA8ippVO5Q== 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=1717772854; 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=q1K06n1J9Y5uk3VGA8eZSuFKAaor4Vn3uOSGN4/62XY=; b=fcH9NMU94Y9YqcEyTle5B5dttIWgBGgGpLpJYVj+LjG1GONB0P0vUqYBUVM6HWBNfz86mn HX6TzTGrnheQsbfe7nLK7P8Hh+xFqa9MaJi+0PHEhzG2uW5CBQGALVTZZQX1r0sRGD4DAy HoW5QgVJzt4khZJEHwBNkRGfYbdVKjSskPiAnoMcvxX81elZ6bq06M/t04B7718iQ1/igj g6rSmSNjATaA3c0UwyltY71tEHygA1I+yj3V3TK9q3ZsBxrL9M4w2afOdlxAqpFOmG8LGP r9b1JfD6iEzXBaKeiXmnv/ssXH0kuegr361vPgonlYZk8Khwl+1KTru+X7ncHQ== 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 4Vwl1L30TwzJrb; Fri, 7 Jun 2024 15:07: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 457F7Yuv003664; Fri, 7 Jun 2024 15:07:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457F7YHY003661; Fri, 7 Jun 2024 15:07:34 GMT (envelope-from git) Date: Fri, 7 Jun 2024 15:07:34 GMT Message-Id: <202406071507.457F7YHY003661@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 89204d9dcbe2 - main - bpf: Prefer the boolean form when calling bpf_peers_present() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 89204d9dcbe28558fae65936a0e93f44d926b88f Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=89204d9dcbe28558fae65936a0e93f44d926b88f commit 89204d9dcbe28558fae65936a0e93f44d926b88f Author: Zhenlei Huang AuthorDate: 2024-06-07 15:06:07 +0000 Commit: Zhenlei Huang CommitDate: 2024-06-07 15:06:07 +0000 bpf: Prefer the boolean form when calling bpf_peers_present() No functional change intended. Reviewed by: markj, kp, #network MFC with: 8f31b879ecaf Differential Revision: https://reviews.freebsd.org/D45509 --- sys/net/bpf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 1078c57dfee2..7983337064be 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -2880,9 +2880,7 @@ bpfdetach(struct ifnet *ifp) bool bpf_peers_present_if(struct ifnet *ifp) { - struct bpf_if *bp = ifp->if_bpf; - - return (bpf_peers_present(bp) > 0); + return (bpf_peers_present(ifp->if_bpf)); } /* From nobody Fri Jun 7 15:07: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 4Vwl1M5B6Vz5Nf4W; Fri, 07 Jun 2024 15:07: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 4Vwl1M4Ld9z4gZR; Fri, 7 Jun 2024 15:07:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717772855; 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=wWpmGtHT9V3+10yPCanzgynXUxr5m8NTyuiGEkAwlEg=; b=a3HIG1XP+H2piQ5tIQaQ/T8dks5GiJU5Z2y/bO3k5Z7VWlw1YAPPRZ0c9yYBGUZ9Bw8eEK WAaGdKF3vT59kIHd/pii5KGjPwRtkrBdLEnRhQATMwFSJ1Jx50jqxFqpmTvoxBoADekL2A I3wXmgN11dLf5SOxkRGUbW+Ks5jXt+s274b3Yf5WTCjMPNMY/sOfjYEapCSrD7W9WVpE/a u+uPcm/0WQnKv4GVcITB6CwrVidRL+Q1tUcPDOsn3TwG6PSSKXZqzkZ8uzPEndYtzcIq6h RGnrQVqsbLWKrvPe2hZAcWLlgUxBfcXACf1y0NV2gNKrHOV8HjUDuwac0fzHpQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717772855; a=rsa-sha256; cv=none; b=LOop21eut4MiL0fnKSVInvtSDdPbOKJf+1igcoyFfpaQssLfWQ6ninlmnDee7avyNXDPaL zdSJeqYAWHK/KeRteBQ99GgffvOJaO4ZRIGg8P9RmCBS1hLV9j6SeY1SQWy00zZwYwPH93 xFcHcJ9DDdTIrfiAaKPll4SgpWAqV9dZ097BrKg0xdiHEgPGH7vzqsFQUCpR0gEFJ4nBDe Um1UqubQx75V8XLQ38f6sp8Q22dceKLN+cvd3AM+REDpFH+HI0bQY04UaacJYdmeJDK/nU CEDI/6dVNULc/juPpd2sd0aYk/7kX4amWobVijojqddt6/cnLcbd3wuQG9pvkA== 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=1717772855; 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=wWpmGtHT9V3+10yPCanzgynXUxr5m8NTyuiGEkAwlEg=; b=YGsXufYOMOzw3SU1Z4fA3td8qTjIrEeFXED+uZKM6b70r5+9qqdTQHfLNn9U9/H3jU/iW8 UD5IojOKJnkQ3iMrJwIKsewmh12Y3Wvbs4vlYw9fV3DmeJaYAI66xldoXlWzRnvtPfhcIF be5Z8TQjiNoRB30xXYWviJt/iaLp8DsikyxZ1vlCMa9KvYJBcBIF1rFaY75oSdfbh3e/Hq uj6dHlAoKmr9yY028YIuJfloZjRghzkVf8XjhfD21idlxmABpxhtbFhT9gbxC2JJawfyF3 nKa/21NPGDlMskSAECOISbT6pjO/OaEA38V+eRrEj8CohczrSukhTUR/CaIigg== 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 4Vwl1M3yVzzJyb; Fri, 7 Jun 2024 15:07: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 457F7ZnJ003719; Fri, 7 Jun 2024 15:07:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457F7Z7T003716; Fri, 7 Jun 2024 15:07:35 GMT (envelope-from git) Date: Fri, 7 Jun 2024 15:07:35 GMT Message-Id: <202406071507.457F7Z7T003716@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 0dfd11abc4bd - main - bpf: Make bpf_peers_present a boolean inline function List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 0dfd11abc4bd0dcb96a6d287cc4e52e8f59b64c1 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=0dfd11abc4bd0dcb96a6d287cc4e52e8f59b64c1 commit 0dfd11abc4bd0dcb96a6d287cc4e52e8f59b64c1 Author: Zhenlei Huang AuthorDate: 2024-06-07 15:06:08 +0000 Commit: Zhenlei Huang CommitDate: 2024-06-07 15:06:08 +0000 bpf: Make bpf_peers_present a boolean inline function This function was introduced in commit [1] and is actually used as a boolean function although it was not defined as so. No functional change intended. 1. 16d878cc99ef Fix the following bpf(4) race condition which can result in a panic Reviewed by: markj, kp, #network MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45509 --- sys/net/bpf.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/net/bpf.h b/sys/net/bpf.h index 0fd7c4105b30..e44a7cd2359d 100644 --- a/sys/net/bpf.h +++ b/sys/net/bpf.h @@ -433,15 +433,13 @@ int bpf_get_bp_params(struct bpf_if *, u_int *, u_int *); void bpfilterattach(int); u_int bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int); -static __inline int +static __inline bool bpf_peers_present(struct bpf_if *bpf) { struct bpf_if_ext *ext; ext = (struct bpf_if_ext *)bpf; - if (!CK_LIST_EMPTY(&ext->bif_dlist)) - return (1); - return (0); + return (!CK_LIST_EMPTY(&ext->bif_dlist)); } #define BPF_TAP(_ifp,_pkt,_pktlen) \ From nobody Fri Jun 7 17:02: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 4VwnZR20dSz5LMwb; Fri, 07 Jun 2024 17:02: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 4VwnZR1W9nz4wT8; Fri, 7 Jun 2024 17:02:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717779775; 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=LhSyHTuHznHGXg0Zw3RR5LbdFGtO85SRcH66TI4XUw4=; b=YG17YCCA2ZUu37GugGRpwAGiVqW7KV9up/kpjQboixZ8L9HKMXTVXv+T7ts597NyJzB0/A 7lR2PcLl+1yI32S9fV8+7i5n92HRWjf9pEeAkb6VjMmCVa1PpjrzGl7wuGiAy7q30PfNvG 9HtqgCjbWd/zl/aPEbI5v/FXzUXD0yCgpo5/4/jgFJJZWj929xiJRxsN+HRCvnOyTxj6yY 6DggRWC1gjkx+9RwrD3QsaXuCliF3wdq4yWrGcxDMNDOzx2QaDcgaMC49BK/DGHT1I958r 0YxlOJn+IPV65nCG4MWs87Nk8wruS0iTT/fCLJdnLNnTWCNDmPAetNqHaElFDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717779775; a=rsa-sha256; cv=none; b=Lf4Vuv/5AkAZMTFx7Pepmg95PUCHayqMUnesjBFt4u9+mAydK0y/FMYN0oPVWuPi73hywr 8ZTCVRnynyKi5f+QMb8X+l2byn3qZwATTofijhcZThG/vK2yxxDsJaDNf/meLB6YaxQlxA gSKY+m/HGIc3X7IFTkJ3qNv2DOtM6kEOr+fXmaf2B4bTWG28gljhr1p4LHUpxs+ycDRRRq 4tAvViDbBqHymF9xLiAXed/5beybsiLbYVPs/CyXjNz02GwY91MqVCigDLNyrDOBCV6a5R tulvMwy2M6eNcXcH7OncH4boX6VBm3xsY+z3zhxE5+wCqRqDU6K5GzVy8j3nbQ== 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=1717779775; 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=LhSyHTuHznHGXg0Zw3RR5LbdFGtO85SRcH66TI4XUw4=; b=OYs/s6mkjIy4YeJqPo98XzJ9ac6QL/7S+qloo9pcEc1kZgvLuuRcPtVHyEjups15lJjQsL 3mhJwVKqFTVNu1E8PMNAYIk29xZrJm/w4Q3mdXoUlD6VvK7BOIwqKRo5Ly12tq2RhoG1c+ 5J9ZzESt8MJeOY0sTxAvvfZ8BRPF3+T0WHSuyGBRpg8CdyEx/oJvGA1/USDZmduAbdvSlJ z+PhG8pX4nB+s+IoROpxJ5xE+29Yl46KndfohecLM+PTg6/MPi7fURdFnz54+3b4U0WENF tvq4vhytrynPcgop9IwJaMg9fhPraT395dREgWGaVIFTkMubL/xnQA2CyJT1Cg== 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 4VwnZR0qGMzNG9; Fri, 7 Jun 2024 17:02: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 457H2trv008443; Fri, 7 Jun 2024 17:02:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457H2tT0008440; Fri, 7 Jun 2024 17:02:55 GMT (envelope-from git) Date: Fri, 7 Jun 2024 17:02:55 GMT Message-Id: <202406071702.457H2tT0008440@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 4cc4b5e2b5f8 - main - Add some AMD device IDs. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4cc4b5e2b5f85f136169069559108ed7fff351f9 Auto-Submitted: auto-generated The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4cc4b5e2b5f85f136169069559108ed7fff351f9 commit 4cc4b5e2b5f85f136169069559108ed7fff351f9 Author: Dmitry Luhtionov AuthorDate: 2024-06-07 15:00:09 +0000 Commit: Alexander Motin CommitDate: 2024-06-07 17:02:03 +0000 Add some AMD device IDs. --- sys/dev/ahci/ahci_pci.c | 3 +++ sys/dev/sound/pci/hda/hdac.c | 1 + sys/dev/sound/pci/hda/hdac.h | 1 + sys/dev/usb/controller/xhci_pci.c | 3 +++ 4 files changed, 8 insertions(+) diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index 69587da2226a..59bcca0b3d47 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -72,6 +72,9 @@ static const struct { {0x43b61022, 0x00, "AMD X399", 0}, {0x43b51022, 0x00, "AMD 300 Series", 0}, /* X370 */ {0x43b71022, 0x00, "AMD 300 Series", 0}, /* B350 */ + {0x43c81022, 0x00, "AMD 400 Series", 0}, /* B450 */ + {0x43eb1022, 0x00, "AMD 500 Series", 0}, + {0x43f61022, 0x00, "AMD 600 Series", 0}, /* X670 */ {0x78001022, 0x00, "AMD Hudson-2", 0}, {0x78011022, 0x00, "AMD Hudson-2", 0}, {0x78021022, 0x00, "AMD Hudson-2", 0}, diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index f3dff2052b51..e45c121eb10b 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -193,6 +193,7 @@ static const struct { { HDA_ATI_RV940, "ATI RV940", 0, 0 }, { HDA_ATI_RV970, "ATI RV970", 0, 0 }, { HDA_ATI_R1000, "ATI R1000", 0, 0 }, + { HDA_ATI_OLAND, "ATI Oland", 0, 0 }, { HDA_ATI_KABINI, "ATI Kabini", 0, 0 }, { HDA_ATI_TRINITY, "ATI Trinity", 0, 0 }, { HDA_AMD_X370, "AMD X370", 0, 0 }, diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 191c835595ef..b40bfc7f6da3 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -178,6 +178,7 @@ #define HDA_ATI_RV930 HDA_MODEL_CONSTRUCT(ATI, 0xaa90) #define HDA_ATI_RV910 HDA_MODEL_CONSTRUCT(ATI, 0xaa98) #define HDA_ATI_R1000 HDA_MODEL_CONSTRUCT(ATI, 0xaaa0) +#define HDA_ATI_OLAND HDA_MODEL_CONSTRUCT(ATI, 0xaab0) #define HDA_ATI_KABINI HDA_MODEL_CONSTRUCT(ATI, 0x9840) #define HDA_ATI_TRINITY HDA_MODEL_CONSTRUCT(ATI, 0x9902) #define HDA_ATI_ALL HDA_MODEL_CONSTRUCT(ATI, 0xffff) diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index 359f14bb1e3c..3afb9fa8c6ef 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -100,6 +100,9 @@ xhci_pci_match(device_t self) return ("AMD Starship USB 3.0 controller"); case 0x149c1022: return ("AMD Matisse USB 3.0 controller"); + case 0x15e01022: + case 0x15e11022: + return ("AMD Raven USB 3.1 controller"); case 0x43ba1022: return ("AMD X399 USB 3.0 controller"); case 0x43b91022: /* X370 */ From nobody Fri Jun 7 18:45: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 4Vwqs83P8Gz5M3FP; Fri, 07 Jun 2024 18:45:48 +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 4Vwqs81K0Cz3x5R; Fri, 7 Jun 2024 18:45:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717785948; 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=bDbznpOEf+PHR+gQRfn1y7ZzXiHi0eosM79ho2fsYnE=; b=oZfsMbYdWDZysZmfmm1VKQlLDpQZ6PP9CQS8SO9KdL6hcaiiUg6zt95V9dO0vLwYXNlbzk 44tchclQSAPoaFKT4j7tnlfaZkyStXSs2VrKC9AHrWOYu+TyQaEtQINcJ80PybnU4xn+kC f/WwGFu8IukZTF4T/Y2X9mVnkuec18dVpDOuLXU+4rgKS28820Lr2laq+Mk5kp9vz5E3K/ kowPxx13V7od1ouNEF8KaINq1kWfSJQR0e3/xFmAkH3lqrwtTjdfap8EE/yg2itQWaiNxP Vi5xSzifPCPj4Xrr2DkK8qWVuABrYQP541aJIo8lwMRyAHPlGQlTjFovVBvJAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717785948; a=rsa-sha256; cv=none; b=hEeb+hoc7Ykxanc6/m/1SoNgS/lcaC7Wv1gsTeW3ViAA0N5bwGRtUgnSy063M0Xt8dTjb4 UO8Bzjv6pNxShusfb+IUrIxaXRj3995LhzhwSo3ee++ppXxArv9BTknPab9zVO1HErr35G EEAJPo+WVFxCYuQMqXqGL3hMuZz4vdRCR66P+nIQm4z+4DRONoPfr52N2NsOcOhV7zxLPR eSbTP/TROeznNiF3A88EtdaLYeP4WPLn87bVuGZVeoiT/kY8gtTaUErdwCSLsHixsWyQdG EbOkSRdIonjglLrNg5IN9l86QLjIO9Xd8gSIuGiXbz73GG0wYwhbbKbdQ+872A== 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=1717785948; 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=bDbznpOEf+PHR+gQRfn1y7ZzXiHi0eosM79ho2fsYnE=; b=lEmYd8fztG03b2/qfcw/eG6tBmTxP8zpC47+W+taepZoYkJ3kCto0HQ6d+t6Ga8KKmtc3z Q5nnRUvrWr3lMaXeFWjZZhVwqHD2vcaU696LN5kgjm2BzSEwvz2NODdKiczezWGQy3Jcg1 64W6Qq/BDHyv60HRZKr74hq3MSq3fgGyDyXJjMlelnLJDtG29Ffl+PDa+7ofEViANj2mSW Q0WbCjIE9G7r+hIQQ+gRsuzVJtxtipIyjd1x8CKtD0odOQeYmpypvdxsLLuB2m8eVyi17e 9CKXDspLxnafpRCx2aS7MVfaZXfDVn/shaGGKIjzT0ljMzCYsd/bjbB3eIKuQA== 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 4Vwqs80pLQzQhP; Fri, 7 Jun 2024 18:45:48 +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 457Ijl0q077605; Fri, 7 Jun 2024 18:45:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457IjlYq077602; Fri, 7 Jun 2024 18:45:47 GMT (envelope-from git) Date: Fri, 7 Jun 2024 18:45:47 GMT Message-Id: <202406071845.457IjlYq077602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: ead8e4c081e5 - main - Merge commit 382f70a877f0 from llvm-project (by Louis Dionne): List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ead8e4c081e5c4de4d508fc353f381457b058ca6 Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ead8e4c081e5c4de4d508fc353f381457b058ca6 commit ead8e4c081e5c4de4d508fc353f381457b058ca6 Author: Dimitry Andric AuthorDate: 2024-06-07 18:42:53 +0000 Commit: Dimitry Andric CommitDate: 2024-06-07 18:43:46 +0000 Merge commit 382f70a877f0 from llvm-project (by Louis Dionne): [libc++][NFC] Rewrite function call on two lines for clarity (#79141) Previously, there was a ternary conditional with a less-than comparison appearing inside a template argument, which was really confusing because of the <...> of the function template. This patch rewrites the same statement on two lines for clarity. Merge commit d129ea8d2fa3 from llvm-project (by Vitaly Buka): [libcxx] Align `__recommend() + 1` by __endian_factor (#90292) This is detected by asan after #83774 Allocation size will be divided by `__endian_factor` before storing. If it's not aligned, we will not be able to recover allocation size to pass into `__alloc_traits::deallocate`. we have code like this ``` auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1); __p = __allocation.ptr; __set_long_cap(__allocation.count); void __set_long_cap(size_type __s) _NOEXCEPT { __r_.first().__l.__cap_ = __s / __endian_factor; __r_.first().__l.__is_long_ = true; } size_type __get_long_cap() const _NOEXCEPT { return __r_.first().__l.__cap_ * __endian_factor; } inline ~basic_string() { __annotate_delete(); if (__is_long()) __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); } ``` 1. __recommend() -> even size 2. `std::__allocate_at_least(__alloc(), __recommend(__sz) + 1)` - > not even size 3. ` __set_long_cap() `- > lose one bit of size for __endian_factor == 2 (see `/ __endian_factor`) 4. `__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap())` -> uses even size (see `__get_long_cap`) This should fix incorrect deallocation sizes for some instances of std::string. Memory profiling or debugging tools like AddressSanitizer, LeakSanitizer or TCMalloc could then complain about the the size passed to a deallocation not matching the size originally passed to the allocation. Reported by: Aliaksei Kandratsenka PR: 279560 MFC after: 3 days --- contrib/llvm-project/libcxx/include/string | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/llvm-project/libcxx/include/string b/contrib/llvm-project/libcxx/include/string index ba169c3dbfc9..56e2ef09947f 100644 --- a/contrib/llvm-project/libcxx/include/string +++ b/contrib/llvm-project/libcxx/include/string @@ -1943,10 +1943,10 @@ private: if (__s < __min_cap) { return static_cast(__min_cap) - 1; } - size_type __guess = - __align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1; + const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : __endian_factor; + size_type __guess = __align_it<__boundary>(__s + 1) - 1; if (__guess == __min_cap) - ++__guess; + __guess += __endian_factor; return __guess; } From nobody Fri Jun 7 19:14: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 4VwrVN6jTDz5M5WQ; Fri, 07 Jun 2024 19:14: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 4VwrVN647yz40yG; Fri, 7 Jun 2024 19:14:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717787676; 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=TMLwB+RG4ZLLN6urZvksTWSTau/Yw3/hfnVOvj63Fs0=; b=nONVJ//QTAIK79rDzdvQRFGmldN3iZAPCQux1GOr6B7JUymXOK2jY5nBPRi9KIYRzZlnoX 7+Kxnp9VTh0iKuie8+IhoQxfHfFjZ9djausTEytEedkySKJh0KKnumDd/2RL5+jtsuZjJE 6Zko9tKRE5Cm5iR9tnlqoVF8s5YMU80puh02eCaulLMPhZc1dqa80KJ7Auy4T6XIMY8sBR wEJWMXFVh/XbZuundlp+2nM6/ETmS4ZroAdCM6YDuqjKk8pkF80dGiq5gQuLkjHsFrZR/O VJ6mvKx12bdGYUZ5XmdfZ0Iqhxz494b+p6/SziAbANjPgQdSDsiAnq+pB74TIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717787676; a=rsa-sha256; cv=none; b=URRKYGBaxjyw9EGCldveiGE4rqULwy+CazQqfWIhRKSRXoJrYXKPoCCLBZTxgxYyv3VXnP YoT5TOPckB7fB+x5BJuIWJdRrb/wjvwOEMOHpk4Cof2UlejVy4988FXarsfano6/2shc+1 5yrdH9o6jTvXx4kL1wTTHpapvkICuhBZQo6SFYm0HuYJM21gXHZ9SFdw6EvsBqyiOsPvs8 XeNlRKWqu14evNy0f0XzaVV9hPZH0E6j5pTUwXHfvtQpvR2xDMUPHlVyFNt+FAxSVSM33h 1a9q8b+U4dcoiGEQ5uJCDJgVwX4APvS7rVv6rKBgh00UNsAa8gxm6wpDAhjyLw== 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=1717787676; 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=TMLwB+RG4ZLLN6urZvksTWSTau/Yw3/hfnVOvj63Fs0=; b=ujOb+jhvezQUHToTTbcFna60SrdVtgUwwd2znvYkeveEQW2F53trQurmhwjvpOAQoFR6CL Qx0acf6X4SFlchoeNyqf27lqd7IP/2txYNkfs+id1gfhf+8ecXU71MEZWm+v4ZPbaTstX1 45nlNrWWi5bTpXneNi3/3soNIJ6If66MXPp3YkpNrsVCK8vHe7uNbGF++4TfIFCSY1euwT VjOBWD3+CCwHqNRFQBOm/Qg7yaveuc5lSgU7AQFMLhSK/lQ06vQzUY+30sdhTTIm8tI1ZN 9rclBgXXQjCkDn5ubZ9+jn9hx3iOfhO57VTBhOWXZ7CDHmsEd/zXtHzyrFqhEw== 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 4VwrVN5YjvzQrJ; Fri, 7 Jun 2024 19:14: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 457JEaP5029011; Fri, 7 Jun 2024 19:14:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457JEajS029008; Fri, 7 Jun 2024 19:14:36 GMT (envelope-from git) Date: Fri, 7 Jun 2024 19:14:36 GMT Message-Id: <202406071914.457JEajS029008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ea6d6addc9bc - main - pf.conf.5: remove 'set limit tables' List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: ea6d6addc9bc78a174fc667d4f41f5f62ffdd8ae Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ea6d6addc9bc78a174fc667d4f41f5f62ffdd8ae commit ea6d6addc9bc78a174fc667d4f41f5f62ffdd8ae Author: Kristof Provost AuthorDate: 2024-06-07 01:03:01 +0000 Commit: Kristof Provost CommitDate: 2024-06-07 18:59:02 +0000 pf.conf.5: remove 'set limit tables' We've never supported this (or at least not since 2012) limit. Remove it from the man page. Event: Kitchener-Waterloo Hackathon 202406 --- share/man/man5/pf.conf.5 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 9803d96bc5d9..da55f00293bb 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -27,7 +27,7 @@ .\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 6, 2023 +.Dd June 6, 2024 .Dt PF.CONF 5 .Os .Sh NAME @@ -419,13 +419,10 @@ and options) to 2000. Using .Bd -literal -offset indent -set limit tables 1000 set limit table-entries 100000 .Ed .Pp -sets limits on the memory pools used by tables. -The first limits the number of tables that can exist to 1000. -The second limits the overall number of addresses that can be stored +sets the limit on the overall number of addresses that can be stored in tables to 100000. .Pp Various limits can be combined on a single line: From nobody Fri Jun 7 19:14: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 4VwrVQ1kT7z5M5bk; Fri, 07 Jun 2024 19:14: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 4VwrVP6nyfz413T; Fri, 7 Jun 2024 19:14:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717787677; 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=gkZnCVR+EMkIelDvdTkDQU3rF6zNAqLGGxRfWHt5Bcs=; b=O0kSKwaB4QdsBIlqgV2RV7FuW5v6BqeUDLK2ssM4xSFUOXTnIekQTyemCRO5HMQWMFTSLd sW/Kg4l270jK/yTxXlVDiwwGm7144Mempx/+DQ/PNkX+MP6CZXtdDsx4W3u8wfu6asAs0K Q2spldlWqyvVOHDdgYfJqdOhNDrG3X8C8SXppr5U/aiyx1sFkkMxWYugLByuk/qHx0F9HU L95rpKJuqzdCU65IKSs4Zp+sRnhsMGz7aJQmx/49Um9EPx+MDt4F/vsUqz3/w5wqpUQp60 CbsQ1Wc16cbem3A8+FLCjvJibb2+VS01xmyaQwt740y54XKoprEfGDhzvxjbfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717787677; a=rsa-sha256; cv=none; b=yxCs/sjPSN9uOUv1GhQZ9kMSZxm1fgXHooAVZmCATgitIjlk726qiWTpjJx+U5Ui8U+yV3 1oCRG83e7BOaA/yDzqQ8H5NPUZSFAGLodjnjozexqO8/yljZ7kUdYJWhyzquwfWDB2/NFn hPzHZyQdLKIMK1L2AKAEiaZUkYjo6Uc4RUKDolyfzXfH/t85sysQY1AnhXnTZXvneLXjQT dZ5Q2HzPIpuXO9fzG4mEEgweoQaKd87ilWdfivYXU1DWX334pzXCxgRLXNSt7CS3SG985W I0PRiTZrvekXHpkxFFz6TiT6thUhtswghwPJKbkcpbZMNcVfzR9RuNJJaCwrjQ== 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=1717787677; 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=gkZnCVR+EMkIelDvdTkDQU3rF6zNAqLGGxRfWHt5Bcs=; b=UIl+CvLmuOmNSeIOVYV4zle/gCaYvyONnwxCNqhzkRa4Ygt6w6KemXC74Ugg665ObSXT8K xfLynwLb+sHTGF2laru7vKXt2ChwtnBia2+0C3fcz3P+qWxDfskdG8fohMU0v0KkOqAimf duSJFiOpNuc+tPAGWjoivQ1VXLWaswOuwfs2W3A7NLxKc3CpOUwR/8k66Al8bjywsSTNnz ieMT+LYEHlgm4pBGgF1U1syD7NpP7QWc019sqY4SdiO/0bkf1MU/o++LT1kMI7rYFn7yjs oUZN7BHSwWALVd9fwDIvXqSPwpONl119N4gb83Wul4Tn8RRZwaA9kWj2aqjTLQ== 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 4VwrVP6PGPzRP5; Fri, 7 Jun 2024 19:14: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 457JEbDj029061; Fri, 7 Jun 2024 19:14:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457JEbrd029058; Fri, 7 Jun 2024 19:14:37 GMT (envelope-from git) Date: Fri, 7 Jun 2024 19:14:37 GMT Message-Id: <202406071914.457JEbrd029058@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: d9ab89993138 - main - pf: migrate DIOCGETLIMIT/DIOCSETLIMIT to netlink List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: d9ab8999313845e87c67532437a0441d9cd57e72 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d9ab8999313845e87c67532437a0441d9cd57e72 commit d9ab8999313845e87c67532437a0441d9cd57e72 Author: Kristof Provost AuthorDate: 2024-06-07 01:08:50 +0000 Commit: Kristof Provost CommitDate: 2024-06-07 18:59:02 +0000 pf: migrate DIOCGETLIMIT/DIOCSETLIMIT to netlink Event: Kitchener-Waterloo Hackathon 202406 --- lib/libpfctl/libpfctl.c | 88 +++++++++++++++++++++++++++++-- lib/libpfctl/libpfctl.h | 2 + sbin/pfctl/parse.y | 2 +- sbin/pfctl/pfctl.c | 19 +++---- sbin/pfctl/pfctl_parser.h | 2 +- sys/net/pfvar.h | 2 + sys/netpfil/pf/pf_ioctl.c | 56 +++++++++++++------- sys/netpfil/pf/pf_nl.c | 76 ++++++++++++++++++++++++++ sys/netpfil/pf/pf_nl.h | 8 +++ tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/limits.sh | 66 +++++++++++++++++++++++ usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 14 +++-- 12 files changed, 291 insertions(+), 45 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index a31fe6f0aff4..ebe52e7a415f 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -2213,7 +2213,7 @@ pfctl_clear_eth_rules(int dev, const char *anchorname) } static int -pfctl_get_limit(int dev, const int index, uint *limit) +_pfctl_get_limit(int dev, const int index, uint *limit) { struct pfioc_limit pl; @@ -2237,7 +2237,7 @@ pfctl_set_syncookies(int dev, const struct pfctl_syncookies *s) uint state_limit; uint64_t lim, hi, lo; - ret = pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); + ret = _pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); if (ret != 0) return (ret); @@ -2274,7 +2274,7 @@ pfctl_get_syncookies(int dev, struct pfctl_syncookies *s) uint state_limit; bool enabled, adaptive; - ret = pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); + ret = _pfctl_get_limit(dev, PF_LIMIT_STATES, &state_limit); if (ret != 0) return (ret); @@ -2606,3 +2606,85 @@ pfctl_get_timeout(struct pfctl_handle *h, uint32_t timeout, uint32_t *seconds) return (e.error); } +int +pfctl_set_limit(struct pfctl_handle *h, const int index, const uint limit) +{ + 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_LIMIT); + + snl_add_msg_attr_u32(&nw, PF_LI_INDEX, index); + snl_add_msg_attr_u32(&nw, PF_LI_LIMIT, limit); + + 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_limit { + unsigned int limit; +}; +#define _OUT(_field) offsetof(struct pfctl_nl_limit, _field) +static struct snl_attr_parser ap_get_limit[] = { + { .type = PF_LI_LIMIT, .off = _OUT(limit), .cb = snl_attr_get_uint32 }, +}; +static struct snl_field_parser fp_get_limit[] = {}; +#undef _OUT +SNL_DECLARE_PARSER(get_limit_parser, struct genlmsghdr, fp_get_limit, ap_get_limit); + +int +pfctl_get_limit(struct pfctl_handle *h, const int index, uint *limit) +{ + struct snl_writer nw; + struct pfctl_nl_limit li = {}; + 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_LIMIT); + hdr->nlmsg_flags |= NLM_F_DUMP; + + snl_add_msg_attr_u32(&nw, PF_LI_INDEX, index); + + 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_limit_parser, &li)) + continue; + } + + if (limit != NULL) + *limit = li.limit; + + return (e.error); +} diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 6d59d66a924a..44c7fa47e88d 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -495,5 +495,7 @@ int pfctl_natlook(struct pfctl_handle *h, 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); +int pfctl_set_limit(struct pfctl_handle *h, const int index, const uint limit); +int pfctl_get_limit(struct pfctl_handle *h, const int index, uint *limit); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 2876eb6e89dc..d07a3fdc188e 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -5198,7 +5198,7 @@ limit_spec : STRING NUMBER yyerror("only positive values permitted"); YYERROR; } - if (pfctl_set_limit(pf, $1, $2) != 0) { + if (pfctl_apply_limit(pf, $1, $2) != 0) { yyerror("unable to set limit %s %u", $1, $2); free($1); YYERROR; diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index d97043fc5c66..ec718f6b0a99 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1679,21 +1679,19 @@ pfctl_show_timeouts(int dev, int opts) int pfctl_show_limits(int dev, int opts) { - struct pfioc_limit pl; + unsigned int limit; int i; if (opts & PF_OPT_SHOWALL) pfctl_print_title("LIMITS:"); - memset(&pl, 0, sizeof(pl)); for (i = 0; pf_limits[i].name; i++) { - pl.index = pf_limits[i].index; - if (ioctl(dev, DIOCGETLIMIT, &pl)) + if (pfctl_get_limit(pfh, pf_limits[i].index, &limit)) err(1, "DIOCGETLIMIT"); printf("%-13s ", pf_limits[i].name); - if (pl.limit == UINT_MAX) + if (limit == UINT_MAX) printf("unlimited\n"); else - printf("hard limit %8u\n", pl.limit); + printf("hard limit %8u\n", limit); } return (0); } @@ -2425,7 +2423,7 @@ pfctl_load_options(struct pfctl *pf) } int -pfctl_set_limit(struct pfctl *pf, const char *opt, unsigned int limit) +pfctl_apply_limit(struct pfctl *pf, const char *opt, unsigned int limit) { int i; @@ -2451,12 +2449,7 @@ pfctl_set_limit(struct pfctl *pf, const char *opt, unsigned int limit) int pfctl_load_limit(struct pfctl *pf, unsigned int index, unsigned int limit) { - struct pfioc_limit pl; - - memset(&pl, 0, sizeof(pl)); - pl.index = index; - pl.limit = limit; - if (ioctl(pf->dev, DIOCSETLIMIT, &pl)) { + if (pfctl_set_limit(pf->h, index, limit)) { if (errno == EBUSY) warnx("Current pool size exceeds requested hard limit"); else diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 06ab5d052631..6de998b34e52 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -288,7 +288,7 @@ void pfctl_clear_pool(struct pfctl_pool *); 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); +int pfctl_apply_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_do_set_debug(struct pfctl *, char *); diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 16d3d90f4862..eb36c0aee4d1 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2505,6 +2505,8 @@ int pf_ioctl_addrule(struct pf_krule *, uint32_t, void pf_ioctl_clear_status(void); int pf_ioctl_get_timeout(int, int *); int pf_ioctl_set_timeout(int, int, int *); +int pf_ioctl_get_limit(int, unsigned int *); +int pf_ioctl_set_limit(int, unsigned int, unsigned 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 cef50c00283b..af3f914982ec 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2483,6 +2483,40 @@ pf_ioctl_get_timeout(int timeout, int *seconds) return (0); } +int +pf_ioctl_set_limit(int index, unsigned int limit, unsigned int *old_limit) +{ + + PF_RULES_WLOCK(); + if (index < 0 || index >= PF_LIMIT_MAX || + V_pf_limits[index].zone == NULL) { + PF_RULES_WUNLOCK(); + return (EINVAL); + } + uma_zone_set_max(V_pf_limits[index].zone, limit); + if (old_limit != NULL) + *old_limit = V_pf_limits[index].limit; + V_pf_limits[index].limit = limit; + PF_RULES_WUNLOCK(); + + return (0); +} + +int +pf_ioctl_get_limit(int index, unsigned int *limit) +{ + PF_RULES_RLOCK_TRACKER; + + if (index < 0 || index >= PF_LIMIT_MAX) + return (EINVAL); + + PF_RULES_RLOCK(); + *limit = V_pf_limits[index].limit; + PF_RULES_RUNLOCK(); + + return (0); +} + static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { @@ -3894,32 +3928,16 @@ DIOCGETSTATESV2_full: case DIOCGETLIMIT: { struct pfioc_limit *pl = (struct pfioc_limit *)addr; - if (pl->index < 0 || pl->index >= PF_LIMIT_MAX) { - error = EINVAL; - break; - } - PF_RULES_RLOCK(); - pl->limit = V_pf_limits[pl->index].limit; - PF_RULES_RUNLOCK(); + error = pf_ioctl_get_limit(pl->index, &pl->limit); break; } case DIOCSETLIMIT: { struct pfioc_limit *pl = (struct pfioc_limit *)addr; - int old_limit; + unsigned int old_limit; - PF_RULES_WLOCK(); - if (pl->index < 0 || pl->index >= PF_LIMIT_MAX || - V_pf_limits[pl->index].zone == NULL) { - PF_RULES_WUNLOCK(); - error = EINVAL; - break; - } - uma_zone_set_max(V_pf_limits[pl->index].zone, pl->limit); - old_limit = V_pf_limits[pl->index].limit; - V_pf_limits[pl->index].limit = pl->limit; + error = pf_ioctl_set_limit(pl->index, pl->limit, &old_limit); pl->limit = old_limit; - PF_RULES_WUNLOCK(); break; } diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index 026f8caab535..57b1a4a6b5b3 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -1410,6 +1410,67 @@ pf_handle_get_timeout(struct nlmsghdr *hdr, struct nl_pstate *npt) return (0); } +struct pf_nl_set_limit +{ + uint32_t index; + uint32_t limit; +}; +#define _OUT(_field) offsetof(struct pf_nl_set_limit, _field) +static const struct nlattr_parser nla_p_set_limit[] = { + { .type = PF_LI_INDEX, .off = _OUT(index), .cb = nlattr_get_uint32 }, + { .type = PF_LI_LIMIT, .off = _OUT(limit), .cb = nlattr_get_uint32 }, +}; +static const struct nlfield_parser nlf_p_set_limit[] = {}; +#undef _OUT +NL_DECLARE_PARSER(set_limit_parser, struct genlmsghdr, nlf_p_set_limit, nla_p_set_limit); + +static int +pf_handle_set_limit(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pf_nl_set_limit attrs = {}; + int error; + + error = nl_parse_nlmsg(hdr, &set_limit_parser, npt, &attrs); + if (error != 0) + return (error); + + return (pf_ioctl_set_limit(attrs.index, attrs.limit, NULL)); +} + +static int +pf_handle_get_limit(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct pf_nl_set_limit attrs = {}; + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr_new; + int error; + + error = nl_parse_nlmsg(hdr, &set_limit_parser, npt, &attrs); + if (error != 0) + return (error); + + error = pf_ioctl_get_limit(attrs.index, &attrs.limit); + 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_LIMIT; + ghdr_new->version = 0; + ghdr_new->reserved = 0; + + nlattr_add_u32(nw, PF_LI_LIMIT, attrs.limit); + + if (!nlmsg_end(nw)) { + nlmsg_abort(nw); + return (ENOMEM); + } + + return (0); +} + static const struct nlhdr_parser *all_parsers[] = { &state_parser, &addrule_parser, @@ -1419,6 +1480,7 @@ static const struct nlhdr_parser *all_parsers[] = { &natlook_parser, &set_debug_parser, &set_timeout_parser, + &set_limit_parser, }; static int family_id; @@ -1536,6 +1598,20 @@ 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_LIMIT, + .cmd_name = "SET_LIMIT", + .cmd_cb = pf_handle_set_limit, + .cmd_flags = GENL_CMD_CAP_DO | GENL_CMD_CAP_HASPOL, + .cmd_priv = PRIV_NETINET_PF, + }, + { + .cmd_num = PFNL_CMD_GET_LIMIT, + .cmd_name = "GET_LIMIT", + .cmd_cb = pf_handle_get_limit, + .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 5f9d8166ca50..437cc6482dbb 100644 --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -52,6 +52,8 @@ enum { PFNL_CMD_SET_DEBUG = 14, PFNL_CMD_SET_TIMEOUT = 15, PFNL_CMD_GET_TIMEOUT = 16, + PFNL_CMD_SET_LIMIT = 17, + PFNL_CMD_GET_LIMIT = 18, __PFNL_CMD_MAX, }; #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1) @@ -342,6 +344,12 @@ enum pf_timeout_types_t { PF_TO_SECONDS = 2, /* u32 */ }; +enum pf_limit_types_t { + PF_LI_UNSPEC, + PF_LI_INDEX = 1, /* u32 */ + PF_LI_LIMIT = 2, /* u32 */ +}; + #ifdef _KERNEL void pf_nl_register(void); diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 089db2f19766..2840dc92f2fa 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -17,6 +17,7 @@ ATF_TESTS_SH+= altq \ fragmentation_no_reassembly \ get_state \ icmp \ + limits \ loginterface \ killstate \ macro \ diff --git a/tests/sys/netpfil/pf/limits.sh b/tests/sys/netpfil/pf/limits.sh new file mode 100644 index 000000000000..474684bef660 --- /dev/null +++ b/tests/sys/netpfil/pf/limits.sh @@ -0,0 +1,66 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2024 Kristof Provost +# +# 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 limits' + atf_set require.user root +} + +basic_body() +{ + pft_init + + vnet_mkjail alcatraz + + pft_set_rules alcatraz \ + "set limit states 200" \ + "set limit frags 100" \ + "set limit src-nodes 50" \ + "set limit table-entries 25" + + atf_check -s exit:0 -o match:'states.*200' \ + jexec alcatraz pfctl -sm + atf_check -s exit:0 -o match:'frags.*100' \ + jexec alcatraz pfctl -sm + atf_check -s exit:0 -o match:'src-nodes.*50' \ + jexec alcatraz pfctl -sm + atf_check -s exit:0 -o match:'table-entries.*25' \ + jexec alcatraz pfctl -sm +} + +basic_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "basic" +} diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c index f02329901f69..9f7e6d4f31cb 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c @@ -318,36 +318,34 @@ pf_limits(struct snmp_context __unused *ctx, struct snmp_value *val, u_int sub, u_int __unused vindex, enum snmp_op op) { asn_subid_t which = val->var.subs[sub - 1]; - struct pfioc_limit pl; + unsigned int index, limit; if (op == SNMP_OP_SET) return (SNMP_ERR_NOT_WRITEABLE); if (op == SNMP_OP_GET) { - bzero(&pl, sizeof(struct pfioc_limit)); - switch (which) { case LEAF_pfLimitsStates: - pl.index = PF_LIMIT_STATES; + index = PF_LIMIT_STATES; break; case LEAF_pfLimitsSrcNodes: - pl.index = PF_LIMIT_SRC_NODES; + index = PF_LIMIT_SRC_NODES; break; case LEAF_pfLimitsFrags: - pl.index = PF_LIMIT_FRAGS; + index = PF_LIMIT_FRAGS; break; default: return (SNMP_ERR_NOSUCHNAME); } - if (ioctl(pfctl_fd(pfh), DIOCGETLIMIT, &pl)) { + if (pfctl_get_limit(pfh, index, &limit)) { syslog(LOG_ERR, "pf_limits(): ioctl(): %s", strerror(errno)); return (SNMP_ERR_GENERR); } - val->v.uint32 = pl.limit; + val->v.uint32 = limit; return (SNMP_ERR_NOERROR); } From nobody Fri Jun 7 21:14: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 4Vwv8J6j9yz5MHyk; Fri, 07 Jun 2024 21:14: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 4Vwv8J5qxhz4F75; Fri, 7 Jun 2024 21:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717794848; 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=k6XSLAmLT7I+6JThHIGe9YF2G7NGxiadkwRjsqoEEJM=; b=fjrCfrnftFKf1zrU0/LCP38mzKX7Lqr1SvuOyJ8p5I/3tKD/Yics60Gb1R9stKypO6Xq13 XS9A2EKF6O5ehOPFfXoX3ubCuXy7Xi11By5bpsYNhzT0bazjDWAsBteOYFJ02lqYJqCVIb lm6qhDfLi5knGjenNRWQmP13sEiTNkVJ6ZtLbLef+7BHJXPzchtzEXQICx+Q9AS6w7Yr6u K+MC4jOITAmzUmrHjGMkvBw9bld/Ig6Ebt2GGK70INhbIi4lfNZV2ezcqQAyGkbdm+QfkW T4ABcdtjOZpvnnwJft0IN9bHkz5AswfG30a0Ik2ZWv+Zo9dvN9zpamAHx2Hh+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717794848; a=rsa-sha256; cv=none; b=VXhh98Ly35HzPlQBQxqJPPmZnMyRaJY65rvHgOQLm+asap3KXaxYo9yWE/eHgnGG0bGqNE X08BY3aIRsAaA3CJ3qQ16KTtHKWqYqkODVzgz747AgSoddTTbFPHs9xspfDnLApXV1OSjp xQJUUT0rSxlq7DxmtBXcRK9yEUy8bdDLvy7js39Xn1Ar7WqGnPLm3Y9BarHEy5NDbvH6G8 1B+GTlLSP16zdFiviy7c/2QimUuQun4dRU32EV/TSFfEV/EtpMsqBLiE5/9Ti1HrdAXUXP P0MulXpyaCjZ6GpWB9286EYj01GQKScxvSNvN4wPPxjvK9RRUZcg8mC/W9H7nw== 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=1717794848; 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=k6XSLAmLT7I+6JThHIGe9YF2G7NGxiadkwRjsqoEEJM=; b=pwbSV3v6J0ycGdi8nSY5z7fSdPpu9AYOJ5daQ4fpacfGr6ijKL03dsTYyRcWfh9v9IC6d1 b02c1hFTMnSwGn2EFbue8QlVDsQp8NOHuTydzBOlHcQGmR1YHXsOy1kASYXyRDWwHmeL5q MhEMGgZ/JIgOOZTF3W5x8zhkoCeiGTOlCg3Uu0vMVNs5QDHLvXoaHwsqVXpYfZwgieY2+I oQkdhkEEqcGbirqjTdHKe3UpzZZrrpEWYs45UiZol0P1U+0CHAn7OSKTTRpkFWHW2zlG2D sSmr11ePybKQP0vaVPxyprBq2lwWwAQ1yT8Cl/wZSSbXyV930gNg7iAfCvmhYQ== 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 4Vwv8J5RHHzWFG; Fri, 7 Jun 2024 21:14: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 457LE8aq031162; Fri, 7 Jun 2024 21:14:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457LE8M8031159; Fri, 7 Jun 2024 21:14:08 GMT (envelope-from git) Date: Fri, 7 Jun 2024 21:14:08 GMT Message-Id: <202406072114.457LE8M8031159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 582469016aed - main - LinuxKPI: 802.11: initalize lsta to NULL in linuxkpi_ieee80211_rx() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 582469016aed4fac3a7ead24dc31000edbb7e823 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=582469016aed4fac3a7ead24dc31000edbb7e823 commit 582469016aed4fac3a7ead24dc31000edbb7e823 Author: Bjoern A. Zeeb AuthorDate: 2024-06-05 22:35:00 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-07 21:06:31 +0000 LinuxKPI: 802.11: initalize lsta to NULL in linuxkpi_ieee80211_rx() The logic following this new assignment in some cases may not set lsta but the later tracing is checking for it to be != NULL. With lsta not initialized that check may not hold up and later we would dereference lsta->state and possibly panic. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D45507 --- sys/compat/linuxkpi/common/src/linux_80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 03b36e6526bd..cd1897a08ccd 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -5054,6 +5054,7 @@ no_trace_beacons: goto err; } + lsta = NULL; if (sta != NULL) { lsta = STA_TO_LSTA(sta); ni = ieee80211_ref_node(lsta->ni); From nobody Fri Jun 7 21:15: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 4VwvBN2sHGz5MJ7l; Fri, 07 Jun 2024 21:15: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 4VwvBM45ryz4FQM; Fri, 7 Jun 2024 21:15:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717794955; 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=ycCDztrhT8AmOO0irNlnoZiY6Dbov4WhiIrKKgsCJdM=; b=F+GtIxNyLkMuEAuk8vTgE1sp0NhlEYKBSU1bKI5SAfIPDESHJJ1viF41OuXjZhyqvC2BCc /z+I/y4dTJOCQeFBndV03X9HuuTqXrEiSkv0NJmc01bk0TFDEAURxDCLhaFAyt7SnyMzro NADfFXI4vsPS480DIADaEDyJpY5I6GhGgB1I59ZbUbeTcZhqTjZOX1xvKCsql8+vV7q8J8 6KFTnNvNLKmDxp+UhQkI/7xBld2qg82f74YImNwJVVs4t/y8sPanDRFKhNA1Z3ajNsk5/K IPR26LBrlk7kbUdweD6rBoRP19MrygT5qRUTj18HvqZM8UVFcYwzi+EJEFJqeA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717794955; a=rsa-sha256; cv=none; b=t0qwjuMt/NwyNdDUzXEIGpJ9wVmBoqxyEDIQ0MbKhWoTcrfntBAM+3pio9eQIQFiJoFpic UUIVf/AdZfDPLQ5P+g/sVPKEHeXqJclftahz8rq2yggKHHROxGuue9mQ0Ev5+RkG2es0+0 vFT7/mLvAYfoSG7u+5Kn6Qer5wlk+EwtCHIIDDz8nN6I+oFw3lE7f5BMvv2Ifi5BV31rVT 9tF4BDAojAWvxrw95sdMW57IilEM85Iu4/tKNCakQtVvjv7reX4QwHskurHnlfUQgIZL+i dEUX8WoFbSpe8SE9F3doEpplT6YgYvlFyhHf7w28rUfOeacGYueQBxsszdgEsA== 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=1717794955; 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=ycCDztrhT8AmOO0irNlnoZiY6Dbov4WhiIrKKgsCJdM=; b=Aa2sup2LEXKkrZ3961kjGFlMbhmcRWvbjEWCiClOUJrcxZhwaYmj0tHll6uZWVnOlipq61 yvZgezDXVwz+MJiRuCu/MKZW2rNslU9c4tab8cZMOocuHXTtAz0gkQ0cyZ/GuTt7GaZVnj YcHbbahbEPP4VqUZ+2M9r9mCDiMxQcQ+0wA+oBMNP6+0TCDjDBD20HgQHEqpdBpOBKLFDd 3XCtw9CLlhg44WyxkKGoy1g+NkkiWeBzknF12c9muGOJ0/J76XfrafvX2PjEupNV7ZbAbF 0/ltrZEsqFJHqk/S7biCDgh8SgFwWWQTnWyc00ispKKHamuVxPyJVb04iDnrEw== 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 4VwvBM3j2DzVyf; Fri, 7 Jun 2024 21:15: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 457LFtXi031519; Fri, 7 Jun 2024 21:15:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457LFtBi031516; Fri, 7 Jun 2024 21:15:55 GMT (envelope-from git) Date: Fri, 7 Jun 2024 21:15:55 GMT Message-Id: <202406072115.457LFtBi031516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 5bbf4b629186 - main - net80211: fix IEEE80211_FHT_BITS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 5bbf4b6291863452acfb5a7fc76f227848841cac Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5bbf4b6291863452acfb5a7fc76f227848841cac commit 5bbf4b6291863452acfb5a7fc76f227848841cac Author: Bjoern A. Zeeb AuthorDate: 2024-05-31 21:48:49 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-07 21:15:04 +0000 net80211: fix IEEE80211_FHT_BITS AMPDU_RX was added as a second AMPDU_TX, LDPC_TX and LDPC_RX missing; correct and add missing. Makes ddb output (and other debugging) look more correct. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D45505 --- sys/net80211/ieee80211_var.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 9273b43a5823..c827984b5f37 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -726,7 +726,7 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FHT_BITS \ "\20\1NONHT_PR" \ - "\23GF\24HT\25AMPDU_TX\26AMPDU_TX" \ + "\21LDPC_TX\22LDPC_RX\23GF\24HT\25AMPDU_TX\26AMPDU_RX" \ "\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN\33SHORTGI20\34SHORTGI40" \ "\35HTCOMPAT\36RIFS\37STBC_TX\40STBC_RX" From nobody Fri Jun 7 21:17: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 4VwvD56YlGz5MJKc; Fri, 07 Jun 2024 21:17: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 4VwvD55zDHz4G4F; Fri, 7 Jun 2024 21:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717795045; 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=KWyNjOtu/+93ZAiOpUxaa1Y65RMjZ8Go6D6LwIFnFBE=; b=VANwMkB6B20L6bzZjjqAawRYyd3tnSM+qUe2YOBZcmn7LPhqsS/GTgi3vKjsPsx9/HqPAM /02DDtMs6qF1d6bWU004xMKHi+bVdh35tAaOwcXG1VpIQ+yml2R8QtFcYrhDPq4waBkBNq q1wPHVYaFA3K85/fG6JIyoKfxLPno3qlMSzEeu27JX7XE7S2TOfRXxIqg/f2PqW/DU8CxG uMmBSyYpDaFMri/p4XbrGlKiEFRRfFWUrIzeV0MyNIi2Qlk5acz3wWiwXIpi6z/lHJVvbe 5dAWB4wvCZOyb9ZAJeSZEvYC75DuOGxJNqN43DZUSFA1/Trhg7itK6mL6WrEGQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717795045; a=rsa-sha256; cv=none; b=qYNH1FiLflI+BUSzFUF8IQRdKxJFgnuxERwJL2gW5EtakPxxWxNwn5edunr2ou//mjJweA 4ntl5NmwHJ9PsMi3+LkGGxiUmgGSI3TzkQxptZaGkP/sA1/XXnwCZqagOyOTB9FoDJeJoH xy6wTsq4k2uIV8FB9C9vGlAHF5vhtNez1QfVhhyzVBrNCTFOWKQYmz00L40gg1ghZhkcld 6W0n1IN2jH0mx3JlZbE2Azk4XQR863tj28zeu8lG+CBjwTY5D9UCYGOc3iMPeVBFXINVP9 BxEGETSgurrGi91JH/uR88qxfo/M5CReACapLXj48jZTMpHLJ+AXNMBSnfi/4w== 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=1717795045; 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=KWyNjOtu/+93ZAiOpUxaa1Y65RMjZ8Go6D6LwIFnFBE=; b=WyfkqOq04TyV+q6Nvyn1McgXTuM8+3aqUzuNZGhBcc5ViO0nJpqVqxNdEN8bi20B/f2aKe LnPkO8g5yf/IjWgERn+x7IpLUGpohEqjXEaqh6wtkkKbozesZMWkEaM3z/ihTYxmhEP+ML sHwGYIS8caUbY+/0z5yNr/yG+sy6dmMXC9cQh+YUrbuaTlITnLRpv1KgWpoKQJgL5Mf16w zF9f2GsAMCdR0E6xF2xu1L2HIJm/F/1VlgdXlX/WhtefSPBf21HK09zZYanlSGw9N/EvRl Lmxpp+A86+wP2rSPeXRZpACrU/HCZN7oVNInrxNufFWbeVLK/QdD2FmSljsurw== 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 4VwvD55Zd5zWJ7; Fri, 7 Jun 2024 21:17: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 457LHPPG032004; Fri, 7 Jun 2024 21:17:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457LHP3b032001; Fri, 7 Jun 2024 21:17:25 GMT (envelope-from git) Date: Fri, 7 Jun 2024 21:17:25 GMT Message-Id: <202406072117.457LHP3b032001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3e0915b7b685 - main - LinuxKPI: 802.11: Fix definition of IEEE80211_HT_CAP_RX_STBC List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 3e0915b7b6857afdbd283f2d448906e6a032ee07 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3e0915b7b6857afdbd283f2d448906e6a032ee07 commit 3e0915b7b6857afdbd283f2d448906e6a032ee07 Author: Bjoern A. Zeeb AuthorDate: 2024-06-05 21:57:45 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-07 21:16:49 +0000 LinuxKPI: 802.11: Fix definition of IEEE80211_HT_CAP_RX_STBC IEEE80211_HT_CAP_RX_STBC was set to 0x100 instead of 0x300. Correct to get the expected behavior. Sponsored by: The FreeBSD Foundation MFC after: 3 days Fixes: b0f73768220e9 LinuxKPI: 802.11 header updates Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D45506 --- sys/compat/linuxkpi/common/include/linux/ieee80211.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h index 2000e7480ff8..0fd90e921c77 100644 --- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h +++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h @@ -263,7 +263,7 @@ enum ieee80211_ac_numbers { #define IEEE80211_HT_CAP_SGI_20 0x0020 /* IEEE80211_HTCAP_SHORTGI20 */ #define IEEE80211_HT_CAP_SGI_40 0x0040 /* IEEE80211_HTCAP_SHORTGI40 */ #define IEEE80211_HT_CAP_TX_STBC 0x0080 /* IEEE80211_HTCAP_TXSTBC */ -#define IEEE80211_HT_CAP_RX_STBC 0x0100 /* IEEE80211_HTCAP_RXSTBC */ +#define IEEE80211_HT_CAP_RX_STBC 0x0300 /* IEEE80211_HTCAP_RXSTBC */ #define IEEE80211_HT_CAP_RX_STBC_SHIFT 8 /* IEEE80211_HTCAP_RXSTBC_S */ #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 /* IEEE80211_HTCAP_MAXAMSDU */ #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 /* IEEE80211_HTCAP_DSSSCCK40 */ From nobody Fri Jun 7 21:41: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 4VwvlR2wt8z5MKcG; Fri, 07 Jun 2024 21:41: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 4VwvlR2Q9nz4JQl; Fri, 7 Jun 2024 21:41:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717796467; 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=mfYZSEGjpAj0N/lGFp26HO+ExgTa9ComZKIBsw9BIfg=; b=VsUdhYQj93xJjt/qAlm7Agn+Df+PxTVZc6T/IAqYjsXRlCLWo56uljZSKpacFl3BTEkchA ePkyeMHmSRXGd7EZ+XYlODKMkAZncYPzKsI6GZuoZ/WB5H11qisYwuMMSUS8/7WQJnDalN A/Bcf3zbpBGXqWoApayWq0EUsq8kr78lkJbFmKs6k1WQYRTu2lP14OpOZoSWe2z3fmZcb/ z/Bay5mCsFmAmKmbDM3g8p872StXOzgfxMWM6BkMlRn/u2aKUYgkZ+H43VTBla1tBXuhCx /UxWNBiJkfDdwAE8hBwN6YFStQnd5jVzHs1OnTPTfkuin99xhM5+yHwCX95kcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717796467; a=rsa-sha256; cv=none; b=QwGPVSMyiKMBVamGuzu/cOl50olUAuD/ZvTQJaMZDXLUXnWQO8UZoAYNQzQGg3XetAgz0l BC3zdlUNOU7zbZH37EBYehDJzCsPiNzFTXC/dWVubvYn9zeDshmVUNtNsfb+tsUvsF2JYW BqMa1s6lcbnGBThH8Itv7v64WKfqldevmHFV+jUvfCsU4oJ0eVf2xN5UVAny+QFj7hbmaA 8FpOOuMhpCBbqMuIW7Nysx16PtJ8EIYdE4/iwrlXjAVrkD5SMlp3JsZ1iSb/gQ6qHD6B+0 ghWVptiBVAIeoG6H8X0b9zCenW6yADVuDRQ3DBRx/NthVddQZfRNZO9AYvboWg== 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=1717796467; 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=mfYZSEGjpAj0N/lGFp26HO+ExgTa9ComZKIBsw9BIfg=; b=Jt8vvHaSvR47fm0hbv+61ZmAB5aXIVGcghBebBP6hgl/bg1Sx6OdBVezpFFWACNTuKu2qA tcdBO0WEUnw8bGzHzxcOTriWn91yVMQNGKqhbWy7Kgfwr5V8gr/+MayEXt4TKKxxzUpAYv 2Vc0RKu82SWpqQTy8WQWd68H3BIz5NCAEj5Iu6HWpd+O0Obf6JBZIz5HTNvDStoiKIQWiR MpTOyG1hykeLZ6qbLBwJbAUIQOztMpp7M9XJEeIvDV0qEEBMlLZGkVlap4rG2w1R/6Sdeg mUbHpiPwY9H++5iEBmW+oJLpuL93T2/u0cX+6CcyhadbyI0vyohe9NMBBy+8yQ== 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 4VwvlR1x8gzWvW; Fri, 7 Jun 2024 21:41: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 457Lf7Xi077414; Fri, 7 Jun 2024 21:41:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457Lf7Vt077411; Fri, 7 Jun 2024 21:41:07 GMT (envelope-from git) Date: Fri, 7 Jun 2024 21:41:07 GMT Message-Id: <202406072141.457Lf7Vt077411@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 105b9df26ee0 - main - LinuxKPI: 802.11: close race lkpi_sta_scan_to_auth()/(*iv_update_bss)() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 105b9df26ee0286f3a5a7d191075e068dee1c4a2 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=105b9df26ee0286f3a5a7d191075e068dee1c4a2 commit 105b9df26ee0286f3a5a7d191075e068dee1c4a2 Author: Bjoern A. Zeeb AuthorDate: 2024-02-18 20:57:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-07 21:40:32 +0000 LinuxKPI: 802.11: close race lkpi_sta_scan_to_auth()/(*iv_update_bss)() We have to unlock the net80211 ic lock in order to be able to call sleepable downcalls to the driver/firmware; a 2nd thread may go through net80211::join1() and (*iv_update_bss)() after we checked and unlocked. Re-check status at the end of the function under the ic lock so that we do not accidentally set lvif_bss_synched to true again despite it no longer being true. This should fix a race where we lost the (*iv_update_bss)() state during startup where one SCAN->AUTH is followed by a (then) AUTH->AUTH and lkpi_sta_a_to_a() did the wrong thing. Once we re-consider net80211 state and allowing a second join on a different node or iv_bss update without previously tearing down the older node we can likely undo a lot of these extra checks and workarounds. Sponsored by: The FreeBSD Foundation (updated version) Tested by: emaste (on and off) MFC after: 3 days Reviewd by: cc Differential Revision: https://reviews.freebsd.org/D43967 --- sys/compat/linuxkpi/common/src/linux_80211.c | 66 +++++++++++++++++++--------- 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index cd1897a08ccd..bf2050deed0d 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -1275,25 +1275,6 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int lsta = ni->ni_drv_data; LKPI_80211_LVIF_LOCK(lvif); - /* Re-check given (*iv_update_bss) could have happened. */ - /* XXX-BZ KASSERT later? or deal as error? */ - if (lvif->lvif_bss_synched || lvif->lvif_bss != NULL) - ic_printf(vap->iv_ic, "%s:%d: lvif %p vap %p iv_bss %p lvif_bss %p " - "lvif_bss->ni %p synched %d, ni %p lsta %p\n", __func__, __LINE__, - lvif, vap, vap->iv_bss, lvif->lvif_bss, - (lvif->lvif_bss != NULL) ? lvif->lvif_bss->ni : NULL, - lvif->lvif_bss_synched, ni, lsta); - - /* - * Reference the ni for this cache of lsta/ni on lvif->lvif_bss - * essentially out lsta version of the iv_bss. - * Do NOT use iv_bss here anymore as that may have diverged from our - * function local ni already and would lead to inconsistencies. - */ - ieee80211_ref_node(ni); - lvif->lvif_bss = lsta; - lvif->lvif_bss_synched = true; - /* Insert the [l]sta into the list of known stations. */ TAILQ_INSERT_TAIL(&lvif->lsta_head, lsta, lsta_entry); LKPI_80211_LVIF_UNLOCK(lvif); @@ -1342,11 +1323,56 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int * (ideally we'd do that on a callback for something else ...) */ + LKPI_80211_LHW_UNLOCK(lhw); + IEEE80211_LOCK(vap->iv_ic); + + LKPI_80211_LVIF_LOCK(lvif); + /* Re-check given (*iv_update_bss) could have happened while we were unlocked. */ + if (lvif->lvif_bss_synched || lvif->lvif_bss != NULL || + lsta->ni != vap->iv_bss) + ic_printf(vap->iv_ic, "%s:%d: lvif %p vap %p iv_bss %p lvif_bss %p " + "lvif_bss->ni %p synched %d, ni %p lsta %p\n", __func__, __LINE__, + lvif, vap, vap->iv_bss, lvif->lvif_bss, + (lvif->lvif_bss != NULL) ? lvif->lvif_bss->ni : NULL, + lvif->lvif_bss_synched, ni, lsta); + + /* + * Reference the "ni" for caching the lsta/ni in lvif->lvif_bss. + * Given we cache lsta we use lsta->ni instead of ni here (even though + * lsta->ni == ni) to be distinct from the rest of the code where we do + * assume that ni == vap->iv_bss which it may or may not be. + * So do NOT use iv_bss here anymore as that may have diverged from our + * function local ni already while ic was unlocked and would lead to + * inconsistencies. Go and see if we lost a race and do not update + * lvif_bss_synched in that case. + */ + ieee80211_ref_node(lsta->ni); + lvif->lvif_bss = lsta; + if (lsta->ni == vap->iv_bss) { + lvif->lvif_bss_synched = true; + } else { + /* Set to un-synched no matter what. */ + lvif->lvif_bss_synched = false; + /* + * We do not error as someone has to take us down. + * If we are followed by a 2nd, new net80211::join1() going to + * AUTH lkpi_sta_a_to_a() will error, lkpi_sta_auth_to_{scan,init}() + * will take the lvif->lvif_bss node down eventually. + * What happens with the vap->iv_bss node will entirely be up + * to net80211 as we never used the node beyond alloc()/free() + * and we do not hold an extra reference for that anymore given + * ni : lsta == 1:1. + */ + } + LKPI_80211_LVIF_UNLOCK(lvif); + goto out_relocked; + out: LKPI_80211_LHW_UNLOCK(lhw); IEEE80211_LOCK(vap->iv_ic); +out_relocked: /* - * Release the reference that keop the ni stable locally + * Release the reference that kept the ni stable locally * during the work of this function. */ if (ni != NULL) From nobody Fri Jun 7 21:52: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 4Vww0P1sTQz5MMcb; Fri, 07 Jun 2024 21:52: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 4Vww0P1KzBz4LTp; Fri, 7 Jun 2024 21:52:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717797141; 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=lxGGyxCeYTSfsUOGfAOBuN8wm+YkXRQ3o7v9At3ZmGs=; b=DrRvr7Uig7DQsRJ8AKa+CDR+cFoAFufUXBTuZw7D7c0FVm0hYqAqLMToslGGoYcPjxSyzC l/o6jxV6tYO+ByaGncpj9YXRZ1kKCo0ON7888kV2tpAJroRfut7w/VtWv5qg7C8AJWrR4y d6lZvFIA2rAq42iSgzNDD2A1N8zq5LKM9OMej30GM1rqOwTFzyOoUf0YBJF1eM5ygGk+td ImMNLNX4kUKlA1DUeZv5Pj+wf5yiVOhD6uQJTT3A+x7jxSqDPcVmDtRgOgGJpzbUhqYFsT 1C4JPosuvqe5Q8uJ+6oLXjNadBACtryAY4gnS3JKdCdp5kRAHZffcxq2F1H2bA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717797141; a=rsa-sha256; cv=none; b=iJHWMOhkw2sB7RCdgND3tPBKGnWpp5Kcl2u4u/lgKTBI1aC3zthQxOvXWyAVPYp2fqTmB6 E6PuyoJoLo+8LTzeqev9jvv5aE3fLuZXcFHmELJK2yLUG2Qd4nBzPXYFJ8atMqgMPNoxbY B6TwUdxnfS2Ei0XQ1c6fsorCc3hZ8B76TnAPouJk+q0kSj6CA4INNmikIOwp1hZnhsEZD7 LTNmXLFl6bYR9JtHNX5OMjSQ5k01Hf+/ymYPsYOrghuYLVZh56A1t8RX3kNlzhnAOIdutH TPAQ3iE5Cx/xByzlARebieZb8oZiwVVzcnlZs0VRalkLCFIMn+WpOuJglLvTTQ== 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=1717797141; 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=lxGGyxCeYTSfsUOGfAOBuN8wm+YkXRQ3o7v9At3ZmGs=; b=BZ7rYJ40PxwE3i2PcRf1ogHkE4fDu2zSGpj3JrfX//rk5vavj3M4mnUDjZzlI8IfnTtf/n 53G94MAkWCkb4JSAVtZKtJ/YNFcJb3pqtbvL/4whpqlR/B00Y3h5XPPICmDZUKZHbmMXzp lUhc0ScSZARctc3ji7hfGSzgFQNv4SvqNtctnMcdEU7GPUATV2JSXGnDE0ygBFbgp0ZeeH vkHidAD3eaCal9mDppKcLKVqFUTbJjBDZU72KPgWSuuohckkXn9N0kBWL62KJs3mQ1683k FXgPkqv8+vMeA7Fa7ZDgOJoUdUwGn53SjgTeTJMwmsTi5jkGrkKkpdZSkxB1Lw== 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 4Vww0P0wqtzXFZ; Fri, 7 Jun 2024 21:52: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 457LqLgY095930; Fri, 7 Jun 2024 21:52:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457LqLQ8095927; Fri, 7 Jun 2024 21:52:21 GMT (envelope-from git) Date: Fri, 7 Jun 2024 21:52:21 GMT Message-Id: <202406072152.457LqLQ8095927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 886653492945 - main - LinuxKPI: 802.11: make sure we can send DISASSOC or DEAUTH frames List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 886653492945f7e945eb9bdaf5bc2ae26df96236 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=886653492945f7e945eb9bdaf5bc2ae26df96236 commit 886653492945f7e945eb9bdaf5bc2ae26df96236 Author: Bjoern A. Zeeb AuthorDate: 2024-06-05 22:54:36 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-07 21:47:42 +0000 LinuxKPI: 802.11: make sure we can send DISASSOC or DEAUTH frames The "Invalid TXQ" error from iwlwifi seems to be triggered by a frame being sent for a sta which is no longer known to the driver/fw. While we make sure to trigger the sending of the frame in net80211 early enough (by calling (*iv_newstate)() early on rather than at the end), TX in LinuxKPI is run in a deferred task. When we drop the net80211 ic lock again and re-acquire the LHW lock the packet may not yet have made it to the driver. Work around this between the (ic and lhw) locks by making sure (a) no new packets get queued after we return from (*iv_newstate)(), and (b) the TX task has run or gets cancelled and we manually push any remaining packets out (or let lsta_free() clean them up). The disabled packet queuing now also needs to be re-enabled in scan_to_auth() in case an lsta is staying in service or gets re-used. Also make sure that any following lkpi_wake_tx_queues() calls no longer ignore queues which have not seen a prior dequeue. This former workaround "feature" (ltxq->seen_dequeue) should be fully garbage collected in a later change on its own. Sponsored by: The FreeBSD Foundation MFC after: 3 days PR: 274382 Tested by: emaste, lwhsu, thj, rkoberman at gmail.com Accepted by: adrian Differential Revision: https://reviews.freebsd.org/D45508 --- sys/compat/linuxkpi/common/src/linux_80211.c | 95 +++++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 9 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index bf2050deed0d..0578d1c05403 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -145,6 +145,7 @@ const struct cfg80211_ops linuxkpi_mac80211cfgops = { static struct lkpi_sta *lkpi_find_lsta_by_ni(struct lkpi_vif *, struct ieee80211_node *); #endif +static void lkpi_80211_txq_tx_one(struct lkpi_sta *, struct mbuf *); static void lkpi_80211_txq_task(void *, int); static void lkpi_80211_lhw_rxq_task(void *, int); static void lkpi_ieee80211_free_skb_mbuf(void *); @@ -1061,6 +1062,51 @@ lkpi_wake_tx_queues(struct ieee80211_hw *hw, struct ieee80211_sta *sta, } } +/* + * On the way down from RUN -> ASSOC -> AUTH we may send a DISASSOC or DEAUTH + * packet. The problem is that the state machine functions tend to hold the + * LHW lock which will prevent lkpi_80211_txq_tx_one() from sending the packet. + * We call this after dropping the ic lock and before acquiring the LHW lock. + * we make sure no further packets are queued and if they are queued the task + * will finish or be cancelled. At the end if a packet is left we manually + * send it. scan_to_auth() would re-enable sending if the lsta would be + * re-used. + */ +static void +lkpi_80211_flush_tx(struct lkpi_hw *lhw, struct lkpi_sta *lsta) +{ + struct mbufq mq; + struct mbuf *m; + int len; + + LKPI_80211_LHW_UNLOCK_ASSERT(lhw); + + /* Do not accept any new packets until scan_to_auth or lsta_free(). */ + LKPI_80211_LSTA_TXQ_LOCK(lsta); + lsta->txq_ready = false; + LKPI_80211_LSTA_TXQ_UNLOCK(lsta); + + while (taskqueue_cancel(taskqueue_thread, &lsta->txq_task, NULL) != 0) + taskqueue_drain(taskqueue_thread, &lsta->txq_task); + + LKPI_80211_LSTA_TXQ_LOCK(lsta); + len = mbufq_len(&lsta->txq); + if (len <= 0) { + LKPI_80211_LSTA_TXQ_UNLOCK(lsta); + return; + } + + mbufq_init(&mq, IFQ_MAXLEN); + mbufq_concat(&mq, &lsta->txq); + LKPI_80211_LSTA_TXQ_UNLOCK(lsta); + + m = mbufq_dequeue(&mq); + while (m != NULL) { + lkpi_80211_txq_tx_one(lsta, m); + m = mbufq_dequeue(&mq); + } +} + /* -------------------------------------------------------------------------- */ static int @@ -1274,6 +1320,14 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int __func__, ni, ni->ni_drv_data)); lsta = ni->ni_drv_data; + /* + * Make sure in case the sta did not change and we re-add it, + * that we can tx again. + */ + LKPI_80211_LSTA_TXQ_LOCK(lsta); + lsta->txq_ready = true; + LKPI_80211_LSTA_TXQ_UNLOCK(lsta); + LKPI_80211_LVIF_LOCK(lvif); /* Insert the [l]sta into the list of known stations. */ TAILQ_INSERT_TAIL(&lvif->lsta_head, lsta, lsta_entry); @@ -1426,7 +1480,7 @@ lkpi_sta_auth_to_scan(struct ieee80211vap *vap, enum ieee80211_state nstate, int lkpi_80211_mo_flush(hw, vif, nitems(sta->txq), true); /* Wake tx queues to get packet(s) out. */ - lkpi_wake_tx_queues(hw, sta, true, true); + lkpi_wake_tx_queues(hw, sta, false, true); /* flush, no drop */ lkpi_80211_mo_flush(hw, vif, nitems(sta->txq), false); @@ -1584,7 +1638,7 @@ lkpi_sta_auth_to_assoc(struct ieee80211vap *vap, enum ieee80211_state nstate, in } /* Wake tx queue to get packet out. */ - lkpi_wake_tx_queues(hw, LSTA_TO_STA(lsta), true, true); + lkpi_wake_tx_queues(hw, LSTA_TO_STA(lsta), false, true); /* * .. we end up in "assoc_to_run" @@ -1728,7 +1782,7 @@ _lkpi_sta_assoc_to_down(struct ieee80211vap *vap, enum ieee80211_state nstate, i LKPI_80211_LHW_UNLOCK(lhw); IEEE80211_LOCK(vap->iv_ic); - /* Call iv_newstate first so we get potential DISASSOC packet out. */ + /* Call iv_newstate first so we get potential DEAUTH packet out. */ error = lvif->iv_newstate(vap, nstate, arg); if (error != 0) { ic_printf(vap->iv_ic, "%s:%d: iv_newstate(%p, %d, %d) " @@ -1737,12 +1791,16 @@ _lkpi_sta_assoc_to_down(struct ieee80211vap *vap, enum ieee80211_state nstate, i } IEEE80211_UNLOCK(vap->iv_ic); + + /* Ensure the packets get out. */ + lkpi_80211_flush_tx(lhw, lsta); + LKPI_80211_LHW_LOCK(lhw); lkpi_lsta_dump(lsta, ni, __func__, __LINE__); /* Wake tx queues to get packet(s) out. */ - lkpi_wake_tx_queues(hw, sta, true, true); + lkpi_wake_tx_queues(hw, sta, false, true); /* flush, no drop */ lkpi_80211_mo_flush(hw, vif, nitems(sta->txq), false); @@ -2120,12 +2178,16 @@ lkpi_sta_run_to_assoc(struct ieee80211vap *vap, enum ieee80211_state nstate, int } IEEE80211_UNLOCK(vap->iv_ic); + + /* Ensure the packets get out. */ + lkpi_80211_flush_tx(lhw, lsta); + LKPI_80211_LHW_LOCK(lhw); lkpi_lsta_dump(lsta, ni, __func__, __LINE__); /* Wake tx queues to get packet(s) out. */ - lkpi_wake_tx_queues(hw, sta, true, true); + lkpi_wake_tx_queues(hw, sta, false, true); /* flush, no drop */ lkpi_80211_mo_flush(hw, vif, nitems(sta->txq), false); @@ -2254,12 +2316,16 @@ lkpi_sta_run_to_init(struct ieee80211vap *vap, enum ieee80211_state nstate, int } IEEE80211_UNLOCK(vap->iv_ic); + + /* Ensure the packets get out. */ + lkpi_80211_flush_tx(lhw, lsta); + LKPI_80211_LHW_LOCK(lhw); lkpi_lsta_dump(lsta, ni, __func__, __LINE__); /* Wake tx queues to get packet(s) out. */ - lkpi_wake_tx_queues(hw, sta, true, true); + lkpi_wake_tx_queues(hw, sta, false, true); /* flush, no drop */ lkpi_80211_mo_flush(hw, vif, nitems(sta->txq), false); @@ -3595,7 +3661,7 @@ lkpi_ic_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, lsta = ni->ni_drv_data; LKPI_80211_LSTA_TXQ_LOCK(lsta); - if (!lsta->txq_ready) { + if (!lsta->added_to_drv || !lsta->txq_ready) { LKPI_80211_LSTA_TXQ_UNLOCK(lsta); /* * Free the mbuf (do NOT release ni ref for the m_pkthdr.rcvif! @@ -3821,6 +3887,7 @@ lkpi_80211_txq_task(void *ctx, int pending) struct lkpi_sta *lsta; struct mbufq mq; struct mbuf *m; + bool shall_tx; lsta = ctx; @@ -3836,9 +3903,19 @@ lkpi_80211_txq_task(void *ctx, int pending) LKPI_80211_LSTA_TXQ_LOCK(lsta); /* * Do not re-check lsta->txq_ready here; we may have a pending - * disassoc frame still. + * disassoc/deauth frame still. On the contrary if txq_ready is + * false we do not have a valid sta anymore in the firmware so no + * point to try to TX. + * We also use txq_ready as a semaphore and will drain the txq manually + * if needed on our way towards SCAN/INIT in the state machine. + */ + shall_tx = lsta->added_to_drv && lsta->txq_ready; + if (__predict_true(shall_tx)) + mbufq_concat(&mq, &lsta->txq); + /* + * else a state change will push the packets out manually or + * lkpi_lsta_free() will drain the lsta->txq and free the mbufs. */ - mbufq_concat(&mq, &lsta->txq); LKPI_80211_LSTA_TXQ_UNLOCK(lsta); m = mbufq_dequeue(&mq); From nobody Fri Jun 7 23:48: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 4VwyZy31dZz5N2p0; Fri, 07 Jun 2024 23:48: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 4VwyZy2Fl0z4Xcd; Fri, 7 Jun 2024 23:48:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717804138; 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=OXDxOIpIPQyNssRS5/ZtBZnVoY5mhy4PDaphk+YZ2Ks=; b=BCqFEif/HbhN9xTPi2MLG2LBImfr744y8PtGwvnTJiUr1njrWVmaXq130v+G1wy3yMSDen qxjmGfnVmaA92vu+acc6Ko+Vy1K0Wk4/tpRoSlbeWbWL0RCS4kkKyeirDi8iN8bmY8OHN1 QEWX4w1bVmO0ezWins+asA2QJjI0HioQAkNFIl7mc5hP5lpGSrHCxdDp+OkjESh4pg0Y9s 7ztp3dmyWCmR8ciaPzeyspVvIL8sw1jcRR/zfn2ffVHDXKmpL3XqidSpN3r2l8/1b/j9cI 14qgZjNqyM30WMhtIRPxQQJ4XbLzap4xlSF8RU9AoYKlVr4dS1MW00K01L85BQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717804138; a=rsa-sha256; cv=none; b=ZhjpjYpDah/CaLuJK2Je9HrQnX83AQ9+WS9GGfrLmP6ak6jU+dyfH4yQ8cBeDwihowK1hc ltDXdxbZvso7nW9Mp3XycwVD1OE3nKd/ka82u6Obq2p6aMXI2/9r1Ih9zD8mWy0TtKNhVR 2IuvQMPsdXnFN/ZH2wpCNKwd2sufaW3zzhkMTqk8oRF1Kfzit5AK7aPeiB/ZyahQGh2Ekd p+0OVhx09NPkIh6w0sJLL8MgqRuub3dqs+q0rraO8UD6rWp95pWh+s6jV7b0yfzH9+k0vT HBvAZBnfVM0d6sbGSRda3VTlF9rFv0EhGSXKlJtCkGImkVG5gamILHDMq3f+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=1717804138; 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=OXDxOIpIPQyNssRS5/ZtBZnVoY5mhy4PDaphk+YZ2Ks=; b=MpcMmbrpXXERVYD7yuBvLOCqC7XGWZtP3J5/CaHFAdGkp7+2ibXByNx/01yp8lP21PvgWB c7MqWLnFCZZpmaASuXjQtabrkMu1zPaB60SJ0PsuTbtIGcmFrBkTAbSeFKlnBZk8vlGa7y n/ncDh+uDi7xrw8dHqwHg4xQT8f0/93sN6qhlUeW8r/K5Q0QveDAQSkP/XlzJn5hkgfgdh 53fiAFbA1D1kuPwS9ozlwFRr4SHpr3IXxZkU0gxHFO8zRBCQYH+vIgA/g+qwWBv9yu9ddd QBk+PY4xgJkZCJGaKa9BDB3PliFSm/qzPu8crzP3e230MPsE3zMyGDBl0AsWdA== 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 4VwyZy1kzSzZvq; Fri, 7 Jun 2024 23:48: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 457Nmw7H084079; Fri, 7 Jun 2024 23:48:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 457Nmw8u084076; Fri, 7 Jun 2024 23:48:58 GMT (envelope-from git) Date: Fri, 7 Jun 2024 23:48:58 GMT Message-Id: <202406072348.457Nmw8u084076@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3753988c5d22 - main - LinuxKPI: pm: add SET_SYSTEM_SLEEP_PM_OPS() and device_can_wakeup() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 3753988c5d22393fbdefb6aa16b5a5a699d05642 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3753988c5d22393fbdefb6aa16b5a5a699d05642 commit 3753988c5d22393fbdefb6aa16b5a5a699d05642 Author: Bjoern A. Zeeb AuthorDate: 2024-04-06 21:15:16 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-07 22:57:04 +0000 LinuxKPI: pm: add SET_SYSTEM_SLEEP_PM_OPS() and device_can_wakeup() Add the SET_SYSTEM_SLEEP_PM_OPS() by factoring some other macro code out in order to set the suspend/resume functions when the struct is already given. Such is the case in iwlwifi d3. Also add an initial implementation of device_can_wakeup(). Though this is likely all we need we have no way of setting the flag for it yet so leave a pr_debug() and a comment there as well. Until we want to support WoWLAN this is likely not needed for wireless. Doing it the proper way checking a bool in 'struct dev_pm_info' would change 'struct device' and with that 'struct pci_dev' and break the KBI. In favour of mergeability this version does not implement the full functionality yet. Both help to make an updated iwlwifi d3 compile. Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45358 --- sys/compat/linuxkpi/common/include/linux/pm.h | 30 +++++++++++++++------------ sys/compat/linuxkpi/common/src/linux_compat.c | 18 ++++++++++++++++ 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h index 871c7b587864..c8d943027909 100644 --- a/sys/compat/linuxkpi/common/include/linux/pm.h +++ b/sys/compat/linuxkpi/common/include/linux/pm.h @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (c) 2020 The FreeBSD Foundation + * Copyright (c) 2020-2024 The FreeBSD Foundation * * This software was developed by Björn Zeeb under sponsorship from * the FreeBSD Foundation. @@ -58,25 +58,26 @@ struct dev_pm_info { IS_ENABLED(CONFIG_PM_SLEEP) ? (_p) : NULL #ifdef CONFIG_PM_SLEEP +#define __SET_PM_OPS(_suspendfunc, _resumefunc) \ + .suspend = _suspendfunc, \ + .resume = _resumefunc, \ + .freeze = _suspendfunc, \ + .thaw = _resumefunc, \ + .poweroff = _suspendfunc, \ + .restore = _resumefunc, \ + #define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ const struct dev_pm_ops _name = { \ - .suspend = _suspendfunc, \ - .resume = _resumefunc, \ - .freeze = _suspendfunc, \ - .thaw = _resumefunc, \ - .poweroff = _suspendfunc, \ - .restore = _resumefunc, \ + __SET_PM_OPS(_suspendfunc, _resumefunc) \ } #define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ const struct dev_pm_ops _name = { \ - .suspend = _suspendfunc, \ - .resume = _resumefunc, \ - .freeze = _suspendfunc, \ - .thaw = _resumefunc, \ - .poweroff = _suspendfunc, \ - .restore = _resumefunc, \ + __SET_PM_OPS(_suspendfunc, _resumefunc) \ } + +#define SET_SYSTEM_SLEEP_PM_OPS(_suspendfunc, _resumefunc) \ + __SET_PM_OPS(_suspendfunc, _resumefunc) #else #define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ const struct dev_pm_ops _name = { \ @@ -86,6 +87,9 @@ const struct dev_pm_ops _name = { \ } #endif +bool linuxkpi_device_can_wakeup(struct device *); +#define device_can_wakeup(_dev) linuxkpi_device_can_wakeup(_dev) + static inline void pm_wakeup_event(struct device *dev __unused, unsigned int x __unused) { diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 4c639c1f8459..90d03d480089 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2597,6 +2597,24 @@ io_mapping_create_wc(resource_size_t base, unsigned long size) return (io_mapping_init_wc(mapping, base, size)); } +/* We likely want a linuxkpi_device.c at some point. */ +bool +device_can_wakeup(struct device *dev) +{ + + if (dev == NULL) + return (false); + /* + * XXX-BZ iwlwifi queries it as part of enabling WoWLAN. + * Normally this would be based on a bool in dev->power.XXX. + * Check such as PCI PCIM_PCAP_*PME. We have no way to enable this yet. + * We may get away by directly calling into bsddev for as long as + * we can assume PCI only avoiding changing struct device breaking KBI. + */ + pr_debug("%s:%d: not enabled; see comment.\n", __func__, __LINE__); + return (false); +} + #if defined(__i386__) || defined(__amd64__) bool linux_cpu_has_clflush; struct cpuinfo_x86 boot_cpu_data; From nobody Sat Jun 8 00:46: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 4Vwzsk0nVpz5N7SB; Sat, 08 Jun 2024 00:46:50 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE Root Certificate Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vwzsj4dD4z4cQT; Sat, 8 Jun 2024 00:46:49 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Authentication-Results: mx1.freebsd.org; none Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 3DCB38D4A127; Sat, 8 Jun 2024 00:46:41 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (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) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 4ACF52D029D9; Sat, 8 Jun 2024 00:46:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id XyVDrQD-8m_l; Sat, 8 Jun 2024 00:46:36 +0000 (UTC) Received: from strong-iwl0.sbone.de (strong-iwl0.sbone.de [IPv6:fde9:577b:c1a9:4902:b66b:fcff:fef3:e3d2]) (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) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 4B5CD2D029D2; Sat, 8 Jun 2024 00:46:36 +0000 (UTC) Date: Sat, 8 Jun 2024 00:46:35 +0000 (UTC) From: "Bjoern A. Zeeb" To: Wei Hu cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 2b887687edc2 - main - Hyper-V: TLB flush enlightment using hypercall In-Reply-To: <202406070801.45781Haa090505@gitrepo.freebsd.org> Message-ID: <4n623n50-q584-1068-02p2-334p745rp6or@yvfgf.mnoonqbm.arg> References: <202406070801.45781Haa090505@gitrepo.freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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; format=flowed 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:24940, ipnet:195.201.0.0/16, country:DE] X-Rspamd-Queue-Id: 4Vwzsj4dD4z4cQT On Fri, 7 Jun 2024, Wei Hu wrote: > The branch main has been updated by whu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2b887687edc25bb4553f0d8a1183f454a85d413d > > commit 2b887687edc25bb4553f0d8a1183f454a85d413d > Author: Souradeep Chakrabarti > AuthorDate: 2024-06-07 07:56:07 +0000 > Commit: Wei Hu > CommitDate: 2024-06-07 07:56:07 +0000 > > Hyper-V: TLB flush enlightment using hypercall This seems to have added a warning: /usr/src/bz_wifi_11n/sys/dev/hyperv/vmbus/vmbus.c:143:13: warning: unused function 'alloc_pcpu_ptr' [-Wunused-function] 143 | static void alloc_pcpu_ptr(void); | ^~~~~~~~~~~~~~ 1 warning generated. /usr/src/bz_wifi_11n/sys/dev/hyperv/vmbus/vmbus.c:143:13: warning: unused function 'alloc_pcpu_ptr' [-Wunused-function] 143 | static void alloc_pcpu_ptr(void); | ^~~~~~~~~~~~~~ -- Bjoern A. Zeeb r15:7 From nobody Sat Jun 8 00:56: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 4Vx0512H23z5N82X; Sat, 08 Jun 2024 00:56: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 4Vx0510Yhfz4d56; Sat, 8 Jun 2024 00:56:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717808197; 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=77G9syJlg8bfQ0sp1cvAYUQ++YjRm1H28Pwq7DufMp0=; b=muaBegRcv0Nps0rGdTba2Gb/82nBm5+X76vVkPj3WlyCkaZy5cs6DQ/CtN9DP92VW358hf VVEymMe1HbFuuQKlPcRpOOSJvNchvl4C/KtIVR6tdmkIG8c1x2CzLkHsXaZGoX8l6gzUJO i+/F+lyZ6xdt/iQsULc9BKElrTK71brvvc62KC2AfMI5/EQ0RxV+fe0W8AT7NVjWqEebBH B6Z9pG4KYxz2vd71C6bnJXA/eHH36B6InsbaCOLr467rzc7SYPLbn9q+sZdaQy0XXhX54w 5n5aGZeO50A1B9Nkdu5lkvQG5Mha5TA0ACEpXgkgriwIWCM+RWUQFIbDJFY5tQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717808197; a=rsa-sha256; cv=none; b=KHIMflZeF/k7KesYyFFj8dIiWDxW87MgC4lvSikulNKCzAdkOM02KMKDig6ViAZBoBQAyo tjn/ioDEZmf/0ggdeVMd8dg4iVuX3+7ICmQGBf2QHTjgToxQVFVnNl+AhhttxXk1uVl1z8 eMR4tZfs27zr5YuJY21IS1iggj7uHYEFyfmqRTQxhYJN4x7eAmrWBnfI7zo0Z9xYrHTNVZ xZB7Tw71A8GsfPIMNqzJ+g1kNsxmcb6ctL3eI5iX+z8iD7XlKUDRdrpfiBUQy5svFWG1AP BJII3z8SV7AuVb54GEGBLt5Hgw3jabiaQdcXh4lkXMaZ5XKpWlRRAt/38LZyRA== 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=1717808197; 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=77G9syJlg8bfQ0sp1cvAYUQ++YjRm1H28Pwq7DufMp0=; b=MeIuOp/o7LYN362bM1Hzan3/CEIVUsXpsqp9qZB0XevQNri/s6+kE3QMV8esfz5nkhIiRD SKgrQMfjfGKlwBVFYl8kQsQ4HF1gOxHQDBpV0YbMODVOYt9Rzo8rTeORRX4KJsv9x5Opmv KfTTxfeOAQJRr6Jz5yrV+tgDQ+EzuFq79KumfgQM8x3wIttWfyLbSMSp8k/xts6q1vqtdY a4/DHHXolggAsZ8OonDG6ssWrSUQSiksTUoeUNeM3wYh/iAdavP4Ho9gjmrIf+CskX5Ttr ajkpMt0qZ5ZCMw0i7o6M+bwKNF68O+il6Pjg+Vs+HHlph5gJnbUpgPHh5Y8uLg== 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 4Vx0506wQJzd6N; Sat, 8 Jun 2024 00:56: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 4580uafo001327; Sat, 8 Jun 2024 00:56:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4580uaH3001324; Sat, 8 Jun 2024 00:56:36 GMT (envelope-from git) Date: Sat, 8 Jun 2024 00:56:36 GMT Message-Id: <202406080056.4580uaH3001324@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 63a327b954a3 - main - LinuxKPI: 802.11: use net80211 IEEE80211_HTCAP_* definitions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 63a327b954a38ecd46934a2911321f3ea3d500b3 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=63a327b954a38ecd46934a2911321f3ea3d500b3 commit 63a327b954a38ecd46934a2911321f3ea3d500b3 Author: Bjoern A. Zeeb AuthorDate: 2024-06-07 23:57:04 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-06-07 23:57:04 +0000 LinuxKPI: 802.11: use net80211 IEEE80211_HTCAP_* definitions Rather than using the values and leaving net80211 names in a comment define the LinuxKPI IEEE80211_HT_CAP_* to the net80211 IEEE80211_HTCAP_* names. That way errors like the one fixed in 3e0915b7b685 are less likely to happen. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- .../linuxkpi/common/include/linux/ieee80211.h | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/ieee80211.h b/sys/compat/linuxkpi/common/include/linux/ieee80211.h index 0fd90e921c77..aa1a0a4f3c5f 100644 --- a/sys/compat/linuxkpi/common/include/linux/ieee80211.h +++ b/sys/compat/linuxkpi/common/include/linux/ieee80211.h @@ -254,20 +254,20 @@ enum ieee80211_ac_numbers { #define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0xf -/* XXX net80211 calls these IEEE80211_HTCAP_* */ -#define IEEE80211_HT_CAP_LDPC_CODING 0x0001 /* IEEE80211_HTCAP_LDPC */ -#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 /* IEEE80211_HTCAP_CHWIDTH40 */ -#define IEEE80211_HT_CAP_SM_PS 0x000c /* IEEE80211_HTCAP_SMPS */ +/* Define the LinuxKPI names directly to the net80211 ones. */ +#define IEEE80211_HT_CAP_LDPC_CODING IEEE80211_HTCAP_LDPC +#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 IEEE80211_HTCAP_CHWIDTH40 +#define IEEE80211_HT_CAP_SM_PS IEEE80211_HTCAP_SMPS #define IEEE80211_HT_CAP_SM_PS_SHIFT 2 -#define IEEE80211_HT_CAP_GRN_FLD 0x0010 /* IEEE80211_HTCAP_GREENFIELD */ -#define IEEE80211_HT_CAP_SGI_20 0x0020 /* IEEE80211_HTCAP_SHORTGI20 */ -#define IEEE80211_HT_CAP_SGI_40 0x0040 /* IEEE80211_HTCAP_SHORTGI40 */ -#define IEEE80211_HT_CAP_TX_STBC 0x0080 /* IEEE80211_HTCAP_TXSTBC */ -#define IEEE80211_HT_CAP_RX_STBC 0x0300 /* IEEE80211_HTCAP_RXSTBC */ -#define IEEE80211_HT_CAP_RX_STBC_SHIFT 8 /* IEEE80211_HTCAP_RXSTBC_S */ -#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 /* IEEE80211_HTCAP_MAXAMSDU */ -#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 /* IEEE80211_HTCAP_DSSSCCK40 */ -#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 /* IEEE80211_HTCAP_LSIGTXOPPROT */ +#define IEEE80211_HT_CAP_GRN_FLD IEEE80211_HTCAP_GREENFIELD +#define IEEE80211_HT_CAP_SGI_20 IEEE80211_HTCAP_SHORTGI20 +#define IEEE80211_HT_CAP_SGI_40 IEEE80211_HTCAP_SHORTGI40 +#define IEEE80211_HT_CAP_TX_STBC IEEE80211_HTCAP_TXSTBC +#define IEEE80211_HT_CAP_RX_STBC IEEE80211_HTCAP_RXSTBC +#define IEEE80211_HT_CAP_RX_STBC_SHIFT IEEE80211_HTCAP_RXSTBC_S +#define IEEE80211_HT_CAP_MAX_AMSDU IEEE80211_HTCAP_MAXAMSDU +#define IEEE80211_HT_CAP_DSSSCCK40 IEEE80211_HTCAP_DSSSCCK40 +#define IEEE80211_HT_CAP_LSIG_TXOP_PROT IEEE80211_HTCAP_LSIGTXOPPROT #define IEEE80211_HT_MCS_TX_DEFINED 0x0001 #define IEEE80211_HT_MCS_TX_RX_DIFF 0x0002 From nobody Sat Jun 8 02:47: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 4Vx2Xq2Kdlz5N62r; Sat, 08 Jun 2024 02:47: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 4Vx2Xq1l6Cz4vwH; Sat, 8 Jun 2024 02:47:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717814843; 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=K+wD/EudKCsjqp6dPZOZgoiJ2//91cNecco2kmjBRmI=; b=eII/8w37eGhvrfGOpYWErWlCZbhCCcY6vOVaiBBLmHvPkbx9gFVxVzwEVHXse2nt1g7/MQ OQi57aOaSy0J2YLqO/wR5aArs1rOLOp59aF+WqgggYcXOykudov73mhXQ3rWH2VnSefdiQ 79Y4J6lou2nvFuutNrjH86hlvSrQ5UPFM0BpklePnkiNo49U2UwKxabNGtA51jJYtQpwD0 HIs397JdDrYhySvDC+KZ0RTEnP/5qmaoSApdbJnHeXhwfeFrlIiASvFVF5EhCTOHYO5Qas aVr7zviNy0m9PBSUWKjH9YV4C8h7T33VW1OERMzoL1KNkfk6krBcVxZs5jwgBQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717814843; a=rsa-sha256; cv=none; b=JRKkpzGnFeCW3YrwSvkQaztM5x3hXXcT1PH9GIr7TeN1qFPrJ3Qw7xQgTeUldNEBrPNQxt +ouWgMRYN1t0WCl3zpKa2SkcTGUElReBXMYOHff+HedHNPeJXIri6Dui6FCPr8pFcXnw3f M2NaxdwYi4OlIf3kSiF6fEQEG0c1QnZsroVl+FHQSN/JoNQO5aOI5qaz12cqO1R+D+BfPD ZQkRCpKFKdAoQTBorbcoZio346ku/80qGxvTI+465BZPaLESFQj6Y3R/wmwEUkep47vlfy tTiePATi5u3QO4yhHYuvWd0i7BEWLxgUr6w/4kMdMLi+dmJgDXqfFZxE6+8OeQ== 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=1717814843; 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=K+wD/EudKCsjqp6dPZOZgoiJ2//91cNecco2kmjBRmI=; b=HcbruIQ7KY6T+JE3wUvWrss3mFFU/k1s6qz8HX7sPTKz4rTpbywsp+5J1J/5bK7UOtFTXe ETkt1SXGuYrZJ5dnh++2FXea1QNZeoUZUiWSIBiwS4ngCtMF7F6PRmnrviAjem2K+BCVv5 wmvjctsLLCQMX8BP00GbWh3Q92asfOwLN2XV52gDZ8p/QFsVgilCM2lSBKKdXDlIxuyHT/ VOH7c2hFmBB862W5Eqral8Q/bslssS9xICkzPT5mdaClqifhw0uyGywhPWDZold9u1AD/M jPRrPtJXeFs0ktLrrRp4ioC3lSlQhisCrH4e9Ft4+7W7hf44O9BPMumnELeQ7g== 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 4Vx2Xq0x22zgpb; Sat, 8 Jun 2024 02:47: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 4582lMVM087294; Sat, 8 Jun 2024 02:47:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4582lMGb087291; Sat, 8 Jun 2024 02:47:22 GMT (envelope-from git) Date: Sat, 8 Jun 2024 02:47:22 GMT Message-Id: <202406080247.4582lMGb087291@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ba2a92078626 - main - pf: convert DIOCBEGINADDRS to netlink List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: ba2a920786265f364973562abe9262829cf1901b Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba2a920786265f364973562abe9262829cf1901b commit ba2a920786265f364973562abe9262829cf1901b Author: Kristof Provost AuthorDate: 2024-06-07 20:44:40 +0000 Commit: Kristof Provost CommitDate: 2024-06-08 02:46:43 +0000 pf: convert DIOCBEGINADDRS to netlink --- contrib/pf/ftp-proxy/filter.c | 2 +- contrib/pf/tftp-proxy/filter.c | 2 +- lib/libpfctl/libpfctl.c | 49 ++++++++++++++++++++++++++++++++++++++++++ lib/libpfctl/libpfctl.h | 1 + sbin/pfctl/pfctl.c | 2 +- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf_ioctl.c | 16 ++++++++++---- sys/netpfil/pf/pf_nl.c | 37 +++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_nl.h | 6 ++++++ 9 files changed, 109 insertions(+), 7 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index e3276f88489e..7d6d3f1fa348 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -263,7 +263,7 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, errno = EINVAL; return (-1); } - if (ioctl(pfctl_fd(pfh), DIOCBEGINADDRS, &pfp) == -1) + if (pfctl_begin_addrs(pfh, &pfp.ticket)) return (-1); pfpool_ticket = pfp.ticket; diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index 3cf2e1fcf3ab..8d5dcc21badc 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -272,7 +272,7 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, errno = EINVAL; return (-1); } - if (ioctl(pfctl_fd(pfh), DIOCBEGINADDRS, &pfp) == -1) + if (pfctl_begin_addrs(pfh, &pfp.ticket)) return (-1); pfpool_ticket = pfp.ticket; diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index ebe52e7a415f..b9fba232b8ca 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -2688,3 +2688,52 @@ pfctl_get_limit(struct pfctl_handle *h, const int index, uint *limit) return (e.error); } + +struct pfctl_nl_begin_addrs { + uint32_t ticket; +}; +#define _OUT(_field) offsetof(struct pfctl_nl_begin_addrs, _field) +static struct snl_attr_parser ap_begin_addrs[] = { + { .type = PF_BA_TICKET, .off = _OUT(ticket), .cb = snl_attr_get_uint32 }, +}; +static struct snl_field_parser fp_begin_addrs[] = {}; +#undef _OUT +SNL_DECLARE_PARSER(begin_addrs_parser, struct genlmsghdr, fp_begin_addrs, ap_begin_addrs); + +int +pfctl_begin_addrs(struct pfctl_handle *h, uint32_t *ticket) +{ + struct snl_writer nw; + struct pfctl_nl_begin_addrs attrs = {}; + 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_BEGIN_ADDRS); + hdr->nlmsg_flags |= NLM_F_DUMP; + + 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, &begin_addrs_parser, &attrs)) + continue; + } + + if (ticket != NULL) + *ticket = attrs.ticket; + + return (e.error); +} + diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 44c7fa47e88d..eebc97c52565 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -497,5 +497,6 @@ 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); int pfctl_set_limit(struct pfctl_handle *h, const int index, const uint limit); int pfctl_get_limit(struct pfctl_handle *h, const int index, uint *limit); +int pfctl_begin_addrs(struct pfctl_handle *h, uint32_t *ticket); #endif diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index ec718f6b0a99..450c64785b9c 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1719,7 +1719,7 @@ pfctl_add_pool(struct pfctl *pf, struct pfctl_pool *p, sa_family_t af) struct pf_pooladdr *pa; if ((pf->opts & PF_OPT_NOACTION) == 0) { - if (ioctl(pf->dev, DIOCBEGINADDRS, &pf->paddr)) + if (pfctl_begin_addrs(pf->h, &pf->paddr.ticket)) err(1, "DIOCBEGINADDRS"); } diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index eb36c0aee4d1..d6d01c9b5970 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -2507,6 +2507,7 @@ int pf_ioctl_get_timeout(int, int *); int pf_ioctl_set_timeout(int, int, int *); int pf_ioctl_get_limit(int, unsigned int *); int pf_ioctl_set_limit(int, unsigned int, unsigned int *); +int pf_ioctl_begin_addrs(uint32_t *); 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 af3f914982ec..f801afd9da80 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2517,6 +2517,17 @@ pf_ioctl_get_limit(int index, unsigned int *limit) return (0); } +int +pf_ioctl_begin_addrs(uint32_t *ticket) +{ + PF_RULES_WLOCK(); + pf_empty_kpool(&V_pf_pabuf); + *ticket = ++V_ticket_pabuf; + PF_RULES_WUNLOCK(); + + return (0); +} + static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { @@ -4182,10 +4193,7 @@ DIOCGETSTATESV2_full: case DIOCBEGINADDRS: { struct pfioc_pooladdr *pp = (struct pfioc_pooladdr *)addr; - PF_RULES_WLOCK(); - pf_empty_kpool(&V_pf_pabuf); - pp->ticket = ++V_ticket_pabuf; - PF_RULES_WUNLOCK(); + error = pf_ioctl_begin_addrs(&pp->ticket); break; } diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index 57b1a4a6b5b3..615a9229b3f3 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -1471,6 +1471,36 @@ pf_handle_get_limit(struct nlmsghdr *hdr, struct nl_pstate *npt) return (0); } +static int +pf_handle_begin_addrs(struct nlmsghdr *hdr, struct nl_pstate *npt) +{ + struct nl_writer *nw = npt->nw; + struct genlmsghdr *ghdr_new; + uint32_t ticket; + int error; + + error = pf_ioctl_begin_addrs(&ticket); + 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_BEGIN_ADDRS; + ghdr_new->version = 0; + ghdr_new->reserved = 0; + + nlattr_add_u32(nw, PF_BA_TICKET, ticket); + + if (!nlmsg_end(nw)) { + nlmsg_abort(nw); + return (ENOMEM); + } + + return (0); +} + static const struct nlhdr_parser *all_parsers[] = { &state_parser, &addrule_parser, @@ -1612,6 +1642,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_BEGIN_ADDRS, + .cmd_name = "BEGIN_ADDRS", + .cmd_cb = pf_handle_begin_addrs, + .cmd_flags = GENL_CMD_CAP_DO | 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 437cc6482dbb..d50b5a1e9d43 100644 --- a/sys/netpfil/pf/pf_nl.h +++ b/sys/netpfil/pf/pf_nl.h @@ -54,6 +54,7 @@ enum { PFNL_CMD_GET_TIMEOUT = 16, PFNL_CMD_SET_LIMIT = 17, PFNL_CMD_GET_LIMIT = 18, + PFNL_CMD_BEGIN_ADDRS = 19, __PFNL_CMD_MAX, }; #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1) @@ -350,6 +351,11 @@ enum pf_limit_types_t { PF_LI_LIMIT = 2, /* u32 */ }; +enum pf_begin_addrs_types_t { + PF_BA_UNSPEC, + PF_BA_TICKET = 1, /* u32 */ +}; + #ifdef _KERNEL void pf_nl_register(void); From nobody Sat Jun 8 03:22: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 4Vx3KC03wRz5NB65; Sat, 08 Jun 2024 03:22: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 4Vx3KB3yRgz42hw; Sat, 8 Jun 2024 03:22:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717816942; 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=5xFRyWyL3ZOUI/QvQi5ENAATEZtc231yLTMcgr8HiNI=; b=TaxjzaE81IWBgW0gcvKCdB+NoL2DfPdeYapSPyiPRu/RvsfyN6Z17IU6u3G1vyiqsekkuO 4/q/v3k4wKtXDT0XgHrBHGta4ib/CSwwgZIkly1h4UPdhTvWjOSXOHm+tn2OdEi9QQcyDI UyoeIzDNKjFUuTlF8UtSKU5cR2VDa/+c0jfk7ocwG/fomvwzselab2DgOuQ6ZzFEu2V0Sx Wf6nly91ARFY+vjmjb6hbRUpcKb4vz/wOq7EcdMHEQF7SHXY9YyFH/YbokvVk5zWTxa4R1 j/eLmcK+Fj5EUC3OMwCmx+acU7frhwDGTjSvau0ndpZ5jYnkqQ111ccFa/NxTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717816942; a=rsa-sha256; cv=none; b=ta+FKwcPVz1DIOIc0rceTeEXov2eU8hmqDSxw3jCV11/1Z8djSBzXesxkdf/QP+WY7H4F6 XJbnu/KZAEnnScpM3fBU+uofEumzWMDo8OFVqrpzBKZWlBxNOw1fZJbh7r12+/qPq7vZoX t6UCYel/Y4+nCn+bQEuQ4XieLTSY6Q6aLtDKbyxxi3yxe5ubzhOsABwo4QKfB3zwl9WPxH b042i/fn4LA1S7yYAJCbpcWwDvgK5e5sGEMi8uAYqE3oqPW4GgKHnzyqyfZHXP0BbeGNzA pAyhihgz+LAW7XZeWVGr1ih1rHKyN1J8Qm699LHCT57PWllfxxsa/nSkXL2JrA== 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=1717816942; 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=5xFRyWyL3ZOUI/QvQi5ENAATEZtc231yLTMcgr8HiNI=; b=rSZYLdkqThI7GwzNpH10M+QppSRy9awU2x3Vvc5SBFUcxetg4wz1j6c7hJXGWwJnrth7bR YVssowD7avhY5nFucJ9HbopoEAa4oH+8gmUMbLIuqV1J9w6ODl8AqGTYZu6UtfiNpYzwoA oPSXhXVrT3hEYZqekZGClohZ/iAX1cO4AdKkXgZNHc/4RLFbjKqZEeFAn8B3Em1LEXREpe BgkcBw+uJoCarLXi3so1HhGKtnHmC0XbmyY30UdXBTEpLlUtjcFSeo/QUaGrH2zJVFOUGU PqK5hW3/InaBDX5Ab3KJsxi7+p3ijhZETJHEV4vonljH9XlJEFMHvRASUQ8o/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 4Vx3KB34nTzhXT; Sat, 8 Jun 2024 03:22: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 4583MMiq056328; Sat, 8 Jun 2024 03:22:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4583MMkw056325; Sat, 8 Jun 2024 03:22:22 GMT (envelope-from git) Date: Sat, 8 Jun 2024 03:22:22 GMT Message-Id: <202406080322.4583MMkw056325@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 23f4131ad685 - main - sys/sysctl.h: Fix wrong assertion with multiple access flags List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 23f4131ad685debef98566351cb9f0e0a5903903 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=23f4131ad685debef98566351cb9f0e0a5903903 commit 23f4131ad685debef98566351cb9f0e0a5903903 Author: Zhenlei Huang AuthorDate: 2024-06-08 03:21:11 +0000 Commit: Zhenlei Huang CommitDate: 2024-06-08 03:21:11 +0000 sys/sysctl.h: Fix wrong assertion with multiple access flags With multiple flags passed in, e.g., CTLFLAG_RD | CTLFLAG_CAPRD, due to the precedence rules, this will result in false positive assertion. Fix that by surrounding the replacement lists with parentheses. Reviewed by: imp, erj Fixes: 10a1e981d411 iflib: mark isc_driver_version as constant MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D45531 --- sys/sys/sysctl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index d80e0fbbe2e4..7b27cb307e0c 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -393,14 +393,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define SYSCTL_CONST_STRING(parent, nbr, name, access, arg, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING | CTLFLAG_MPSAFE | (access),\ __DECONST(char *, arg), 0, sysctl_handle_string, "A", descr); \ - CTASSERT(!(access & CTLFLAG_WR)); \ + CTASSERT(!((access) & CTLFLAG_WR)); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING) #define SYSCTL_ADD_CONST_STRING(ctx, parent, nbr, name, access, arg, descr) \ ({ \ char *__arg = __DECONST(char *, arg); \ - CTASSERT(!(access & CTLFLAG_WR)); \ + CTASSERT(!((access) & CTLFLAG_WR)); \ CTASSERT(((access) & CTLTYPE) == 0 || \ ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING | \ From nobody Sat Jun 8 07:51: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 4Vx9Hv2Xcdz5NcpX; Sat, 08 Jun 2024 07:51: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 4Vx9Hv24JGz4ZQp; Sat, 8 Jun 2024 07:51:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717833099; 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=XYpIVmpHWofJm/J63BFyRjCbObNq9fJm75N6gIIl0B0=; b=uoV8TgbKvNHQpx0Mrtps7oknSlwINpwo0L5jAmHAniZkS7THugqOtW2AC3kLIlFk2hbbXu hFpzIOPLS+5MKDtx8yA75wrgZuUL6xE+hC6F33lL1QiMe9syAsvnoERFWNAX1+EiMdllXz YQd8HRUPbkrV02oXL+802XF3na7NDqDvqfIZeXCBw0lIbHLLp7ztXeefYg2SO1/KRRLahb hSx+tp1fpwPlFWOdRBh787KEPb9AGq/eR4x2UzCNJLRO7si8t6cl86NpCUeghcmwxk8/Nn e4algDF6kQoxXfiJ9pScEF7P0waPwb0g4SseSLgTB+iqIObZ8K8E/MEtdJmN6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717833099; a=rsa-sha256; cv=none; b=HDrRmU6qvYJVWZDbjSs+V4wrVCW+AghBPVcwBZB7Gu5XTVhhDFLflM2nt7b7wcywhJSVZf jcFWQ+aZqW8CUAW+FRMPJ7J5rfn9TX98nJPtmVloxMgdh10449xAyZdqPNAv4g6TQRMQC8 f7l/Aa9mUHYRySV3NDKGgkKBmQn1h+rg/ZAVwajMILPaTDGDsg3DcIutlq2qqkafvNKhP0 LtbT685MORUBtQTKjWaQ3uPW+Ke+x4GZmoEKO46kjHfhFQH9pXXGBrQ2wk1M0cgZxH2sIu HbMmum/w/EzfPdXeuwcsNJBHwVDfqtvmhSqto8OTyq5JbKaCQmzxSb7LbfQEKA== 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=1717833099; 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=XYpIVmpHWofJm/J63BFyRjCbObNq9fJm75N6gIIl0B0=; b=ddchKC91P02Cl/tX2ppHJVI5VX02vxPxjTzgUcPuWsYNPvZhq1iOjAPJ/uO+JONiq8NOIB xEMT2gVNfAP74nhNPDdbMY8Nw8xa7J8AwBJiIoa6Ojkm+osRwmn8xAbFXJ0W1rYM1J1Hkk 2ZRqMSGxD13kHhek6tYQCj6mtkE0DgfMP4/E9b21g8G2E64MpUtkFVE7v6wz15Cqm3tbzD YPnV5KXV9QDphmtTySiMy12WrJW7ZZ4hI+TqVfCPh31xrw5GFD72EvpOfb3oB4buR72MpD PXfVvwr8lA4Yas+3eeevZkzMYHSdhEx08DAt8cRPWZwgHkAuHKkqj1macf/fMw== 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 4Vx9Hv1Px6zqqL; Sat, 8 Jun 2024 07:51: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 4587pdjJ007280; Sat, 8 Jun 2024 07:51:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4587pd2N007277; Sat, 8 Jun 2024 07:51:39 GMT (envelope-from git) Date: Sat, 8 Jun 2024 07:51:39 GMT Message-Id: <202406080751.4587pd2N007277@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 5ee5c40402c9 - main - arm64 pmap: Defer bti lookup List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 5ee5c40402c92a498ed8d6eeb6cf0b5c1680817b Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=5ee5c40402c92a498ed8d6eeb6cf0b5c1680817b commit 5ee5c40402c92a498ed8d6eeb6cf0b5c1680817b Author: Alan Cox AuthorDate: 2024-06-07 05:23:59 +0000 Commit: Alan Cox CommitDate: 2024-06-08 07:26:55 +0000 arm64 pmap: Defer bti lookup Defer the bti lookup until after page table page allocation is complete. We sometimes release the pmap lock and sleep during page table page allocation. Consequently, the result of a bti lookup from before page table page allocation could be stale when we finally create the mapping based on it. Modify pmap_bti_same() to update the prototype PTE at the same time as checking the address range. This eliminates the need for calling pmap_pte_bti() in addition to pmap_bti_same(). pmap_bti_same() was already doing most of the work of pmap_pte_bti(). Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45502 --- sys/arm64/arm64/pmap.c | 73 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 29 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 92c1c824ba4e..7b30b2a6ae37 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -508,7 +508,8 @@ static void pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_entry_t newpte, static __inline vm_page_t pmap_remove_pt_page(pmap_t pmap, vm_offset_t va); static uma_zone_t pmap_bti_ranges_zone; -static bool pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva); +static bool pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, + pt_entry_t *pte); static pt_entry_t pmap_pte_bti(pmap_t pmap, vm_offset_t va); static void pmap_bti_on_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva); static void *bti_dup_range(void *ctx, void *data); @@ -4955,21 +4956,22 @@ set_l3: #endif /* VM_NRESERVLEVEL > 0 */ static int -pmap_enter_largepage(pmap_t pmap, vm_offset_t va, pt_entry_t newpte, int flags, +pmap_enter_largepage(pmap_t pmap, vm_offset_t va, pt_entry_t pte, int flags, int psind) { - pd_entry_t *l0p, *l1p, *l2p, origpte; + pd_entry_t *l0p, *l1p, *l2p, newpte, origpte; vm_page_t mp; PMAP_LOCK_ASSERT(pmap, MA_OWNED); KASSERT(psind > 0 && psind < MAXPAGESIZES, ("psind %d unexpected", psind)); - KASSERT((PTE_TO_PHYS(newpte) & (pagesizes[psind] - 1)) == 0, - ("unaligned phys address %#lx newpte %#lx psind %d", - PTE_TO_PHYS(newpte), newpte, psind)); + KASSERT((PTE_TO_PHYS(pte) & (pagesizes[psind] - 1)) == 0, + ("unaligned phys address %#lx pte %#lx psind %d", + PTE_TO_PHYS(pte), pte, psind)); restart: - if (!pmap_bti_same(pmap, va, va + pagesizes[psind])) + newpte = pte; + if (!pmap_bti_same(pmap, va, va + pagesizes[psind], &newpte)) return (KERN_PROTECTION_FAILURE); if (psind == 2) { PMAP_ASSERT_L1_BLOCKS_SUPPORTED; @@ -5123,9 +5125,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, lock = NULL; PMAP_LOCK(pmap); - /* Wait until we lock the pmap to protect the bti rangeset */ - new_l3 |= pmap_pte_bti(pmap, va); - if ((flags & PMAP_ENTER_LARGEPAGE) != 0) { KASSERT((m->oflags & VPO_UNMANAGED) != 0, ("managed largepage va %#lx flags %#x", va, flags)); @@ -5197,6 +5196,7 @@ havel3: orig_l3 = pmap_load(l3); opa = PTE_TO_PHYS(orig_l3); pv = NULL; + new_l3 |= pmap_pte_bti(pmap, va); /* * Is the specified virtual address already mapped? @@ -5405,7 +5405,6 @@ pmap_enter_l2_rx(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, new_l2 = (pd_entry_t)(VM_PAGE_TO_PTE(m) | ATTR_DEFAULT | ATTR_S1_IDX(m->md.pv_memattr) | ATTR_S1_AP(ATTR_S1_AP_RO) | L2_BLOCK); - new_l2 |= pmap_pte_bti(pmap, va); if ((m->oflags & VPO_UNMANAGED) == 0) { new_l2 |= ATTR_SW_MANAGED; new_l2 &= ~ATTR_AF; @@ -5478,7 +5477,7 @@ pmap_enter_l2(pmap_t pmap, vm_offset_t va, pd_entry_t new_l2, u_int flags, * and let vm_fault() cope. Check after l2 allocation, since * it could sleep. */ - if (!pmap_bti_same(pmap, va, va + L2_SIZE)) { + if (!pmap_bti_same(pmap, va, va + L2_SIZE, &new_l2)) { KASSERT(l2pg != NULL, ("pmap_enter_l2: missing L2 PTP")); pmap_abort_ptp(pmap, va, l2pg); return (KERN_PROTECTION_FAILURE); @@ -5633,7 +5632,6 @@ pmap_enter_l3c_rx(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t *ml3p, l3e = VM_PAGE_TO_PTE(m) | ATTR_DEFAULT | ATTR_S1_IDX(m->md.pv_memattr) | ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_CONTIGUOUS | L3_PAGE; - l3e |= pmap_pte_bti(pmap, va); if ((m->oflags & VPO_UNMANAGED) == 0) { l3e |= ATTR_SW_MANAGED; l3e &= ~ATTR_AF; @@ -5733,19 +5731,6 @@ retry: } } l3p = (pt_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(*ml3p)); - -have_l3p: - /* - * If bti is not the same for the whole L3C range, return - * failure and let vm_fault() cope. Check after L3 allocation, - * since it could sleep. - */ - if (!pmap_bti_same(pmap, va, va + L3C_SIZE)) { - (*ml3p)->ref_count -= L3C_ENTRIES - 1; - pmap_abort_ptp(pmap, va, *ml3p); - *ml3p = NULL; - return (KERN_PROTECTION_FAILURE); - } } else { *ml3p = NULL; @@ -5768,8 +5753,22 @@ have_l3p: pmap_load(pde))); } } +have_l3p: l3p = &l3p[pmap_l3_index(va)]; + /* + * If bti is not the same for the whole L3C range, return failure + * and let vm_fault() cope. Check after L3 allocation, since + * it could sleep. + */ + if (!pmap_bti_same(pmap, va, va + L3C_SIZE, &l3e)) { + KASSERT(*ml3p != NULL, ("pmap_enter_l3c: missing L3 PTP")); + (*ml3p)->ref_count -= L3C_ENTRIES - 1; + pmap_abort_ptp(pmap, va, *ml3p); + *ml3p = NULL; + return (KERN_PROTECTION_FAILURE); + } + /* * If there are existing mappings, either abort or remove them. */ @@ -9271,8 +9270,16 @@ pmap_bti_deassign_all(pmap_t pmap) rangeset_remove_all(pmap->pm_bti); } +/* + * Returns true if the BTI setting is the same across the specified address + * range, and false otherwise. When returning true, updates the referenced PTE + * to reflect the BTI setting. + * + * Only stage 1 pmaps support BTI. The kernel pmap is always a stage 1 pmap + * that has the same BTI setting implicitly across its entire address range. + */ static bool -pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) +pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, pt_entry_t *pte) { struct rs_el *next_rs, *rs; vm_offset_t va; @@ -9282,10 +9289,16 @@ pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) ("%s: Start address not in canonical form: %lx", __func__, sva)); KASSERT(ADDR_IS_CANONICAL(eva), ("%s: End address not in canonical form: %lx", __func__, eva)); + KASSERT((*pte & ATTR_S1_GP) == 0, + ("%s: pte %lx has ATTR_S1_GP preset", __func__, *pte)); - if (pmap->pm_bti == NULL || ADDR_IS_KERNEL(sva)) + if (pmap == kernel_pmap) { + *pte |= ATTR_KERN_GP; + return (true); + } + if (pmap->pm_bti == NULL) return (true); - MPASS(!ADDR_IS_KERNEL(eva)); + PMAP_ASSERT_STAGE1(pmap); rs = rangeset_lookup(pmap->pm_bti, sva); if (rs == NULL) { rs = rangeset_next(pmap->pm_bti, sva); @@ -9299,6 +9312,8 @@ pmap_bti_same(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) return (false); rs = next_rs; } + if (rs != NULL) + *pte |= ATTR_S1_GP; return (true); } From nobody Sat Jun 8 15:56: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 4VxN3864s0z5M91x; Sat, 08 Jun 2024 15:56: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 4VxN383cqvz4Kbx; Sat, 8 Jun 2024 15:56:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717862180; 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=OyZKrHDdKkPiml2WCLGp8wF3GtoMHRSWb9C+l5o0Gyc=; b=w83KoNVfdF6t1C5TgVX4n3v5jB9oj0zBIwkGvrRnpQwNf2AGtMogGkhivdRAv8e8Ti3lkN M8R5OSbUk2jJXpb++gY0Hweid9O0YVhNOVjXn8dMpeyBJHnLdgwOzXmfPuUrWkeeaXdnSW nl2gwF6SxzT9NCIjFGXcs08dC/EiiZWF8jBZoNsMsftr9TAE1oe2rQjYM62c7+fyjbDh+o ERMB5gtnSjzQS5EgegAwrYP7irnVEpJhiu7HT3kqbPnh6LOm51O2LTVrExp+NxfH0d0exh deqAXB8dWY1gcvO0DyaSgvX2X8s4NVUCFpCRve1rP7EfiQjwMaoJvhgcrTM5+w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717862180; a=rsa-sha256; cv=none; b=vdBP4qGOF5/yXXTxtQXjkWAEssgbcMj+iXKb/qKm1VwbkfcgSQymd3Ards3cRX/qWmM+Pk m/Br2Y4ldgEuvY2EJg00FpTcwqgzC2HO8TUmshbK29r33ECluIeTcIHlvLwQwTbx14IJZW ldCxfO2QGCKuq71uRzdoOT+FWeJwqeIBZDWJl7uQKggViFmN1T+MFfbrBKe680Nq7vGd3T Rq+teyynrSMx9468oGJgUxTKv/6Un3YoJ1Lfzlf5fptoZWlmeac0g0ZZZVXQu1Z9gjNx6Y R0l7bsbpSqkCQSP1+uLuEPe3u3pqMR4/CX34W85FZr3uBydMA4HjII86Wul89w== 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=1717862180; 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=OyZKrHDdKkPiml2WCLGp8wF3GtoMHRSWb9C+l5o0Gyc=; b=t3SY5c0v7aAUZP3cEoEH06z3rHHTuEEN+caIeSQMHL+Z7QAZzhi3em4+gKa2tvHpeRFtBW fOEZjfsIe+yZ9Nb90g4VTrT1q5T4+E90EVzMk17zjoq+xzsQ9TqMoM8u4Co0XsYFtHsfcC h3dGYdY94Dac0vtrmq3o7fz3w30CMqGCynrmA0ujkPEUPQuIWPRC/dguqVv6EI5PM3LXit bSCuDHIDhn5BRToBz68Xvu7ClqDwm/WMuglhbT3zyR+0Z8drk+WF4SWYczV9U9wfY3UNnS 228Zp4545Sr3jRy1EoT2bKHRj7asVUYqSpGd2QENJzQy+3IZkW3VIfoKVHHOvw== 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 4VxN380jYlz14VY; Sat, 8 Jun 2024 15:56: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 458FuJqW022363; Sat, 8 Jun 2024 15:56:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 458FuJYN022360; Sat, 8 Jun 2024 15:56:19 GMT (envelope-from git) Date: Sat, 8 Jun 2024 15:56:19 GMT Message-Id: <202406081556.458FuJYN022360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 888796ade284 - main - libm: fma: correct zero sign with small inputs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 888796ade2842486d3167067e8034254c38aadd3 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=888796ade2842486d3167067e8034254c38aadd3 commit 888796ade2842486d3167067e8034254c38aadd3 Author: Ed Maste AuthorDate: 2024-03-19 14:31:39 +0000 Commit: Ed Maste CommitDate: 2024-06-08 15:55:36 +0000 libm: fma: correct zero sign with small inputs PR: 277783 Reported by: Victor Stinner Submitted by: kargl MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D44433 --- lib/msun/src/s_fma.c | 4 +++- lib/msun/src/s_fmal.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/msun/src/s_fma.c b/lib/msun/src/s_fma.c index b8a342646d85..4d08b40cc71a 100644 --- a/lib/msun/src/s_fma.c +++ b/lib/msun/src/s_fma.c @@ -267,7 +267,9 @@ fma(double x, double y, double z) */ fesetround(oround); volatile double vzs = zs; /* XXX gcc CSE bug workaround */ - return (xy.hi + vzs + ldexp(xy.lo, spread)); + xs = ldexp(xy.lo, spread); + xy.hi += vzs; + return (xy.hi == 0 ? xs : xy.hi + xs); } if (oround != FE_TONEAREST) { diff --git a/lib/msun/src/s_fmal.c b/lib/msun/src/s_fmal.c index 3d333632127c..12f9c364670b 100644 --- a/lib/msun/src/s_fmal.c +++ b/lib/msun/src/s_fmal.c @@ -248,7 +248,9 @@ fmal(long double x, long double y, long double z) */ fesetround(oround); volatile long double vzs = zs; /* XXX gcc CSE bug workaround */ - return (xy.hi + vzs + ldexpl(xy.lo, spread)); + xs = ldexpl(xy.lo, spread); + xy.hi += vzs; + return (xy.hi == 0 ? xs : xy.hi + xs); } if (oround != FE_TONEAREST) { From nobody Sat Jun 8 23:42: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 4VxZNZ6KpXz5N0Kf; Sat, 08 Jun 2024 23:42: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 4VxZNZ45h7z44XL; Sat, 8 Jun 2024 23:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717890126; 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=6m+zdXEiV8yJN/j37YQRkN67Fp0XZkqAEprl748MbE8=; b=cduMORvtzvprFij7chC0usCln8KPUFoUH9NF9P1SE3Q+cUbi/PHtZUesTr+NzsD18xWfbU gh7wsQkGE3o+sJVg/WOsCA5cpsxKDfq6nUOU9g8jAzxJUDNz40gYn3UF/lpfyeHkvjuGcT vwwv5gOv9rJSwi08d4X6UhEzJmRG+CEfLIAbEePxj1bhVv0iOPQVUobEIoJR+7KblLf84b Ey5t7MId5CkS09VM1FKxnph3Frsz4jxH88ssNEN8eI99PQBURvCWpWgmRUoI+VaagbKrGB Dlrpixl8KqVaZm8MudfT2GsXcoZY6fsBtjHXwt6quIg0am4kM3chHsYbUWrqvQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717890126; a=rsa-sha256; cv=none; b=UVJ63nFHKodd+KqClfMpLGUbcMwuB/OO3fq1XRw7jezNtaR5kQT5qbXN0RgZeVN259zS3I voVhrXFCd/7fBaa/87KKcBPsoJ2d6NHbUJifgjS48gpQ6h//jFir5uVmHf59NoMS4AqOVj 0bvYdu6h4TRiW4YSMDdv6VejAuUYS7RjW8Q5SqzELIzUJYGkDlYfAKIRvbkxGlPyTA75Y8 GCbOE9yWi9Q9bnMRVJeKT9rrvk1PeuWMRpqWN956stehRbkDsPkPGK0kLJ+NQQ6iwOc1YX zvdXE1/4IaC6905Bo5RqZ/JuZul+i4EPiyQHqHLxh8vLcpAkGOw5JdwapNBbIw== 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=1717890126; 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=6m+zdXEiV8yJN/j37YQRkN67Fp0XZkqAEprl748MbE8=; b=GAczkPOhuawgyrEh4ZghnmTkOUOQYDeZAopryVxxe8UwVNztPCYipJZzADIgohwO/oVvcY 5kTAf2oUHv5KJiHWk/iDFQ1zJ8uQufaCgmMV9fq4+ET0kWKQBqTVXfTNV9OSSbXs0XNHo8 sYgJHKxiYdqda03G4+0TEhSdRz64k9xClfPH1y1ShOK4kAcEwrRIUHupF3pTzvzoGbAHJ4 9WgzdEH5kf8aA85YAWkOV00BkNzuZZsb02f82r4So0Ncw5B2J0iPI/OLCB0gId40FxZPqS bASJ94dvuDxb1TNU9WrqaUBAsIT67kyXF4jliLryAWlhgQnnUcoqwRieGEMung== 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 4VxZNZ3jC1zJd9; Sat, 8 Jun 2024 23:42: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 458Ng6ZR012883; Sat, 8 Jun 2024 23:42:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 458Ng67K012880; Sat, 8 Jun 2024 23:42:06 GMT (envelope-from git) Date: Sat, 8 Jun 2024 23:42:06 GMT Message-Id: <202406082342.458Ng67K012880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 13a51233e4c7 - main - nfsd: Delete an unused VNET global variable List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 13a51233e4c7d6cff04043c38845b1ec1af38680 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=13a51233e4c7d6cff04043c38845b1ec1af38680 commit 13a51233e4c7d6cff04043c38845b1ec1af38680 Author: Rick Macklem AuthorDate: 2024-06-08 23:40:52 +0000 Commit: Rick Macklem CommitDate: 2024-06-08 23:40:52 +0000 nfsd: Delete an unused VNET global variable During code inspection, I noticed that NFSD_VNET_DEFINE(nfsrv_dontlisthead) is unused, so delete it. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdsubs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdsubs.c b/sys/fs/nfsserver/nfs_nfsdsubs.c index 0d7e4c73fe69..d80826993f23 100644 --- a/sys/fs/nfsserver/nfs_nfsdsubs.c +++ b/sys/fs/nfsserver/nfs_nfsdsubs.c @@ -57,9 +57,6 @@ NFSD_VNET_DECLARE(int, nfs_rootfhset); NFSD_VNET_DECLARE(uid_t, nfsrv_defaultuid); NFSD_VNET_DECLARE(gid_t, nfsrv_defaultgid); -NFSD_VNET_DEFINE(struct nfsdontlisthead, nfsrv_dontlisthead); - - char nfs_v2pubfh[NFSX_V2FH]; struct nfsdontlisthead nfsrv_dontlisthead; struct nfslayouthead nfsrv_recalllisthead; From nobody Sun Jun 9 01:06: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 4VxcGH1TNJz5N7lV; Sun, 09 Jun 2024 01:06: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 4VxcGH0pmcz4Dgj; Sun, 9 Jun 2024 01:06:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717895207; 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=6ZYIn8yOMRrj432MAAd3BpjVlYKyPZHYWoh/A0cnXN4=; b=E8RgN1PXxF8gJUj/ksDhug/ya5TiDhhr1GF1le7GvUHhXTVIPzdFmSynU8olH8Vj+gCSZo ew4hVwc+65i5VAeW922AXuMAKy/NJXOvpcep5sJKI5tWVC6xSYDJ9wjWDpzZuiEPgVDZbq T3MJKHWyoAfsVldHTBtzQTTknkypCS3BE7og4MvGNI3Hvtqwutia1NJU2Ts+Bw9e0/nTmH MM61p/FxZaq+7XFJQ4J8sa7H2ZoJfxbhuPZYN8x5IcnhpgWG/0Y7XDAJQog51jxZqqA+zJ 61BggtGBIoXw+M84RWHZA7vc7OlUq1wfqzpT420r2C2oCx3SrabUH/XpGhe0ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717895207; a=rsa-sha256; cv=none; b=EMR51oRHEWFrtZ7AHZSO10Mj+M0G2dkgqtUDwGn00vGSOPQDr8RRD3tCmeraz2PMuqhLlB E361a0dJYtS3NnUtO7jqcjzXKGqQdAx8Joc2tiDKOtSsA17u+qRp4xARsZxcVfXz/CsIGi eSnzh7Mm0CULI1l4YiAeuILhkcv1UVpB2r5y/QQuQQH+YAKto2eZyruxaCmjQJUBtCjM+Z bBTKd0K8bCJ1vwXMqWiaTpYCpzXE5jkERzuMYUtXsfsFvnVihFW3Htq3kSjn08K0EF3sgY Sh8WjXTm547ZDMuASp+zFgp2ySMjF3hAErgnukKpy+ikNujjHLV/HR4bLLXMMQ== 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=1717895207; 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=6ZYIn8yOMRrj432MAAd3BpjVlYKyPZHYWoh/A0cnXN4=; b=OpIBKv5xQzlsQ3wiXlSHNoWJOKJ6cpY7Vk8EEbDI+NDaiDuxm57uMDH6ZEpb6ETlvNWeZq 3Nrg/sc9TNyzM65xBpUpt4UfrJx9yvKXmdkNHxLqRWH/J6JR1Np7jKi0PXTdA97sq6rbI0 ezQ+Xi29XLWKpb9cZpQi3YsUsaGzE2yWTS57u6VqmRljPgTfIkJO/cVoth9fjA89Hz9YV0 lANhdOxlgLDdGXdIdgolIgxqSC/J5zxne3w3/ClUIlet54c3Zr+WBm3+5+bWWt88hPPZVU f/Nu2YoL49KTb3WwTWzpc8wT/jJzvEOO3jo6KpgOUF4jcagPg9DrVM3sVypRXg== 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 4VxcGH0QqpzLsV; Sun, 9 Jun 2024 01:06: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 45916ljF052599; Sun, 9 Jun 2024 01:06:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45916kjJ052596; Sun, 9 Jun 2024 01:06:46 GMT (envelope-from git) Date: Sun, 9 Jun 2024 01:06:46 GMT Message-Id: <202406090106.45916kjJ052596@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: ebc2bab04823 - main - pflog: Correctly check if bpf peers are present List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: ebc2bab04823c24c524f913457d6b88dc7ea9fac Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=ebc2bab04823c24c524f913457d6b88dc7ea9fac commit ebc2bab04823c24c524f913457d6b88dc7ea9fac Author: Zhenlei Huang AuthorDate: 2024-06-09 01:05:22 +0000 Commit: Zhenlei Huang CommitDate: 2024-06-09 01:05:22 +0000 pflog: Correctly check if bpf peers are present On creating the pflog(4) interface, pflog_clone_create() does an unconditional bpfattach(). Use bpf_peers_present() which was introduced in commit 16d878cc99ef [1] to check the presence of bpf peers. This will save a little CPU cycles when no bpf peers present. There should be no functional change. 1. 16d878cc99ef Fix the following bpf(4) race condition which can result in a panic Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45532 --- sys/netpfil/pf/if_pflog.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 7ac337a84c5d..1e73d5f51851 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -223,9 +223,10 @@ pflog_packet(struct pfi_kkif *kif, struct mbuf *m, sa_family_t af, struct pfloghdr hdr; if (kif == NULL || m == NULL || rm == NULL || pd == NULL) - return ( 1); + return (1); - if ((ifn = V_pflogifs[rm->logif]) == NULL || !ifn->if_bpf) + ifn = V_pflogifs[rm->logif]; + if (ifn == NULL || !bpf_peers_present(ifn->if_bpf)) return (0); bzero(&hdr, sizeof(hdr)); @@ -274,7 +275,7 @@ pflog_packet(struct pfi_kkif *kif, struct mbuf *m, sa_family_t af, if_inc_counter(ifn, IFCOUNTER_OPACKETS, 1); if_inc_counter(ifn, IFCOUNTER_OBYTES, m->m_pkthdr.len); - BPF_MTAP2(ifn, &hdr, PFLOG_HDRLEN, m); + bpf_mtap2(ifn->if_bpf, &hdr, PFLOG_HDRLEN, m); return (0); } From nobody Sun Jun 9 01:06: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 4VxcGJ3wwrz5N7xM; Sun, 09 Jun 2024 01:06:48 +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 4VxcGJ26PBz4Dm5; Sun, 9 Jun 2024 01:06:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717895208; 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=Qd/1tkdh/Gbyx+TDoplL0YFffPtsIP22I/3M2jgxIyE=; b=dXoFaGbLxoYt26TM8C+zYR3FRF8bPD5ofutQy6mVCOKxHhXruG52ba7APmAKvqGLsObPxi oPrTK4xFSHHaDDr9p0/5pFd/aZ2s1xVvmAS5+Elv5quf/3ELxdRGwj3ra4y4AjdqO0fCeA Vkms1F7WW0//018fWmUhghrTxmf7QtXf2fn6A9Vr+HR0iVvTHFYc0N/67KakrYFmEnXKu/ 5E7hFD9d2xzQrmEGa2TgaiTqC8jpGgdc82gX4Wk/vhe08JWkG7VNmwAMiJMXslVXdbkfV9 Ga+H7zSzSKkiF7Y6E5uLaET774YfNg33dQv7BE+D9H9kBiTwkpdiBH0sbNJ6Sw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717895208; a=rsa-sha256; cv=none; b=FLdefHM72G1F2CqmnYIv6o0iI5RAGgXKGdeYjL1j9gyzmQ/BkccW4TTBf1qEfrLbIo2aWz 2F8FfE5dBJyuEXKISkhPDAnbjLaBamTbXHImphhuzZhwFGj0K9ZwTgyutNaU+v/JLwVQa8 +bSHd6gkQX7KAHoX9g/e0hABVboV9/iIk48O9GhaXm43Y64vSLL6SuD+BRvaetBk4w+BH/ 32hvKIJ778isY+29r9jRjo01s8TLc9olikRr37t3OOsTgxc1uk+ufOovQ0qfCfHaVM5oyY Dgq2+h4Ak/P6gpEmkSm1Z/Un1EMZE6Z1mnDBJ2VnXoWtDj6wsmNuQFOZFHmTFw== 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=1717895208; 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=Qd/1tkdh/Gbyx+TDoplL0YFffPtsIP22I/3M2jgxIyE=; b=EyNQ034gBAIZQW49E/P+ZCEoOx6s6N18duW/+Sy+heQwZVk4QOV68TTXE7Pv5jxiJZlwMj xSvL9xiqyiPb+Zj2lbYKutcD9FeSWAI4GsLeSgWRdmNW37WfQLzZbJQdzldGVRJA+s9eIA uNfVIkZ80EKIb5jjDnoe74OL5EdUZJX6eOsGk0oETjcYZii4UhPnfhcysLhG9ImdUW3uDJ /DRGzgqYp5AYy6JVPHx3pqoCPlXAni27sBlgRuSOiUuhQbAguIXwcu/IVN3oW/JODqhMDX ZEhFWb3ZcG5PMgd4L0L2y7PLQUgZRHpbZSHR0HdqtwUTPDP8L/4Cejl8sCWO2Q== 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 4VxcGJ1jtHzLfM; Sun, 9 Jun 2024 01:06:48 +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 45916m78052656; Sun, 9 Jun 2024 01:06:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45916mrm052653; Sun, 9 Jun 2024 01:06:48 GMT (envelope-from git) Date: Sun, 9 Jun 2024 01:06:48 GMT Message-Id: <202406090106.45916mrm052653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 2671bde99295 - main - pfsync: Correctly check if bpf peers are present List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 2671bde99295d9e01d10316d0f3fb8b6d21f0f4d Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=2671bde99295d9e01d10316d0f3fb8b6d21f0f4d commit 2671bde99295d9e01d10316d0f3fb8b6d21f0f4d Author: Zhenlei Huang AuthorDate: 2024-06-09 01:05:22 +0000 Commit: Zhenlei Huang CommitDate: 2024-06-09 01:05:22 +0000 pfsync: Correctly check if bpf peers are present On creating the pfsync(4) interface, pfsync_clone_create() does an unconditional bpfattach(). Use bpf_peers_present() which was introduced in commit 16d878cc99ef [1] to check the presence of bpf peers. This will save a little CPU cycles and memory usage when the synchronisation interface is not configured and there is no bpf peers present. There should be no functional change. 1. 16d878cc99ef Fix the following bpf(4) race condition which can result in a panic Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D45533 --- sys/netpfil/pf/if_pfsync.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index c22a6a5982a9..80d6fddc709c 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1796,7 +1796,7 @@ pfsync_sendout(int schedswi, int c) ("%s: sc_len %zu", __func__, b->b_len)); PFSYNC_BUCKET_LOCK_ASSERT(b); - if (ifp->if_bpf == NULL && sc->sc_sync_if == NULL) { + if (!bpf_peers_present(ifp->if_bpf) && sc->sc_sync_if == NULL) { pfsync_drop(sc); return; } @@ -1925,10 +1925,10 @@ pfsync_sendout(int schedswi, int c) V_pfsyncstats.pfsyncs_oacts[PFSYNC_ACT_EOF]++; /* we're done, let's put it on the wire */ - if (ifp->if_bpf) { + if (bpf_peers_present(ifp->if_bpf)) { m->m_data += aflen; m->m_len = m->m_pkthdr.len = len - aflen; - BPF_MTAP(ifp, m); + bpf_mtap(ifp->if_bpf, m); m->m_data -= aflen; m->m_len = m->m_pkthdr.len = len; } From nobody Sun Jun 9 14:09: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 4Vxxd82W3Qz5MC96; Sun, 09 Jun 2024 14:09: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 4Vxxd81yQ3z49qX; Sun, 9 Jun 2024 14:09:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717942156; 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=rtliQx/uQswICZwiQKVaGHEMPzxzkVNtmh6JEDMYnlk=; b=todL7XrBPS/OEWmz8WI99j+fGXpynQNMjj+Kc07rAFFyUKevaxjFAcDTzqGdYfWog7WuUB uTtIaGMCNqLltDuXXypi3NTX8FfeQlj1X+5RFat/RV9NwyT5rNLh8+qD0lCQL9uTtPUYaw cd9LPn79z66Klkeuvvq9QLeT2lL13GNmKhGK/SvOGkjfFPi2x8iI0HytDlmO65SdXoCkmu Vwy7B/+b+z+8f7xEXdX5vS1ouIqcB8f4kOgZJQiGI/rpcCCs75CqiELezgc05Vcd8WGgkw k4niyzB6wztb5ECYuhLZsHeiKDiIBC7vozQl0Dqg+Hw0vzbl8NSoXyEZVG3iPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717942156; a=rsa-sha256; cv=none; b=pUddwTcEBO5hpYCi4hzwAxzpkcBCcLyaJZgfUI/BCCrA0eJNp6Hb1tMCz3Jt2fd9xjus8R dfE6xC3Jb5aAdX0onQpPUNQtINLpYYVH5quk5iiJBgYztY67hY3toe721/u/acDkIzqyI4 6oNy/BcLzK0rDXsBKGsJrxS3F/Zuua6/OSAFKZbawnWvAX0KeFAfIIjIUhBEyVjGT8cgOx pJGltYbK9TLuCdL87U7UsGFinIk6ot8XSUGlRZNMENu99eb/N06F7GzohkCV7VrGQXcpzU q02jq3s8yhkNzJML5Cmk/2bq9C64lGkAgicHZiIhosn06+ymCisHDJAmRqS9wg== 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=1717942156; 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=rtliQx/uQswICZwiQKVaGHEMPzxzkVNtmh6JEDMYnlk=; b=IxFN0KdX5Dn3Rb2jW2KDwdf6dCb8Ytvfq4keA7CIY0k9zE+tkE0KH/Qr2I1vlNtB4w25fz +QzuWA9EOtbJR0EuOCgfHaTgM7L5QNfiPoOqY5yd5ImL06uENxrd1YY3euv+MgmQ7+WzqV EJf7yRowGfJiNG0pp2awC7p5chVtdpZtNkIn8JxC9bZQIzpRGuWbYF5Tlb9lBaEp4goe0g LAfUIb5YXS3Ryn69CNRQoin8wiwf/7OJPlbfxgJ5Kmhqm59Rf/rUYf2N5XjC6r7swYMgZo P1pjw0kdTfkX6xSx/e+4urR4TvNirPmlcDqhUDBHp87zR4zSnILFw8iAdovq6A== 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 4Vxxd81TQqzlWx; Sun, 9 Jun 2024 14:09: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 459E9GFR070444; Sun, 9 Jun 2024 14:09:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 459E9GAH070441; Sun, 9 Jun 2024 14:09:16 GMT (envelope-from git) Date: Sun, 9 Jun 2024 14:09:16 GMT Message-Id: <202406091409.459E9GAH070441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3ce9b2ee9404 - main - ti/am335x: Fix the device_set_descf() call in dmtpps_probe() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: 3ce9b2ee9404381a002316df670939a3bd3c994f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3ce9b2ee9404381a002316df670939a3bd3c994f commit 3ce9b2ee9404381a002316df670939a3bd3c994f Author: Mark Johnston AuthorDate: 2024-06-09 13:49:49 +0000 Commit: Mark Johnston CommitDate: 2024-06-09 14:08:31 +0000 ti/am335x: Fix the device_set_descf() call in dmtpps_probe() Fixes: 459dc61c8b05 ("arm: Convert drivers to use device_set_desc(f)()") --- sys/arm/ti/am335x/am335x_dmtpps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/ti/am335x/am335x_dmtpps.c b/sys/arm/ti/am335x/am335x_dmtpps.c index 5a19d3ad0dc3..32f975a310de 100644 --- a/sys/arm/ti/am335x/am335x_dmtpps.c +++ b/sys/arm/ti/am335x/am335x_dmtpps.c @@ -434,7 +434,7 @@ dmtpps_probe(device_t dev) if (dmtpps_tmr_num != tmr_num) return (ENXIO); - device_set_descf("AM335x PPS-Capture DMTimer%d", tmr_num); + device_set_descf(dev, "AM335x PPS-Capture DMTimer%d", tmr_num); return(BUS_PROBE_DEFAULT); } From nobody Sun Jun 9 14:09: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 4Vxxd93WCqz5MC21; Sun, 09 Jun 2024 14:09:17 +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 4Vxxd92RYhz4BJF; Sun, 9 Jun 2024 14:09:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717942157; 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=Rh2zhORkkTvBVFxnHF4n17g31xx8DS6GhQHkpjv6j8Y=; b=LqHA9makIaKIseVF4glALwh3Ye1cXT7Zye+wqlFNjn5TaqDEIIlNgzbaY0d/7uJXnGwxbo 6sATcD8hXrx9Kx359MF4OhKdBo/4oLhfBGfOSRPZxaUlVFndc6OOu3RTSV5BuKWdJRP/q8 eBkxkth5wxS6+l9U6L2PDG1S8ouAFiixw8BmgEPtRWZJbwmrgsNUuP5fzW4eyabBYDGHOu L3r5v63spuKMs/R1r/vTMcG9fm/naNoT0bp084A3MY7QKb8O3DxbkvLSHIaE8aEXcnvOaS 71fN5QftIPpye+ZVHqFcQfeeqGbUBwWQGCt1KA54sKO3A9ubxz9gY7Ww60dHjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717942157; a=rsa-sha256; cv=none; b=g+vtbTdZqn6HBDJ+aSK+gq6aAVx9u9+id+uGdU5DBAbOkAynWitpjPVjeTh0UGX60SQjyF e3IS2fAL60oez1jp3jnM3tCAsaHY6SZnrsCxXgZt05AkuSkwaXqnMFVuyhOmc/63qi2TXr 7cOIQm3dyKuVQzWoHNu9K1T8z92jpd8gL5iATZkqZAZDFVtDoFleQIquLXOsBSlpHqxULo XVdibEZIfR7V2vv6OYgndBZrnTjaLEP/K9Xojr7steQunLV51bDZs/60F4sbVpK2bne44X 77u/dBnjFeuMw6Wgwb+lnB+c62652DG0vYh4dH8GiaLts49xXoVAPxd/o5XQ1A== 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=1717942157; 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=Rh2zhORkkTvBVFxnHF4n17g31xx8DS6GhQHkpjv6j8Y=; b=TDmD0M42HDD9VWMkczkxJjd0IRhCF1s1odezNNafKPoikCNAzD3ZOSBUM0OHHEyU4zr2Lp 0MrVTAK8EIdzQyqvTBqTMdm1F1UmouqafqQJ/dcCJB77071Zz644K3kjiShnyQaJsMHUN0 FTiwUW95tA0JOC+il+rIBwHytHPj/lFDK9TWGOWzEUXflU9m8Dp2HA/0v2pusUq+tP4Gr/ 0j2O+SsEeRrt1NQvIAQ1Jr06yLQHM/DsZa8pK3GQBEWvyxWMny8fZa5ErCCBBv6W4Gt6KV Y9ZVPJ/D/0CBkfOIHtdt4cSkiMKNEU1J7VPjTdSf0tIZu5K8BQ7WgKGFrq+kKw== 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 4Vxxd923DVzlj6; Sun, 9 Jun 2024 14:09: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 459E9H54070499; Sun, 9 Jun 2024 14:09:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 459E9HSq070496; Sun, 9 Jun 2024 14:09:17 GMT (envelope-from git) Date: Sun, 9 Jun 2024 14:09:17 GMT Message-Id: <202406091409.459E9HSq070496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: da925fcebf39 - main - libc/tests: Further refine the condition for installing h_raw List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: da925fcebf397cc3bfc74b7aa9757efd6231aa00 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=da925fcebf397cc3bfc74b7aa9757efd6231aa00 commit da925fcebf397cc3bfc74b7aa9757efd6231aa00 Author: Mark Johnston AuthorDate: 2024-06-01 15:30:16 +0000 Commit: Mark Johnston CommitDate: 2024-06-09 14:08:31 +0000 libc/tests: Further refine the condition for installing h_raw See 8164d511d6a6 ("libc/tests: Fix installation without MK_TOOLCHAIN") for some background. Here we should really be testing MK_CLANG instead, since that's what gates compilation of libclang_rt. Fixes: 8164d511d6a6 ("libc/tests: Fix installation without MK_TOOLCHAIN") --- lib/libc/tests/ssp/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index 2907d1a621bf..0f5b56505134 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -30,7 +30,8 @@ PROGS+= h_memset # now on amd64 when it trips the stack bounds specified in t_ssp.sh . This # probably needs to be fixed as it's currently hardcoded. .if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \ - (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw") && ${MK_TOOLCHAIN} == "yes" + (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw") && \ + defined(MK_CLANG) && ${MK_CLANG} == "yes" .include "${SRCTOP}/lib/libclang_rt/compiler-rt-vars.mk" _libclang_rt_ubsan= ${SYSROOT}${SANITIZER_LIBDIR}/libclang_rt.ubsan_standalone-${CRTARCH}.a .if exists(${_libclang_rt_ubsan}) From nobody Sun Jun 9 15:30: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 4VxzQy4GDYz5MKRn; Sun, 09 Jun 2024 15:30: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 4VxzQy3mNQz4NQV; Sun, 9 Jun 2024 15:30:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717947034; 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=DACSCwL5RRWYp+TDqeZ7LwXzrvQt0XUZbxAZFvJ1FyU=; b=WQfCnD5WkXEiKS97TuoBPW0EYiMvU6dO/E7iA0EqwtPVsicS7rDQfORET2XB2LZS9hnhSU x3yud+SAhbm+wIFjNq+Ed9+sRM3Kk0ku3Fgc7EGpZ/pnePJUWUiIS5wTNNo9PFi415ybG1 koUBv68Ra0iwX/NK6C1HfILkzGhauLibcuxVhbyYzM9m6V5C9MQBW8DenpK0EgC6aFL4hP ikKsIGqFBcfWBaYJ+I30p9Si/l6exZZWz6DTIBvQCFMXP0VvyRFqwDMFfQJO/Rr1J6rp6r J84+LKC6GK2BS4zOaa42i/1QychJA0sHmbWDrGkmo+03ZSV196nNo6tABH956A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717947034; a=rsa-sha256; cv=none; b=irr4woBKyVFzzlehI/UpN0NtKdelP8Ao3u8A7pPMnlMR/Lu1AuyZkS/rJb+RGHm82rFvCu AWi17wKSDpTyoybp60BrE8WpE6I+GwKzUxlAOXw09El8OnE7uaQEF6mb8uGxeIiBab4vnn Up5jOJ9wNKnWGhS9truKue9qt2TBKd/Q8NLQ5Ak49IBrcFLKKvVzu43bkRDFnBQwJvuLUu +CKIAk5KoauGXBsGFR65LKZe209hkwhmNxvkZ5pH16RDzBdQwClLjbseyWa0knA8ko/tbO TQ7cdeD4I/tvJMaF9Shx/ANga9KqSLohuIOKtSJj5a7xeWOxhbk7WyGfWr+clw== 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=1717947034; 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=DACSCwL5RRWYp+TDqeZ7LwXzrvQt0XUZbxAZFvJ1FyU=; b=A5afAqulsflGZl8RBaEZOSWaHfXSi+tmfkNmxgVLK9iWVxcsZoe+r0JPS3qtyi9MA3MESy v5kbs6WK4F4fbafeR87NbRSg3aGmP9dpNDa0YygRUbJvOI3ikdTrpBS/j7SWZvdvD7cUtS HpeeF/ttkV+1/hhT49RabhTvjzS13B8uTT98InPe7MJG5/lPQMa7nZPHvv65bsALLpVNvK ZX1vWjFr21zUtKIhi7vasGd78Jj402L5ZuNqMbVDfvb4TZUaH35N8ifPirYQOPbebAo6gj nYxl3A7bHUWPzQzM5OUl3LTYQpU38/k1BMfiUTu6ifmfh0CWhN0lThmHGCRV4A== 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 4VxzQy3MQfznwN; Sun, 9 Jun 2024 15:30: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 459FUYmk014887; Sun, 9 Jun 2024 15:30:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 459FUYYQ014884; Sun, 9 Jun 2024 15:30:34 GMT (envelope-from git) Date: Sun, 9 Jun 2024 15:30:34 GMT Message-Id: <202406091530.459FUYYQ014884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: bbca3a75bb41 - main - sound: Include sound(4) channel information in sndstat nvlist List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: bbca3a75bb412f7106a569b82c616404103be084 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=bbca3a75bb412f7106a569b82c616404103be084 commit bbca3a75bb412f7106a569b82c616404103be084 Author: Christos Margiolis AuthorDate: 2024-06-09 15:30:22 +0000 Commit: Christos Margiolis CommitDate: 2024-06-09 15:30:22 +0000 sound: Include sound(4) channel information in sndstat nvlist Extend SNDST_DSPS_PROVIDER_INFO for sound(4) to include information about each channel in a given device, similar to how cat'ing /dev/sndstat with hw.snd.verbose=2 works. While here, document all provider_info fields. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dev_submerge.ch, markj Differential Revision: https://reviews.freebsd.org/D45501 --- share/man/man4/sndstat.4 | 140 +++++++++++++++++++++++++++++++++++++------- sys/dev/sound/pcm/sndstat.c | 115 +++++++++++++++++++++++++++++++++++- sys/sys/sndstat.h | 37 ++++++++++-- 3 files changed, 265 insertions(+), 27 deletions(-) diff --git a/share/man/man4/sndstat.4 b/share/man/man4/sndstat.4 index 8325490da162..2af0619961d8 100644 --- a/share/man/man4/sndstat.4 +++ b/share/man/man4/sndstat.4 @@ -29,7 +29,7 @@ .\" .\" Note: The date here should be updated whenever a non-trivial .\" change is made to the manual page. -.Dd April 15, 2021 +.Dd June 5, 2024 .Dt SNDSTAT 4 .Os .Sh NAME @@ -60,25 +60,55 @@ struct sndstioc_nv_arg { Here is an example of an nvlist object with explanations of the common fields: .Bd -literal -offset indent dsps (NVLIST ARRAY): 1 - from_user (BOOL): FALSE - nameunit (STRING): [pcm0] - devnode (STRING): [dsp0] - desc (STRING): [Generic (0x8086) (Analog Line-out)] - pchan (NUMBER): 1 (1) (0x1) - rchan (NUMBER): 0 (0) (0x0) - info_play (NVLIST): - min_rate (NUMBER): 48000 (48000) (0xbb80) - max_rate (NUMBER): 48000 (48000) (0xbb80) - formats (NUMBER): 16 (16) (0x10) - min_chn (NUMBER): 2 (2) (0x2) - max_chn (NUMBER): 2 (2) (0x2) - provider_info (NVLIST): - unit (NUMBER): 0 (0) (0x0) - bitperfect (BOOL): FALSE - pvchan (NUMBER): 1 (1) (0x1) - rvchan (NUMBER): 0 (0) (0x0) - provider (STRING): [sound(4)] - , + from_user (BOOL): FALSE + nameunit (STRING): [pcm0] + devnode (STRING): [dsp0] + desc (STRING): [Generic (0x8086) (Analog Line-out)] + pchan (NUMBER): 1 + rchan (NUMBER): 0 + info_play (NVLIST): + min_rate (NUMBER): 48000 + max_rate (NUMBER): 48000 + formats (NUMBER): 16 + min_chn (NUMBER): 2 + max_chn (NUMBER): 2 + provider_info (NVLIST): + unit (NUMBER): 0 + bitperfect (BOOL): FALSE + pvchan (NUMBER): 1 + rvchan (NUMBER): 0 + channel_info (NVLIST_ARRAY): 1 + name (STRING): pcm0:virtual_play:dsp0.vp0 + parentchan (STRING): pcm0:play:dsp0.p0 + unit (NUMBER): 1 + latency (NUMBER): 2 + rate (NUMBER): 48000 + format (NUMBER): 0x201000 + pid (NUMBER): 1234 + comm (STRING): mpv + interrupts (NUMBER): 0 + feedcount (NUMBER): 0 + xruns (NUMBER): 0 + left_volume (NUMBER): 45 + right_volume (NUMBER): 45 + hwbuf_fmt (NUMBER): 0x200010 + hwbuf_size (NUMBER): 0 + hwbuf_blksz (NUMBER): 0 + hwbuf_blkcnt (NUMBER): 0 + hwbuf_free (NUMBER): 0 + hwbuf_ready (NUMBER): 0 + swbuf_fmt (NUMBER): 0x201000 + swbuf_size (NUMBER): 16384 + swbuf_blksz (NUMBER): 2048 + swbuf_blkcnt (NUMBER): 8 + swbuf_free (NUMBER): 16384 + swbuf_ready (NUMBER): 0 + feederchain (STRING): + [userland -> + feeder_root(0x00201000) -> + feeder_format(0x00201000 -> 0x00200010) -> + feeder_volume(0x00200010) -> hardware] + provider (STRING): [sound(4)] .Ed .Bl -tag -width ".Dv provider_info" .It Dv from_user @@ -133,6 +163,76 @@ Provider-specific fields. This field may not exist if the PCM audio device is not provided by in-kernel interface. This field will not exist if the provider field is an empty string. +For the +.Xr sound 4 +provider, there are a number of name/value pairs inside this field: +.Bl -tag -width ".Dv channel_info" +.It Dv unit +Sound card unit. +.It Dv bitperfect +Whether the sound card has bit-perfect mode enabled. +.It Dv pvchan +Number of playback virtual channels. +.It Dv rvchan +Number of recording virtual channels. +.It Dv channel_info +Channel information. +There are a number of name/value pairs inside this field: +.Bl -tag -width ".Dv hwbuf_blkcnt" +.It Dv name +Channel name. +.It Dv parenchan +Parent channel name (e.g., in the case of virtual channels). +.It Dv unit +Channel unit. +.It Dv latency +Latency. +.It Dv rate +Sampling rate. +.It Dv format +Sampling format. +.It Dv pid +PID of the process consuming the channel. +.It Dv comm +Name of the process consuming the channel. +.It Dv interrupts +Number of interrupts since the channel has been opened. +.It Dv xruns +Number of overruns/underruns, depending on channel direction. +.It Dv feedcount +Number of read/written bytes since the channel has been opened. +.It Dv left_volume +Left volume. +.It Dv right_volume +Right volume. +.It Dv hwbuf_format +Hardware buffer format. +.It Dv hwbuf_size +Hardware buffer size. +.It Dv hwbuf_blksz +Hardware buffer block size. +.It Dv hwbuf_blkcnt +Hardware buffer block count. +.It Dv hwbuf_free +Free space in hardware buffer (in bytes). +.It Dv hwbuf_ready +Number of bytes ready to be read/written from hardware buffer. +.It Dv swbuf_format +Software buffer format. +.It Dv swbuf_size +Software buffer size. +.It Dv swbuf_blksz +Software buffer block size. +.It Dv swbuf_blkcnt +Software buffer block count. +.It Dv swbuf_free +Free space in software buffer (in bytes). +.It Dv swbuf_ready +Number of bytes ready to be read/written from software buffer. +.It Dv feederchain +Channel feeder chain. +.El +.El .It Dv provider A string specifying the provider of the PCm audio device. .El diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 6670a1e43aac..3be376e1da01 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -392,9 +392,12 @@ sndstat_create_diinfo_nv(uint32_t min_rate, uint32_t max_rate, uint32_t formats, static int sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) { + struct pcm_channel *c; + struct pcm_feeder *f; + struct sbuf sb; uint32_t maxrate, minrate, fmts, minchn, maxchn; - nvlist_t *di = NULL, *sound4di = NULL, *diinfo = NULL; - int err; + nvlist_t *di = NULL, *sound4di = NULL, *diinfo = NULL, *cdi = NULL; + int err, nchan; di = nvlist_create(0); if (di == NULL) { @@ -451,8 +454,116 @@ sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) sound4di, SNDST_DSPS_SOUND4_BITPERFECT, d->flags & SD_F_BITPERFECT); nvlist_add_number(sound4di, SNDST_DSPS_SOUND4_PVCHAN, d->pvchancount); nvlist_add_number(sound4di, SNDST_DSPS_SOUND4_RVCHAN, d->rvchancount); + + nchan = 0; + CHN_FOREACH(c, d, channels.pcm) { + sbuf_new(&sb, NULL, 4096, SBUF_AUTOEXTEND); + cdi = nvlist_create(0); + if (cdi == NULL) { + sbuf_delete(&sb); + PCM_RELEASE_QUICK(d); + err = ENOMEM; + goto done; + } + + nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_NAME, c->name); + nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_PARENTCHAN, + c->parentchannel != NULL ? c->parentchannel->name : ""); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_UNIT, nchan++); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_LATENCY, + c->latency); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_RATE, c->speed); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_FORMAT, + c->format); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_PID, c->pid); + nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_COMM, c->comm); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_INTR, + c->interrupts); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_FEEDCNT, + c->feedcount); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_XRUNS, c->xruns); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_LEFTVOL, + CHN_GETVOLUME(c, SND_VOL_C_PCM, SND_CHN_T_FL)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_RIGHTVOL, + CHN_GETVOLUME(c, SND_VOL_C_PCM, SND_CHN_T_FR)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_HWBUF_FORMAT, + sndbuf_getfmt(c->bufhard)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_HWBUF_SIZE, + sndbuf_getsize(c->bufhard)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_HWBUF_BLKSZ, + sndbuf_getblksz(c->bufhard)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_HWBUF_BLKCNT, + sndbuf_getblkcnt(c->bufhard)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_HWBUF_FREE, + sndbuf_getfree(c->bufhard)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_HWBUF_READY, + sndbuf_getready(c->bufhard)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_SWBUF_FORMAT, + sndbuf_getfmt(c->bufsoft)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_SWBUF_SIZE, + sndbuf_getsize(c->bufsoft)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_SWBUF_BLKSZ, + sndbuf_getblksz(c->bufsoft)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_SWBUF_BLKCNT, + sndbuf_getblkcnt(c->bufsoft)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_SWBUF_FREE, + sndbuf_getfree(c->bufsoft)); + nvlist_add_number(cdi, SNDST_DSPS_SOUND4_CHAN_SWBUF_READY, + sndbuf_getready(c->bufsoft)); + + sbuf_printf(&sb, "[%s", + (c->direction == PCMDIR_REC) ? "hardware" : "userland"); + sbuf_printf(&sb, " -> "); + f = c->feeder; + while (f->source != NULL) + f = f->source; + while (f != NULL) { + sbuf_printf(&sb, "%s", f->class->name); + if (f->desc->type == FEEDER_FORMAT) { + sbuf_printf(&sb, "(0x%08x -> 0x%08x)", + f->desc->in, f->desc->out); + } else if (f->desc->type == FEEDER_MATRIX) { + sbuf_printf(&sb, "(%d.%d -> %d.%d)", + AFMT_CHANNEL(f->desc->in) - + AFMT_EXTCHANNEL(f->desc->in), + AFMT_EXTCHANNEL(f->desc->in), + AFMT_CHANNEL(f->desc->out) - + AFMT_EXTCHANNEL(f->desc->out), + AFMT_EXTCHANNEL(f->desc->out)); + } else if (f->desc->type == FEEDER_RATE) { + sbuf_printf(&sb, + "(0x%08x q:%d %d -> %d)", + f->desc->out, + FEEDER_GET(f, FEEDRATE_QUALITY), + FEEDER_GET(f, FEEDRATE_SRC), + FEEDER_GET(f, FEEDRATE_DST)); + } else { + sbuf_printf(&sb, "(0x%08x)", + f->desc->out); + } + sbuf_printf(&sb, " -> "); + f = f->parent; + } + sbuf_printf(&sb, "%s]", + (c->direction == PCMDIR_REC) ? "userland" : "hardware"); + + sbuf_finish(&sb); + nvlist_add_string(cdi, SNDST_DSPS_SOUND4_CHAN_FEEDERCHAIN, + sbuf_data(&sb)); + sbuf_delete(&sb); + + nvlist_append_nvlist_array(sound4di, + SNDST_DSPS_SOUND4_CHAN_INFO, cdi); + nvlist_destroy(cdi); + err = nvlist_error(sound4di); + if (err) { + PCM_RELEASE_QUICK(d); + goto done; + } + } nvlist_move_nvlist(di, SNDST_DSPS_PROVIDER_INFO, sound4di); sound4di = NULL; + PCM_RELEASE_QUICK(d); nvlist_add_string(di, SNDST_DSPS_PROVIDER, SNDST_DSPS_SOUND4_PROVIDER); diff --git a/sys/sys/sndstat.h b/sys/sys/sndstat.h index e0e403b1a72a..6fef6502ec89 100644 --- a/sys/sys/sndstat.h +++ b/sys/sys/sndstat.h @@ -68,11 +68,38 @@ struct sndstioc_nv_arg { /* * sound(4)-specific name/value pair names */ -#define SNDST_DSPS_SOUND4_PROVIDER "sound(4)" -#define SNDST_DSPS_SOUND4_UNIT "unit" -#define SNDST_DSPS_SOUND4_BITPERFECT "bitperfect" -#define SNDST_DSPS_SOUND4_PVCHAN "pvchan" -#define SNDST_DSPS_SOUND4_RVCHAN "rvchan" +#define SNDST_DSPS_SOUND4_PROVIDER "sound(4)" +#define SNDST_DSPS_SOUND4_UNIT "unit" +#define SNDST_DSPS_SOUND4_BITPERFECT "bitperfect" +#define SNDST_DSPS_SOUND4_PVCHAN "pvchan" +#define SNDST_DSPS_SOUND4_RVCHAN "rvchan" +#define SNDST_DSPS_SOUND4_CHAN_INFO "channel_info" +#define SNDST_DSPS_SOUND4_CHAN_NAME "name" +#define SNDST_DSPS_SOUND4_CHAN_PARENTCHAN "parentchan" +#define SNDST_DSPS_SOUND4_CHAN_UNIT "unit" +#define SNDST_DSPS_SOUND4_CHAN_LATENCY "latency" +#define SNDST_DSPS_SOUND4_CHAN_RATE "rate" +#define SNDST_DSPS_SOUND4_CHAN_FORMAT "format" +#define SNDST_DSPS_SOUND4_CHAN_PID "pid" +#define SNDST_DSPS_SOUND4_CHAN_COMM "comm" +#define SNDST_DSPS_SOUND4_CHAN_INTR "interrupts" +#define SNDST_DSPS_SOUND4_CHAN_FEEDCNT "feedcount" +#define SNDST_DSPS_SOUND4_CHAN_XRUNS "xruns" +#define SNDST_DSPS_SOUND4_CHAN_LEFTVOL "left_volume" +#define SNDST_DSPS_SOUND4_CHAN_RIGHTVOL "right_volume" +#define SNDST_DSPS_SOUND4_CHAN_HWBUF_FORMAT "hwbuf_format" +#define SNDST_DSPS_SOUND4_CHAN_HWBUF_SIZE "hwbuf_size" +#define SNDST_DSPS_SOUND4_CHAN_HWBUF_BLKSZ "hwbuf_blksz" +#define SNDST_DSPS_SOUND4_CHAN_HWBUF_BLKCNT "hwbuf_blkcnt" +#define SNDST_DSPS_SOUND4_CHAN_HWBUF_FREE "hwbuf_free" +#define SNDST_DSPS_SOUND4_CHAN_HWBUF_READY "hwbuf_ready" +#define SNDST_DSPS_SOUND4_CHAN_SWBUF_FORMAT "swbuf_format" +#define SNDST_DSPS_SOUND4_CHAN_SWBUF_SIZE "swbuf_size" +#define SNDST_DSPS_SOUND4_CHAN_SWBUF_BLKSZ "swbuf_blksz" +#define SNDST_DSPS_SOUND4_CHAN_SWBUF_BLKCNT "swbuf_blkcnt" +#define SNDST_DSPS_SOUND4_CHAN_SWBUF_FREE "swbuf_free" +#define SNDST_DSPS_SOUND4_CHAN_SWBUF_READY "swbuf_ready" +#define SNDST_DSPS_SOUND4_CHAN_FEEDERCHAIN "feederchain" /* * Maximum user-specified nvlist buffer size From nobody Sun Jun 9 16:10: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 4Vy0KV5Q6Bz5MP7q; Sun, 09 Jun 2024 16:10: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 4Vy0KV4x6Mz4Srv; Sun, 9 Jun 2024 16:10:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717949454; 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=PiBwCeSmalMrEAaGyvk7/cpzJ4D8zAv8hpYa+p7eG3g=; b=iQz4IYD0QdfeumPn/XSI7ZLnpLsnhpSn5CWojArN063MW8B03N54u4ouQvZ1Ig5y0CfOcM h/HlzQ+2wZj6Dk5lkG6Ighr5ERrilTWlcGgFtTrT80jdo0XVOYCuaUUGE7r+gWRldHzSD+ 5kHVT9H5K0WPTPgNX5AYotOnSHvQG2ik11b8Qsndmo7baGNlU1+GEddZ+Ygk+gZJwi64ua uvyXXZ5f+zEKz56dkxhTQX1yoPfp1fD9G//2F9P3aeNeON8VDr3qXsYtI0Z1H316MPup5T a1DXjCDwh37J+C+oWEu+II5YbA7FY+aqcLUp086sWGBfUng0YffZy39XsFOWTQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717949454; a=rsa-sha256; cv=none; b=KGdaO232Op8SAofcCc9pjC2wO80ScvbDT6zSZ4DutN0w8oq8PG/v9KG5yQGt3lILAzd4jD DhNv0la5WvdxbkcKE0I6K6BFaHSVEd977QF3+alZyU8O+pIAqGstDNU9PCDPAyXPMJ8eRs WLyrqesWzPkUkTCOLHE28Alw3lvOVWvQHO09VywNnaJUhygvYpM3sK+g77T/yulR2SNNTc 65ayId5UjHKfH3DvV+L8bG59MmYIcWFGi5wYw7FhJtjoD+shwKqcGkq2eh8s0gFhqEoPGo yA3SN63wWrbpAbCVKdYZLR6IyQAPD3FR188DhaSB8zcCrQlM0pjirsyru3ZwLg== 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=1717949454; 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=PiBwCeSmalMrEAaGyvk7/cpzJ4D8zAv8hpYa+p7eG3g=; b=QQoolwjPl/JjiZCmoARy0+fEd7Djxwi8mSrgGp8oPnqg2HFwPQi8de4UIS/o8RreIlen87 tfZQ5/t4DuPmvL987eMGvM5qr4EWPVHtiBbUSaekCl0TPxYTTg5yqu1PGcRl3TnprlAJBr xaGVvtzDdCnDMwTDsVc+ByKNBrw0quDcfHirEy8V5Ch55f5Gm4lhWL7+Ddn53tSkCGwAVZ RgeqosFHgrkYb3qgsspXi89Zp/i7RFdRxpQbto0HKnZ5QbDjTlUndZP8JMrbGWccMsSwJA D7UZ8NVfmZsY14f3O/Pa4cwCnBIQdsL6VcgcVruj/ynoRxKiQ+S7r1V1CiF9wA== 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 4Vy0KV4WnRzpmj; Sun, 9 Jun 2024 16:10: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 459GAsj7083122; Sun, 9 Jun 2024 16:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 459GAsHx083105; Sun, 9 Jun 2024 16:10:54 GMT (envelope-from git) Date: Sun, 9 Jun 2024 16:10:54 GMT Message-Id: <202406091610.459GAsHx083105@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: 6c5ee6e55a35 - main - simd(7): add missing aarch64 SIMD functions List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c5ee6e55a35421248f914c4b00dc9ed555262fe Auto-Submitted: auto-generated The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=6c5ee6e55a35421248f914c4b00dc9ed555262fe commit 6c5ee6e55a35421248f914c4b00dc9ed555262fe Author: Getz Mikalsen AuthorDate: 2024-06-07 11:36:57 +0000 Commit: Robert Clausecker CommitDate: 2024-06-09 16:09:44 +0000 simd(7): add missing aarch64 SIMD functions Some of the string functions in contrib/arm-optimized routines are SIMD enhanced which is not reflect on the simd(7) manpage. This commit addresses that and introduces a new label A for functions enhanced with the Arm ASIMD (Neon) extension. Approved by: emaste Reviewed by: fuz (GSoC mentor) MFC to: stable/14 Sponsored by: Google LLC (GSoC 2024) Differential Revision: https://reviews.freebsd.org/D45523 --- share/man/man7/simd.7 | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/share/man/man7/simd.7 b/share/man/man7/simd.7 index fd9485524aef..877bc77adf4b 100644 --- a/share/man/man7/simd.7 +++ b/share/man/man7/simd.7 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE . -.Dd December 6, 2023 +.Dd June 7, 2024 .Dt SIMD 7 .Os .Sh NAME @@ -55,33 +55,33 @@ Enhanced functions are present for the following architectures: .It bcopy Ta Ta S Ta S Ta S Ta SV .It bzero Ta Ta S Ta S Ta S .It div Ta Ta Ta S Ta S -.It index Ta S Ta Ta S1 +.It index Ta A Ta Ta S1 .It ldiv Ta Ta Ta S Ta S .It lldiv Ta Ta Ta S -.It memchr Ta S Ta Ta S1 -.It memcmp Ta S Ta S Ta S1 Ta S +.It memchr Ta A Ta Ta S1 +.It memcmp Ta A Ta S Ta S1 Ta S .It memccpy Ta Ta Ta S1 .It memcpy Ta S Ta S Ta S Ta S Ta SV .It memmove Ta S Ta S Ta S Ta S Ta SV -.It memrchr Ta Ta Ta S1 -.It memset Ta S Ta S Ta S Ta S -.It rindex Ta S Ta Ta S1 Ta S -.It stpcpy Ta S Ta Ta S1 +.It memrchr Ta A Ta Ta S1 +.It memset Ta A Ta S Ta S Ta S +.It rindex Ta A Ta Ta S1 Ta S +.It stpcpy Ta A Ta Ta S1 .It stpncpy Ta Ta Ta S1 .It strcat Ta Ta Ta S1 Ta S -.It strchr Ta S Ta Ta S1 Ta S -.It strchrnul Ta S Ta Ta S1 +.It strchr Ta A Ta Ta S1 Ta S +.It strchrnul Ta A Ta Ta S1 .It strcmp Ta S Ta S Ta S1 Ta S -.It strcpy Ta S Ta Ta S1 Ta S Ta S2 +.It strcpy Ta A Ta Ta S1 Ta S Ta S2 .It strcspn Ta Ta Ta S2 .It strlcat Ta Ta Ta S1 .It strlcpy Ta Ta Ta S1 -.It strlen Ta S Ta S Ta S1 +.It strlen Ta A Ta S Ta S1 .It strncat Ta Ta Ta S1 .It strncmp Ta S Ta S Ta S1 Ta S .It strncpy Ta Ta Ta S1 Ta Ta S2 -.It strnlen Ta S Ta Ta S1 -.It strrchr Ta S Ta Ta S1 Ta S +.It strnlen Ta A Ta Ta S1 +.It strrchr Ta A Ta Ta S1 Ta S .It strpbrk Ta Ta Ta S2 .It strsep Ta Ta Ta S2 .It strspn Ta Ta Ta S2 @@ -100,7 +100,8 @@ Enhanced functions are present for the following architectures: or PowerPC\ 2.05, .Sy 3 Ns :\ x86-64-v3, .Sy 4 Ns :\ x86-64-v4, -.Sy V Ns :\ PowerPC\ VSX. +.Sy V Ns :\ PowerPC\ VSX, +.Sy A Ns :\ Arm\ ASIMD (NEON). . .Sh ENVIRONMENT .Bl -tag