From nobody Tue Oct 15 17:25:15 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XSgwC5HqNz5YkxN; Tue, 15 Oct 2024 17:25: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSgwC3GlHz4V4Z; Tue, 15 Oct 2024 17:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729013115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SCaG2//T4UQTAQyeeUjVF+yK5mn/pLbRpPbT/VnPFoQ=; b=lxNU5pCPXnlUjOYU0jlcn+ggJN7No/PAD1h6nnlrOfS9be0TQgmibzld1NIbBXTbZkU/lF 53Oe4XxF9mxMztIVbOA6/lY6Qo/jJ+4OYqm4WACXb9IZlap0ycRXsZc1zt459m3J30XK0/ GY/LRmINpSE+6Ac6uvphRvWTYz22PmSLdCjU6XQo8P145UhQWVUwj9Fy6CxY6LGemPeSmI /OTelPvxG7/yQ04H7q8f7q+5jxLaItrhBsgFlRgTZ67W71D+VaTa4rxvDx+oz+jm8zBBNX 2T6ybPc+CVNUwsKkBzCgU5w/6uP9I9yh0l3nB/a8m3pTcWRtcZ3uL7/80Wuviw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729013115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SCaG2//T4UQTAQyeeUjVF+yK5mn/pLbRpPbT/VnPFoQ=; b=YfpHYKE7xTskFdGHX1LlO9nhEpHTq6ioSXVxIBwvfVMIRQKt+TlunXLnp3SDQDq7or9jVy BSnzwmyvE7uxbDZMGHddVsaqkQ7CIh/9DyDLjIbszcMmZlYwo+oHEUv9R7lf5DR0s4PEVq DsoUejCxCWvLlRknVy9fdEsaibJw0iNbU9WhvkVXA2RxPGeTe6jLt7J32qfWtkOlFFkD6X FmZCAZogevgwXyWL0eZizlrLuFyKlKLwngRkdUH0KkfOz4iJyZm+niG42Sa2Tj5HBpknBJ 7OUqgHopcx5RPtS19sonZDXLfegTSti7HEvL76z0KPYUDaWFd090vQ6oa0KkbA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729013115; a=rsa-sha256; cv=none; b=NYNfuXPr1OLZFhFwvIgmus9VU+uJjrndQIy5TSf+T8p67nyQ5ETt1qInawS3+0BrdWEO3g 2Ogta343dxCSBuuGVfhkN4fanbq1utWpmdenMhRMiiX0lXTnoEErU+GLJGX8F5d52b1bSn 8HbXnHSUVmPYxONqwdIGkc1Pn61zeYrRLLFiHkUSxgRGNH6oP4XB9FSSvS7hPq7Ug7fV/+ aARCUPJ2Qr9eHvRCqi2SLMmZ036sC7HmK7AMf0mTfirEmSWyVgGI+An64JSvUzbjydtLjM 4R4oYsLU9S9IGoSsxEWGK+0z/VXepU3/2ApOneSNUj5tOlKW/PPkmMBWwwl8ZA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XSgwC2sK7zW5Z; Tue, 15 Oct 2024 17:25:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49FHPFUt028056; Tue, 15 Oct 2024 17:25:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FHPFLo028053; Tue, 15 Oct 2024 17:25:15 GMT (envelope-from git) Date: Tue, 15 Oct 2024 17:25:15 GMT Message-Id: <202410151725.49FHPFLo028053@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: 54f23b015aa6 - main - arm64: Support pmap_fault with a locked pmap List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 54f23b015aa6b913fd51c1b5c16e09cc3778fcb8 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=54f23b015aa6b913fd51c1b5c16e09cc3778fcb8 commit 54f23b015aa6b913fd51c1b5c16e09cc3778fcb8 Author: Andrew Turner AuthorDate: 2024-10-14 14:35:56 +0000 Commit: Andrew Turner CommitDate: 2024-10-15 17:24:42 +0000 arm64: Support pmap_fault with a locked pmap When we get a data abort in an EFI runtime service the userspace pmap will be locked by the current thread. Skip trying to lock it again as it will be in a critical section and the lock may sleep. Reviewed by: markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D46813 --- sys/arm64/arm64/pmap.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 2c8f8b416a9e..10aa7f6bfb5c 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -9178,12 +9178,23 @@ pmap_fault(pmap_t pmap, uint64_t esr, uint64_t far) if (pmap_klookup(far, NULL)) rv = KERN_SUCCESS; } else { - PMAP_LOCK(pmap); + bool owned; + + /* + * In the EFIRT driver we lock the pmap before + * calling into the runtime service. As the lock + * is already owned by the current thread skip + * locking it again. + */ + owned = PMAP_OWNED(pmap); + if (!owned) + PMAP_LOCK(pmap); /* Ask the MMU to check the address. */ intr = intr_disable(); par = arm64_address_translate_s1e0r(far); intr_restore(intr); - PMAP_UNLOCK(pmap); + if (!owned) + PMAP_UNLOCK(pmap); /* * If the translation was successful, then we can