From patchwork Thu Mar 19 21:17:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: David Woodhouse X-Patchwork-Id: 11448101 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA0126CA for ; Thu, 19 Mar 2020 21:19:33 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C456A20658 for ; Thu, 19 Mar 2020 21:19:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="etN2EE4q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C456A20658 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jF2YJ-0001KV-4F; Thu, 19 Mar 2020 21:18:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jF2YI-0001KQ-GS for xen-devel@lists.xenproject.org; Thu, 19 Mar 2020 21:18:06 +0000 X-Inumbo-ID: 1c3d33b4-6a27-11ea-a6c1-bc764e2007e4 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1c3d33b4-6a27-11ea-a6c1-bc764e2007e4; Thu, 19 Mar 2020 21:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Mime-Version:Content-Type:Date:Cc:To: From:Subject:Message-ID:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=j0hS251DWulDP3cGUfWd69jeK1r3CuCfHlcrbmIMc4Y=; b=etN2EE4qlSDRitdtOvWB4z+kZF 1/pU/QYXasWkxPR/M/zkL66kIRkXendm2dDCxCWOGezifaocqZhaWGZbRGsPVZrHgJojT6K8bcpqB X64PGJ6slSCimGJcRfCKh8T/N8uEKG3auGGexxtLmsG3SGuRj59sQ654FrEy8Qih9jV9EFexV0Ksj J8v8UrNyh/ngbWwkorvX6gzy1TUj/L2uGAlTPqIdASf/fwu5QHF7dU64j7Zv1LU+Iw1YXn0lb+xcI LgwcO4iNA87oMTJoH8N1SOtFAy9tvUKJgVq8FokArcgEE05YIYKJATIc9iGIE/Tw4PHCzcjQHmcBB bR/87LFQ==; Received: from [54.239.6.185] (helo=u3832b3a9db3152.ant.amazon.com) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jF2Y6-0000jf-CC; Thu, 19 Mar 2020 21:17:54 +0000 Message-ID: <759b48cc361af1136e3cf1658f3dcb1d2937db9c.camel@infradead.org> From: David Woodhouse To: xen-devel Date: Thu, 19 Mar 2020 21:17:51 +0000 X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [PATCH 0/2] Handle X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , "Xia, Hongyan" , Jan Beulich , Volodymyr Babchuk , Roger Pau =?iso-8859-1?q?Mo?= =?iso-8859-1?q?nn=E9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" There are cases where pages can get freed with free_heap_pages() when in fact they were never properly initialised in the heap — they may have been allocated from the boot allocator, simply assigned directly to dom0 as part of its initrd, etc. We have plans to make vmap available during early boot, which would exacerbate this situation a tiny bit more, as a few more page tables would stand a small chance of being allocated by the boot allocator and freed later. Resolve this by introducing a new page state, PGC_state_uninitialised, expanding the PGC_state to 3 bits (8 possible values) by subsuming the PGC_broken bit into it and eliminating the redundant possible combinations of PGC_broken and various states. Pages which find their way into free_heap_pages() while still in PGC_state_uninitialised can thus be detected and properly rehabilitated, basically by passing them through init_heap_pages(). David Woodhouse (2): xen/mm: fold PGC_broken into PGC_state bits xen/mm: Introduce PGC_state_uninitialised xen/arch/x86/domctl.c | 2 +- xen/arch/x86/mm.c | 3 +- xen/common/page_alloc.c | 110 +++++++++++++++++++++++++++++------------------ xen/include/asm-arm/mm.h | 39 +++++++++++------ xen/include/asm-x86/mm.h | 37 +++++++++++----- 5 files changed, 125 insertions(+), 66 deletions(-)