Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7047402ybi; Thu, 1 Aug 2019 02:24:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqxes9Br3WB1pX8lFdlMNmHkRGgzYCsbMAdj6NmDlTbeRlEUQTHWKaXfAaEubHuXay46gUZO X-Received: by 2002:a17:902:20e9:: with SMTP id v38mr28178020plg.62.1564651498791; Thu, 01 Aug 2019 02:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564651498; cv=none; d=google.com; s=arc-20160816; b=d75UPvW16R6Tu8sniB36RLrPF9SZXWTmAWCpe7R94vioUd5PUi3OJ6q6Ux75gcrlhE tV8ZfRsDTvYKSMawvy9neMeu1oD+25fq6XVhrSJA5xy6gq37MYBhSH9WrchRIpDHR3uJ 1ZzpF2MqveIsp8NOEXMViT3QvH+de3zBuIUC+NiWCCDV/IyZGI/ITme5MDp3vdULCoTy mmW6ALTmz2aBjxIIcX3OjbWvzLfqNjZ5NOzHh1dsMAysiPRYPvcu3tX08l8FXLhtcANw veqGx5h7BhUSLhD52z1Jy4bS6LtQnigNxxLfJn5TVjQXJl1MTuaB1IsjvtaxLjxHWtzh j4Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fKNHH0CDDSmVfLrPCQbfV+BLKRXM4ZY/KL6JtmFI14o=; b=n6p1sbp/mjEPdH0/80jiBvTBkJ5pBz6nfcZ0wlbenbOLA4vSjTJr7mTSPVEYBuOtnT VH1iSnXqlQqQ2UUgXoleRd4KhVYpS5acW84AbtsPue99EBY811hEbNbrT/wf6qlctqXn sbzhi7TN6j/YBmr2xDSpr2LfWvcSI0rzLACo5AR9j/JMbq/Zp/gJbUFH0ksQlCzFx4x7 1zoPOLgx5buGRyNAfWgXWEfyN/mdVO6gbRn/YDZ1tWNyIjmqLrFwbFlQjOsGMuNPe1kl +YFCnudRI8vQ3wRWSqS3vDk6hBJdJ662Wxdp/MSmok/OMQNy1aCSqyNTsWrE8/6IrxpF ka+w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21si31379395pll.169.2019.08.01.02.24.31; Thu, 01 Aug 2019 02:24:58 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729918AbfHAIEM (ORCPT + 99 others); Thu, 1 Aug 2019 04:04:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:41198 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728582AbfHAIEL (ORCPT ); Thu, 1 Aug 2019 04:04:11 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 468E0AC91; Thu, 1 Aug 2019 08:04:10 +0000 (UTC) Date: Thu, 1 Aug 2019 10:04:07 +0200 From: Michal Hocko To: David Hildenbrand Cc: Rashmica Gupta , Oscar Salvador , Andrew Morton , Dan Williams , pasha.tatashin@soleen.com, Jonathan.Cameron@huawei.com, anshuman.khandual@arm.com, Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 0/5] Allocate memmap from hotadded memory Message-ID: <20190801080407.GJ11627@dhcp22.suse.cz> References: <20190702074806.GA26836@linux> <20190731120859.GJ9330@dhcp22.suse.cz> <4ddee0dd719abd50350f997b8089fa26f6004c0c.camel@gmail.com> <20190801071709.GE11627@dhcp22.suse.cz> <9bcbd574-7e23-5cfe-f633-646a085f935a@redhat.com> <20190801072430.GF11627@dhcp22.suse.cz> <20190801073407.GG11627@dhcp22.suse.cz> <7c12f0b1-61a5-ed6f-2c64-4058e47860a3@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7c12f0b1-61a5-ed6f-2c64-4058e47860a3@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 01-08-19 09:50:29, David Hildenbrand wrote: > On 01.08.19 09:34, Michal Hocko wrote: > > On Thu 01-08-19 09:26:35, David Hildenbrand wrote: > >> On 01.08.19 09:24, Michal Hocko wrote: > >>> On Thu 01-08-19 09:18:47, David Hildenbrand wrote: > >>>> On 01.08.19 09:17, Michal Hocko wrote: > >>>>> On Thu 01-08-19 09:06:40, Rashmica Gupta wrote: > >>>>>> On Wed, 2019-07-31 at 14:08 +0200, Michal Hocko wrote: > >>>>>>> On Tue 02-07-19 18:52:01, Rashmica Gupta wrote: > >>>>>>> [...] > >>>>>>>>> 2) Why it was designed, what is the goal of the interface? > >>>>>>>>> 3) When it is supposed to be used? > >>>>>>>>> > >>>>>>>>> > >>>>>>>> There is a hardware debugging facility (htm) on some power chips. > >>>>>>>> To use > >>>>>>>> this you need a contiguous portion of memory for the output to be > >>>>>>>> dumped > >>>>>>>> to - and we obviously don't want this memory to be simultaneously > >>>>>>>> used by > >>>>>>>> the kernel. > >>>>>>> > >>>>>>> How much memory are we talking about here? Just curious. > >>>>>> > >>>>>> From what I've seen a couple of GB per node, so maybe 2-10GB total. > >>>>> > >>>>> OK, that is really a lot to keep around unused just in case the > >>>>> debugging is going to be used. > >>>>> > >>>>> I am still not sure the current approach of (ab)using memory hotplug is > >>>>> ideal. Sure there is some overlap but you shouldn't really need to > >>>>> offline the required memory range at all. All you need is to isolate the > >>>>> memory from any existing user and the page allocator. Have you checked > >>>>> alloc_contig_range? > >>>>> > >>>> > >>>> Rashmica mentioned somewhere in this thread that the virtual mapping > >>>> must not be in place, otherwise the HW might prefetch some of this > >>>> memory, leading to errors with memtrace (which checks that in HW). > >>> > >>> Does anything prevent from unmapping the pfn range from the direct > >>> mapping? > >> > >> I am not sure about the implications of having > >> pfn_valid()/pfn_present()/pfn_online() return true but accessing it > >> results in crashes. (suspend, kdump, whatever other technology touches > >> online memory) > > > > If those pages are marked as Reserved then nobody should be touching > > them anyway. > > Which is not true as I remember we already discussed - I even documented > what PG_reserved can mean after that discussion in page-flags.h (e.g., > memmap of boot memory) - that's why we introduced PG_offline after all. Sorry, my statement was imprecise. What I meant is what we have documented: * PG_reserved is set for special pages. The "struct page" of such a page * should in general not be touched (e.g. set dirty) except by its owner. the owner part is important. -- Michal Hocko SUSE Labs