Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5108779imu; Sun, 25 Nov 2018 17:02:46 -0800 (PST) X-Google-Smtp-Source: AJdET5cPDQq/pgKJTt9Oy+AfAQ3y2cVMZYexCPLEM9unDiRMEBqSKuG56qNTMbWLZuyQ0utwzaF0 X-Received: by 2002:a63:2109:: with SMTP id h9mr22455060pgh.277.1543194166047; Sun, 25 Nov 2018 17:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543194166; cv=none; d=google.com; s=arc-20160816; b=z00RaccEDqOsSaEX2yVZ+Dh6aHvbH6+dzQeF9cA+XI3uklukU8l7YA+ZaNlUwhDIf8 gdKOdZf9JkmaDkhDWroigMHlFMc5TJlv6Dp0b96R3FjZgNLEapSeO/yB0xq0XYvtiWYm 0WIoM5ILw2TJObuYOQ7TDhV+nOqi6wRJqs9EfiNhmybpCDcJFex92nnqm4z0nXFXvHHF DPDDPu9fG6uE9TeQFJ1ho7ND/fQKQzqx3ni274dLXNwnCGOFYhS0zDeNLmmFxNnmEKz2 FBEWuctQrKcnFyJ/YTtkiLr8u9GVK5aZ+VbN7BSd+ufjDr99+QTMP/HQ95u3BQbzhtjI PwiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=w/pn9iWBhok+q9uTPj/MeVSqeUDCZ5Fr4Jndds1+oNg=; b=IaUqMBV1IJbai53Bw7gizIrElOhG375/PDlkL64xNHseT8GU8F4Hy+dAGE/IpUMTYH uJhM56BTezpBUHKo39CETaNpMb7BEEvnlWR6TLhBuiisagOge5u9oXgTj3s74beNDsF5 tey2Tqzyolpv+t8B4aqTikp8U52P9+Y2fs3Tow/72DF9EFdgzxB4dfnFAx3gb6vbnADL Ql57XEuwJFbRFaMR1v4tdxn4I2yj+w4TiSWriVKyroVg/kyi2BRo3B0bvdY0Cg24GlGQ PqpWDqrWT2kE5yvM7VRpV/WlNNDxH3p2li0xiTvFsJ3B96P5LGRO+Ar1w335o7ZW7QKA vNag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n34si28813785pld.381.2018.11.25.17.02.28; Sun, 25 Nov 2018 17:02:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726135AbeKZLwu (ORCPT + 99 others); Mon, 26 Nov 2018 06:52:50 -0500 Received: from smtp03.citrix.com ([162.221.156.55]:62255 "EHLO SMTP03.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbeKZLwu (ORCPT ); Mon, 26 Nov 2018 06:52:50 -0500 X-IronPort-AV: E=Sophos;i="5.56,280,1539648000"; d="scan'208";a="71436163" Subject: Re: [Xen-devel] [PATCH v3] xen/balloon: Mark unallocated host memory as UNUSABLE To: Boris Ostrovsky , , CC: , , , References: <1513778746-6155-1-git-send-email-boris.ostrovsky@oracle.com> From: Igor Druzhinin Message-ID: <7c833e3a-4a0b-e80c-91e2-4348d6959651@citrix.com> Date: Mon, 26 Nov 2018 01:00:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <1513778746-6155-1-git-send-email-boris.ostrovsky@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/12/2017 14:05, Boris Ostrovsky wrote: > Commit f5775e0b6116 ("x86/xen: discard RAM regions above the maximum > reservation") left host memory not assigned to dom0 as available for > memory hotplug. > > Unfortunately this also meant that those regions could be used by > others. Specifically, commit fa564ad96366 ("x86/PCI: Enable a 64bit BAR > on AMD Family 15h (Models 00-1f, 30-3f, 60-7f)") may try to map those > addresses as MMIO. > > To prevent this mark unallocated host memory as E820_TYPE_UNUSABLE (thus > effectively reverting f5775e0b6116) and keep track of that region as > a hostmem resource that can be used for the hotplug. > > Signed-off-by: Boris Ostrovsky This commit breaks Xen balloon memory hotplug for us in Dom0 with "hoplug_unpopulated" set to 1. The issue is that the common kernel memory onlining procedures require "System RAM" resource to be 1-st level. That means by inserting it under "Unusable memory" as the commit above does (intentionally or not) we make it 2-nd level and break memory onlining. There are multiple ways to fix it depending on what was the intention of original commit and what exactly it tried to workaround. It seems it does several things at once: 1) Marks non-Dom0 host memory "Unusable memory" in resource tree. 2) Keeps track of all the areas safe for hotplug in Dom0 3) Changes allocation algorithms itself in balloon driver to use those areas Are all the things above necessary to cover the issue in fa564ad96366 ("x86/PCI: Enable a 64bit BAR on AMD Family 15h (Models 00-1f, 30-3f, 60-7f)")? Can we remove "Unusable memory" resources as soon as we finished booting? Is removing on-demand is preferable over "shoot them all" in that case? Does it even make sense to remove the 1-st level only restriction in kernel/resource.c ? Igor