NetBSD Problem Report #60971

From www@netbsd.org  Fri Nov  6 10:58:44 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6A09E1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  6 Nov 2026 10:58:44 +0000 (UTC)
Message-Id: <20261106105842.A5ED61A923C@mollari.NetBSD.org>
Date: Fri,  6 Nov 2026 10:58:42 +0000 (UTC)
From: rokuyama.rk@gmail.com
Reply-To: rokuyama.rk@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Severe KVA starvation with 512MB physical memory
X-Send-Pr-Version: www-1.0
X-From4GNATS: "rokuyama.rk@gmail.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60971
>Category:       port-sparc
>Synopsis:       Severe KVA starvation with 512MB physical memory
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    port-sparc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 06 11:00:00 +0000 2026
>Originator:     Rin Okuyama
>Release:        11.99.9
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD ss10 11.99.9 NetBSD 11.99.9 (SS10) #28: Sun Nov  1 10:39:39 JST 2026  rin@sakaizumii.local:/home/rin/src/sys/arch/sparc/compile/SS10 sparc sparc
>Description:
On my SS10 with 512MB memory, system can be easily unresponsive
when running ATF or building pkgsrc. When this happens, I can
only enter DDB from console. Then, I observe some processes
stall indefinitely at uarea or vm_map.

This should be ascribable to KVA starvation; even though system
has 512MB physical memory, there is only 224MB of KVA space
(0xf0000000 to 0xfe000000). So, KVA is easily exhausted by buffer
cache and etc..

As a PoC, I tried to extend KVA to ~ 2GB: 0x80000000 to 0xfe000000.
Then, system becomes very stable; it survives full ATF run, and
can build many pkgsrc's without problems as far as I can see.

The patch I used is provided here:

https://www.netbsd.org/~rin/sparc-extend-kva-20261106-1.patch

In this patch:

(1) EKVA{,.MP} kernels are introduced for sun4m and sun4d, where
    VM_MIN_KERNEL_ADDRESS is changed to 0x80000000. Bottom of
    kernel text VA is also changed to 0x80004000. (Probably,
    224MB of KVA space is enough for sun4/sun4c machines, IIUC.)

(2) For boot loader, let PROM map 2.25MB, instead of 0.5MB, of
    memory in additional to kernel image for sun4m/sun4d. This is
    necessary to construct kernel page table for ~ 2GB KVA space.

Even though EKVA kernel works just fine for me, there remain
concerns for me:

(a) This requires specific kernels other than GENERIC{,.MP}.

(b) Boot loader maps more memory for sun4m/sun4d. This should be
    not a big problem for usual sun4m/sun4d machines. However,
    IIUC, some models of JavaStation was shipped with only 8MB
    memory.

(c) User VA space is restricted to 2GB on EKVA{,.MP} kernels.
    However, even NetBSD/armv7 has also 2GB UVA space.

Thoughts? Are there more acceptable solutions?
>How-To-Repeat:
Described above.
>Fix:
PoC provided above.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.