From nobody Tue Sep 23 00:41:47 2025 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 4cW1Q40sPpz67mNK; Tue, 23 Sep 2025 00:41: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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cW1Q409Cxz3w6S; Tue, 23 Sep 2025 00:41:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758588108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tceWgFX2Mz8fInTjWJEks6kFR5Mhm2gBcWmKxSziSp0=; b=nMY7WNPy4LEv4QDDUHdkyzuVGkdCXibszdpl/Fj3D+8stAjw4lrqeEkzM4ZuvrHG5aft5H Q2Z+co1n2LLI21MmFN3WQKvhu5BHtOR4vaBUrHdlFdtKzaIWBzPqy9uGCnVqa5/ZcUbqDN MvyvZwy6fd3yDF2HNCpib2IlcvFgB5MhEjtQPKnTVBOe54WgbdVHue1O/wjobx7bgJOwWl UzrPrtASxqkgo5jPR4hk5dlRUUOeGnPphiAcOo4qownqNCEXulIU1BfThzKP2cKYyr6l46 BaQNfEcKgTZdRdHzhFYMcphRqPZL7Ke7tuDuA3/lpSu+Lr8mg6viJdKPLavjmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758588108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=tceWgFX2Mz8fInTjWJEks6kFR5Mhm2gBcWmKxSziSp0=; b=Dz1sjTKFtz6A9PSgpqeuxdZZi/uysOSExL7//rU2okqR1oK8+h4Lw2xyt29asIgC0sJiqf z1ls13VjJiAmjxn04WnRmzppvaIyWusEaWNK9wbxCOjShB8nVVypHWdt43B5ZH+LWdupbT vRFqUP5x6U9dhwrXlpwn9CatLTwHZ6egLVYryPUb3MBuUKe9/ScxGVrecj29PKaeIsoAxg Jxfly+U43jwDqS1u0UFeIa93Wb0TjakWBVH0TuXy44ftMxbH+tEGqYIysl3q4fpIcoSBRd OhK3Yz0tdJm9JW345apKFE0Xqj+QDnc6IzgwRjsfH7cHCDQr0/ydDU1av/5bXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758588108; a=rsa-sha256; cv=none; b=sdHcc/5NHmAAcxGK9qhRGkK7dkhE3FV8q5YKIMbPwAlAh8D+TXnJB9czyZAYVvF1F5JLa2 4rROgf9ky/yiaRN8IxEjElJhNUoHGEVeQG9WSF/Att4b5dHifsWablam5gEDcN1WYRzWRR Fsnrn9wOKgSDpgyvOfRsjVy/BIoOBnjzfzoeLxtdQSVXasc6XVI/XIwS0+lZn3gNF/5GSY Gjo/SJyAxDSU9AUILokgVw3fJ3VWlPVbfVyS/PzM158em7ne67yNCZZuV2kdwN9rtOUc/N uj8r+1v8TTNe0JMjxW8SdshWAYXHgibYTVT//kZpqcUoixrpRCwQY29b6T/aCA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cW1Q367LHz7XG; Tue, 23 Sep 2025 00:41:47 +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 58N0flVX021153; Tue, 23 Sep 2025 00:41:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58N0flfv021150; Tue, 23 Sep 2025 00:41:47 GMT (envelope-from git) Date: Tue, 23 Sep 2025 00:41:47 GMT Message-Id: <202509230041.58N0flfv021150@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 4e0d2f1566b3 - stable/14 - vm/vm_fault.c: update and split comments for vm_fault() and vm_fault_trap() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 4e0d2f1566b3b588908a098c3ee672a202978a15 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4e0d2f1566b3b588908a098c3ee672a202978a15 commit 4e0d2f1566b3b588908a098c3ee672a202978a15 Author: Konstantin Belousov AuthorDate: 2025-09-16 03:41:55 +0000 Commit: Konstantin Belousov CommitDate: 2025-09-23 00:41:21 +0000 vm/vm_fault.c: update and split comments for vm_fault() and vm_fault_trap() (cherry picked from commit 22cce201da76a1916be5c993201f0478f3048292) --- sys/vm/vm_fault.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index c8ace2b41345..3e4fe7bdae36 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -682,21 +682,18 @@ _Static_assert(UCODE_PAGEFLT == T_PAGEFLT, "T_PAGEFLT"); #endif /* - * vm_fault_trap: + * vm_fault_trap: * - * Handle a page fault occurring at the given address, - * requiring the given permissions, in the map specified. - * If successful, the page is inserted into the - * associated physical map. + * Helper for the page fault trap handlers, wrapping vm_fault(). + * Issues ktrace(2) tracepoints for the faults. * - * NOTE: the given address should be truncated to the - * proper page address. + * If a fault cannot be handled successfully by satisfying the + * required mapping, and the faulted instruction cannot be restarted, + * the signal number and si_code values are returned for trapsignal() + * to deliver. * - * KERN_SUCCESS is returned if the page fault is handled; otherwise, - * a standard error specifying why the fault is fatal is returned. - * - * The map in question must be referenced, and remains so. - * Caller may hold no locks. + * Returns Mach error codes, but callers should only check for + * KERN_SUCCESS. */ int vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, @@ -1532,6 +1529,27 @@ vm_fault_object(struct faultstate *fs, int *behindp, int *aheadp) return (res); } +/* + * vm_fault: + * + * Handle a page fault occurring at the given address, requiring the + * given permissions, in the map specified. If successful, the page + * is inserted into the associated physical map, and optionally + * referenced and returned in *m_hold. + * + * The given address should be truncated to the proper page address. + * + * KERN_SUCCESS is returned if the page fault is handled; otherwise, a + * Mach error specifying why the fault is fatal is returned. + * + * The map in question must be alive, either being the map for current + * process, or the owner process hold count incremented to prevent + * exit(). + * + * If the thread private TDP_NOFAULTING flag is set, any fault results + * in immediate protection failure. Otherwise the fault is processed, + * and caller may hold no locks. + */ int vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, vm_page_t *m_hold)