From nobody Wed Aug 10 22:59:32 2022 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 4M353p5dzdz4Z1Zc; Wed, 10 Aug 2022 22:59:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M353p57xBz3K9K; Wed, 10 Aug 2022 22:59:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660172374; 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: in-reply-to:in-reply-to:references:references; bh=C7MQjwKSEAreNum7YevJNdu6lvA/3srQNCNrKRgZk48=; b=hycF4RJ9H68p53NpB58z06Nei/NsUSO+qVyo5kZIYpJNDUTzqqLakm2zui0pJTnW/7g7aI 1PlZWeIiuTfI3pgkMC4znhQY0mIy1DHgfHBpIh2H2+ATGhdRyWYuMWcuwBps7AhDVnJTBs ApMkm7Iy0qoF+dQPlFrWHgqnmlBx2zBL/q6jbwMCzlmPzgYnVZsnIVsn7iCuilqjABxYmc RW3tScK7La+fC+4o4wHIeNRienlsf/jGLnJUEdYt8zZbXNMVjBsWgmLWW8ziq8MurRNhFK aH/hv8uMgoftZ1+2qyKMY8x4HuD6yBKBS1yLKyaYIa+sm+qTpbnm2SVK62AmMg== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4M353p0FtTzfBk; Wed, 10 Aug 2022 22:59:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <3d8fcc58-f226-307e-72f6-7a625b62e2d4@FreeBSD.org> Date: Wed, 10 Aug 2022 15:59:32 -0700 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: Andrew Turner , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202207190957.26J9voj4012964@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: 36f1526a598c - main - Add experimental 16k page support on arm64 In-Reply-To: <202207190957.26J9voj4012964@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660172374; 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: in-reply-to:in-reply-to:references:references; bh=C7MQjwKSEAreNum7YevJNdu6lvA/3srQNCNrKRgZk48=; b=u0bVg9QphwL14486ozk/lXVeQ4vn3IcABkX+IepR4Et5HMIEjLJwX5VL6+rpavcEmHbNj2 nPE05iVyK4Su9lIFDDpDO6s3mPsVWJlG/4L8429GV6KAeJoxQsbOygq3zJN7gYQpN12mm/ uJWXsQnyi0rgISGCG8KXjL6e+aJWMJ9IBtnyxRwX39/B3j67zBuWeJ9kqZRoPixC58FUTo qUg7iSG+XGUKwwovf0H+g71i7SmLBjRDQEdO3p4eVWyqXRNELmGAlz3gl4G89WyREdeta3 JsoMuEFT/43sCAe0RhsGIVfAI7S6uTfsLmpx0UMlIQT1Rm9mkyBjOXtrZxlR9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660172374; a=rsa-sha256; cv=none; b=B/BW1qvHrNaMASeqo5d5heVhhLntyGldqVSmpqVh+HTwVgFsxL3OHAPecqjB+uZh6O4t4u MBjzgkVb1zarfg/kmTPI4oJbCZVvaqDCs149L3sRJFJ8D3UqfA45naFV5J7HO3phfqQFmX W2Gkkh0qP07ZlQ9gR2m6wx1z69ddgormv+fkCtMFE7WCB7gL9YxBzrbHckiqCfxcOovbYv sSRRIIF7SeqGiE7YALyLtZbURdcUFHWMZo2jS//96mdoue8xnDagXtthEMWJy/jUldKuBj CFDME4iauhAJrrR+XnnvcIVe7x19sx56kVKe0bXS+28gtfcjKgTV8vZNbVsK3g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 7/19/22 2:57 AM, Andrew Turner wrote: > The branch main has been updated by andrew: > > URL: https://cgit.FreeBSD.org/src/commit/?id=36f1526a598c373ca660910c9772d28a61383c3b > > commit 36f1526a598c373ca660910c9772d28a61383c3b > Author: Andrew Turner > AuthorDate: 2022-03-23 17:39:58 +0000 > Commit: Andrew Turner > CommitDate: 2022-07-19 09:57:03 +0000 > > Add experimental 16k page support on arm64 > > Add initial 16k page support on arm64. It is considered experimental, > with no guarantee of compatibility with a userspace or kernel modules > built with the current a 4k page size as code will likely try to pass > in a too small size when working with APIs that take a multiple of a > page, e.g. mmap. > > As this is experimental, and because userspace and the kernel need to > have the PAGE_SIZE macro kept in sync there is no kernel option to > enable this. To test a new image should be built with the > PAGE_{SIZE,SHIFT,MASK} macros changed to the 16k versions. > > There are currently known issues with loading modules from an old > loader as it can misalign them to load on a non-16k boundary. > > Testing has shown good results in kernel workloads that allocate and > free large amounts of memory as only a quarter of the number of calls > into the VM subsystem are needed in the best case. > > Reviewed by: markj > Tested by: gallatin > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D34793 While merging this into CheriBSD (which has somewhat similar but conflicting set of PV entry changes due to a different set of constants for PV entries) it seems you did not correctly update places that check if a PV entry chunk is full. For example, in get_pv_entry: if (field < _NPCM) { pv = &pc->pc_pventry[field * 64 + bit]; pc->pc_map[field] &= ~(1ul << bit); /* If this was the last item, move it to tail */ => if (pc->pc_map[0] == 0 && pc->pc_map[1] == 0 && => pc->pc_map[2] == 0) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); TAILQ_INSERT_TAIL(&pmap->pm_pvchunk, pc, pc_list); } PV_STAT(atomic_add_long(&pv_entry_count, 1)); PV_STAT(atomic_subtract_int(&pv_entry_spare, 1)); return (pv); That should presumably be comparing the entire pc_map[] to zero? (There are two similar checks in pmap_pv_demote_l2 as well, one in a KASSERT) I would suggest perhaps allocating a separate pc_fullmask[] array and a PC_IS_FULL() wrapper that uses memcmp. Btw, given that the compiler can inline memcmp against fixed-size const arrays, it seems like you could just use the memcmp() version for PC_IS_FREE always and avoid the #ifdef there. -- John Baldwin