From nobody Tue Sep 16 16:05:34 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 4cR6FB4pVvz67W08; Tue, 16 Sep 2025 16:05: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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cR6FB4B1Xz3vPL; Tue, 16 Sep 2025 16:05:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758038734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KCEY6CMUeWlFoF94Cna2c9/Vv3MNifG5Fljj2gIBUUs=; b=V06nEyBhiT+CnnS38i5JZM6AqfSvDtKPhMfJ3CQNk228L+z5z+7D3jCeKM3i1GStIsIS8q 4mEf/1CT+1klFz9f9F4wExDHTR/L5iTZbunkGb1ACvsVSLaXGpSaB06NUmjRLNKIQM/GQk TPLXkd/es3EqS+A1rr6RArVM35gQlPE8bGCtLvaYZ0lBR3dmaZoR+G1+u3xH/JrskcjeO7 pTbFHvTjnvrRYB7HTnHbEDkaGyQRwHVlZmINW9BHiAUrak4t5hRFA3Qdf3ZzRdESHpYbVK jPN49JevQAXvJOB+h5Vxa/zg+O5lVdQnhOBtyHCZslLoCmq866WUA3KLK0Ps9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758038734; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KCEY6CMUeWlFoF94Cna2c9/Vv3MNifG5Fljj2gIBUUs=; b=eTcAq5L4N1zl7jnkdNq+/Kqn2K9DVKgS0dVpBzi07JVVUz8azheMBJczN7AQyGvIIrLwRY voytRBd8IEbPVkv9LeTNDHcixUhD8Q5DjveK7A2j1TGcCQgvpDbop6z5tRIkck6F88VcNa VoGwI6uGDrOPQ9OqZACB7YAEUA/toX9DdYUK5XdWOr3FfgHzg/dMW/DyP+wSJYE/gkojIT yPrdn3lINLFBWjCbVYh2x25XpEcYHx4mfZqjcR743vpdDIAWzHEG5ivN2XK8PM33nC8hHm Xcu1Pf4BRgN3LEiAGdfCmdz4tZL7bjwdDdIkiwXLqzQF/26U1HLfCu6WbTJhPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758038734; a=rsa-sha256; cv=none; b=XRk4Pc8/Y3bk+2VaQ7/qkIi03h4CTCzZzyqvyw02MZdDVXJBrdT6h7q2dx7Th6SvoiEoK9 nCUzoCV9D/zbVxhlItM27mdKW5nzxkFK5vZyYGCpmHRXm/WjSmlmYOAiO9EMcKQKoqFg0/ zMEqhv5hkPF0kr69VX47w0FyN+HudJhItGFH7CtFVCcrJ17BRZ3PscYmaN21md7SgUd7Um hjo0jLcQVIKZwDrxESOhH0TALWOWsHj2V1ACSj0/+uEwMhhYRA3Br9vTnh4scGcfGjLB0C yjbIbsj/y+k8rBfkorpw9AKfjtDOZMrOO6BMSsGCgTugm39EOVSaBrMN3MDa3g== 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 4cR6FB2xpMzngq; Tue, 16 Sep 2025 16:05:34 +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 58GG5YtF009514; Tue, 16 Sep 2025 16:05:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58GG5Y8I009511; Tue, 16 Sep 2025 16:05:34 GMT (envelope-from git) Date: Tue, 16 Sep 2025 16:05:34 GMT Message-Id: <202509161605.58GG5Y8I009511@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: 22cce201da76 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 22cce201da76a1916be5c993201f0478f3048292 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=22cce201da76a1916be5c993201f0478f3048292 commit 22cce201da76a1916be5c993201f0478f3048292 Author: Konstantin Belousov AuthorDate: 2025-09-16 03:41:55 +0000 Commit: Konstantin Belousov CommitDate: 2025-09-16 16:05:24 +0000 vm/vm_fault.c: update and split comments for vm_fault() and vm_fault_trap() Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differrential revision: https://reviews.freebsd.org/D52567 --- 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 524aed2be2ff..2e150b368d71 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -708,21 +708,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, @@ -1626,6 +1623,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)