From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38FF4CA9EAF for ; Thu, 24 Oct 2019 07:56:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA1A02084C for ; Thu, 24 Oct 2019 07:55:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZmXABiZz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA1A02084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 88B436B000A; Thu, 24 Oct 2019 03:55:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83C4E6B000C; Thu, 24 Oct 2019 03:55:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 703036B000D; Thu, 24 Oct 2019 03:55:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0092.hostedemail.com [216.40.44.92]) by kanga.kvack.org (Postfix) with ESMTP id 4FF7F6B000A for ; Thu, 24 Oct 2019 03:55:59 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id C134540CA for ; Thu, 24 Oct 2019 07:55:58 +0000 (UTC) X-FDA: 76077919596.03.seed15_6e3915e268308 X-HE-Tag: seed15_6e3915e268308 X-Filterd-Recvd-Size: 9111 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Oct 2019 07:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571903756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v2HcAVL2s+NZnk3LL+Y5gUG2TcYxdjN3fXPWT3YMgHw=; b=ZmXABiZzP2Awt1hXrQ+dJnuI/N5NVijdpgps+ZSE34PmPZItfaUKGznZdEo4zun32a9KXz oPWvuJ8qufzbURQJiXIbwqz3b7kaVUy9gZgq5fvC7YmX8w8Mxi5M2M+dKDAV7u4MurjHFD OQ75TLfC1YsI0c3QdWjeFhNuYEXOHDQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-0PKzETIIO6qSN3X27vvlnQ-1; Thu, 24 Oct 2019 03:55:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2063100551D; Thu, 24 Oct 2019 07:55:48 +0000 (UTC) Received: from [10.36.117.225] (ovpn-117-225.ams2.redhat.com [10.36.117.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEA6E60852; Thu, 24 Oct 2019 07:55:26 +0000 (UTC) Subject: Re: [PATCH RFC v1 01/12] mm/memory_hotplug: Don't allow to online/offline memory blocks with holes To: Anshuman Khandual , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Michal Hocko , Andrew Morton , kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, linux-hyperv@vger.kernel.org, devel@driverdev.osuosl.org, xen-devel@lists.xenproject.org, x86@kernel.org, Alexander Duyck , Alexander Duyck , Alex Williamson , Allison Randal , Andy Lutomirski , "Aneesh Kumar K.V" , Anthony Yznaga , Ben Chan , Benjamin Herrenschmidt , Borislav Petkov , Boris Ostrovsky , Christophe Leroy , Cornelia Huck , Dan Carpenter , Dan Williams , Dave Hansen , Fabio Estevam , Greg Kroah-Hartman , Haiyang Zhang , "H. Peter Anvin" , Ingo Molnar , "Isaac J. Manjarres" , Jeremy Sowden , Jim Mattson , Joerg Roedel , Johannes Weiner , Juergen Gross , KarimAllah Ahmed , Kate Stewart , Kees Cook , "K. Y. Srinivasan" , Madhumitha Prabakaran , Matt Sickler , Mel Gorman , Michael Ellerman , Michal Hocko , Mike Rapoport , Mike Rapoport , Nicholas Piggin , Nishka Dasgupta , Oscar Salvador , Paolo Bonzini , Paul Mackerras , Paul Mackerras , Pavel Tatashin , Pavel Tatashin , Peter Zijlstra , Qian Cai , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Rob Springer , Sasha Levin , Sean Christopherson , =?UTF-8?Q?Simon_Sandstr=c3=b6m?= , Stefano Stabellini , Stephen Hemminger , Thomas Gleixner , Todd Poynor , Vandana BN , Vitaly Kuznetsov , Vlastimil Babka , Wanpeng Li , YueHaibing References: <20191022171239.21487-1-david@redhat.com> <20191022171239.21487-2-david@redhat.com> <4aa3c72b-8991-9e43-80d7-a906ae79160b@arm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <93858175-0677-e5d6-6ecd-4035d71543b0@redhat.com> Date: Thu, 24 Oct 2019 09:55:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <4aa3c72b-8991-9e43-80d7-a906ae79160b@arm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 0PKzETIIO6qSN3X27vvlnQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 24.10.19 05:53, Anshuman Khandual wrote: >=20 > On 10/22/2019 10:42 PM, David Hildenbrand wrote: >> Our onlining/offlining code is unnecessarily complicated. Only memory >> blocks added during boot can have holes. Hotplugged memory never has >> holes. That memory is already online. >=20 > Why hot plugged memory at runtime cannot have holes (e.g a semi bad DIMM)= . Important: HWPoison !=3D memory hole A memory hole is memory that is not "IORESOURCE_SYSRAM". These pages are=20 currently marked PG_reserved. Such holes are sometimes used for mapping=20 something into kernel space. Some archs use the PG_reserved to detect=20 the memory hole ("not ram") and ignore the memmap. Poisoned pages are marked PG_hwpoison. > Currently, do we just abort adding that memory block if there are holes ? There is no interface to do that. E.g., have a look at add_memory() add_memory_resource(). You can only=20 pass one memory resource (that is all IORESOURCE_SYSRAM | IORESOURCE_BUSY) Hotplugging memory with holes is not supported (nor can I imagine a use=20 case for that). >> >> When we stop allowing to offline memory blocks with holes, we implicitly >> stop to online memory blocks with holes. >=20 > Reducing hotplug support for memory blocks with holes just to simplify > the code. Is it worth ? Me and Michal are not aware of a users, not even aware of a use case.=20 Keeping code around that nobody really needs that limits cleanups, no=20 thanks. Similar to us not supporting to offline memory blocks that span=20 multiple nodes/zones. E.g., have a look at the isolation code. It is full of code that jumps=20 over memory holes (start_isolate_page_range() -> __first_valid_page()).=20 That made sense for our complicated memory offlining code, but it is=20 actually harmful when dealing with alloc_contig_range(). Allocation=20 never wants to jump over memory holes. After this patch, we can just=20 fail hard on any memory hole we detect, instead of ignoring it (or=20 special-casing it). >=20 >> >> This allows to simplify the code. For example, we no longer have to >> worry about marking pages that fall into memory holes PG_reserved when >> onlining memory. We can stop setting pages PG_reserved. >=20 > Could not there be any other way of tracking these holes if not the page > reserved bit. In the memory section itself and corresponding struct pages > just remained poisoned ? Just wondering, might be all wrong here. Of course there could be ways (e.g., using PG_offline eventually), but=20 it boils down to us having to deal with it in onlining/offlining code.=20 And that is some handling nobody really seems to need. >=20 >> >> Offlining memory blocks added during boot is usually not guranteed to wo= rk >> either way. So stopping to do that (if anybody really used and tested >=20 > That guarantee does not exist right now because how boot memory could hav= e > been used after boot not from a limitation of the memory hot remove itsel= f. Yep. However, Michal and I are not even aware of a setup that would made=20 this work and guarantee that the existing code actually still is able to=20 deal with holes. Are you? >=20 >> this over the years) should not really hurt. For the use case of >> offlining memory to unplug DIMMs, we should see no change. (holes on >> DIMMs would be weird) >=20 > Holes on DIMM could be due to HW errors affecting only parts of it. By no= t Again, HW errors !=3D holes. We have PG_hwpoison for that. > allowing such DIMM's hot add and remove, we are definitely reducing the > scope of overall hotplug functionality. Is code simplification in itself > is worth this reduction in functionality ? What you describe is not affected. Thanks! --=20 Thanks, David / dhildenb