Module Name: src Committed By: martin Date: Thu Aug 22 19:28:40 UTC 2024
Modified Files: src/sys/uvm [netbsd-10]: uvm_map.c Log Message: Pull up following revision(s) (requested by rin in ticket #783): sys/uvm/uvm_map.c: revision 1.407 sys/uvm/uvm_map.c: revision 1.412 sys/uvm/uvm_map.c: revision 1.413 uvm_findspace(): For sh3, convert a KASSERTMSG(9) into printf(9) XXX Work around for PR kern/51254 until it gets fixed. With this change, landisk survives full ATF with DIAGNOSTIC enabled. uvm_map.c: Fix kassertmsg/printf newline mismatch in PR 51254 note. uvm_findspace_invariants: don't repeat the message three times The topdown and bottomup messages were exactly the same and sh3 printf hack added the third copy. Restructure the code so that there's only one message and make the message more obvious - the topdown condition in the assertions was confusing b/c it's inverted (!topdown || ... means it's the topdown map). PR 51254 To generate a diff of this commit: cvs rdiff -u -r1.403.2.1 -r1.403.2.2 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.403.2.1 src/sys/uvm/uvm_map.c:1.403.2.2 --- src/sys/uvm/uvm_map.c:1.403.2.1 Mon May 15 10:32:53 2023 +++ src/sys/uvm/uvm_map.c Thu Aug 22 19:28:40 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.403.2.1 2023/05/15 10:32:53 martin Exp $ */ +/* $NetBSD: uvm_map.c,v 1.403.2.2 2024/08/22 19:28:40 martin Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.403.2.1 2023/05/15 10:32:53 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.403.2.2 2024/08/22 19:28:40 martin Exp $"); #include "opt_ddb.h" #include "opt_pax.h" @@ -1784,19 +1784,28 @@ uvm_findspace_invariants(struct vm_map * vaddr_t hint, struct vm_map_entry *entry, int line) { const int topdown = map->flags & VM_MAP_TOPDOWN; + const int hint_location_ok = + topdown ? hint <= orig_hint + : hint >= orig_hint; + +#if !(defined(__sh3__) && defined(DIAGNOSTIC)) /* XXXRO: kern/51254 */ +#define UVM_FINDSPACE_KASSERTMSG KASSERTMSG + +#else /* sh3 && DIAGNOSTIC */ +/* like KASSERTMSG but make it not fatal */ +#define UVM_FINDSPACE_KASSERTMSG(e, msg, ...) \ + (__predict_true((e)) ? (void)0 : \ + printf(__KASSERTSTR msg "\n", \ + "weak diagnostic ", #e, \ + __FILE__, __LINE__, ## __VA_ARGS__)) +#endif - KASSERTMSG( topdown || hint >= orig_hint, - "map=%p hint=%#"PRIxVADDR" orig_hint=%#"PRIxVADDR - " length=%#"PRIxVSIZE" uobj=%p uoffset=%#llx align=%"PRIxVSIZE - " flags=%#x entry=%p (uvm_map_findspace line %d)", - map, hint, orig_hint, - length, uobj, (unsigned long long)uoffset, align, - flags, entry, line); - KASSERTMSG(!topdown || hint <= orig_hint, - "map=%p hint=%#"PRIxVADDR" orig_hint=%#"PRIxVADDR - " length=%#"PRIxVSIZE" uobj=%p uoffset=%#llx align=%"PRIxVSIZE + UVM_FINDSPACE_KASSERTMSG(hint_location_ok, + "%s map=%p hint=%#" PRIxVADDR " %s orig_hint=%#" PRIxVADDR + " length=%#" PRIxVSIZE " uobj=%p uoffset=%#llx align=%" PRIxVSIZE " flags=%#x entry=%p (uvm_map_findspace line %d)", - map, hint, orig_hint, + topdown ? "topdown" : "bottomup", + map, hint, topdown ? ">" : "<", orig_hint, length, uobj, (unsigned long long)uoffset, align, flags, entry, line); }