NetBSD Problem Report #55325

From www@netbsd.org  Sun May 31 11:22:25 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 5DA011A9218
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 31 May 2020 11:22:25 +0000 (UTC)
Message-Id: <20200531112224.3D2FB1A921A@mollari.NetBSD.org>
Date: Sun, 31 May 2020 11:22:24 +0000 (UTC)
From: rokuyama.rk@gmail.com
Reply-To: rokuyama.rk@gmail.com
To: gnats-bugs@NetBSD.org
Subject: oea/pmap: inconsistency in usage of two PVO pools
X-Send-Pr-Version: www-1.0

>Number:         55325
>Category:       port-powerpc
>Synopsis:       oea/pmap: inconsistency in usage of two PVO pools
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun May 31 11:25:00 +0000 2020
>Originator:     Rin Okuyama
>Release:        9.99.64
>Organization:
Department of Physics, Meiji University
>Environment:
NetBSD macmini 9.99.64 NetBSD 9.99.64 (GENERIC) #65: Sun May 31 01:11:41 JST 2020  rin@latipes:/usr/src/sys/arch/macppc/compile/GENERIC macppc
>Description:
In powerpc/oea/pmap.c, there are two pools of PVO:
- pmap_upvo_pool for PVO entries for unmanaged pages
- pmap_mpvo_pool for PVO entries for managed pages

At the moment, we determine to which pool freed PVO is put back by
PVO_MANAGED flag. However, this is *wrong* when PVO is obtained by
pmap_pvo_reclaim(). That is, PVO for unmanaged pages can be reclaimed
from pool for managed, and vice versa.
>How-To-Repeat:
Enable DIAGNOSTIC, and put a system in heavy memory pressure, like

$ cd /usr/pkgsrc/devel/gcc10 && make MAKE_JOBS=2

Then, the system crashes for a while as:

panic: pr_phinpage_check: [pmap_upvopl] item 0xf619c0 poolid 36 != 1
>Fix:
Although I'm not sure whether this is a correct fix or not, but this
patch seems to fix a problem:

http://www.netbsd.org/~rin/oea_pmap_20200531.patch

Here, I introduced a new flag that represents from which pool PVO is
obtained:

#define PVO_POOL_MANAGED        0x0080
#define PVO_POOL_MANAGED_P(pvo) ((pvo)->pvo_vaddr & PVO_POOL_MANAGED)

Then, use this flag instead of PVO_MANAGED to determine to which pool
we should pool_put(9) into.

Alternatively, we can reclaim PVO from the same pool in
pmap_pvo_reclaim(). However, this attempt fails for me, by ended up in:

panic: pmap_pvo_enter: failed

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.