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.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 EE3FBCA9EAF for ; Thu, 24 Oct 2019 07:56:04 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 BD6322084C for ; Thu, 24 Oct 2019 07:56:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZmXABiZz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD6322084C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 67FC58786B; Thu, 24 Oct 2019 07:56:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RG+du8vGCZ+P; Thu, 24 Oct 2019 07:56:01 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id A2BAC8784E; Thu, 24 Oct 2019 07:56:01 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5AF311BF32D for ; Thu, 24 Oct 2019 07:55:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 55F0B882B1 for ; Thu, 24 Oct 2019 07:55:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UQ5RkE5mXCIp for ; Thu, 24 Oct 2019 07:55:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by hemlock.osuosl.org (Postfix) with ESMTPS id 1CD4B882B0 for ; Thu, 24 Oct 2019 07:55:58 +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 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 X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kate Stewart , Sasha Levin , linux-hyperv@vger.kernel.org, Michal Hocko , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org, Pavel Tatashin , KarimAllah Ahmed , Benjamin Herrenschmidt , Dave Hansen , Alexander Duyck , Michal Hocko , Paul Mackerras , linux-mm@kvack.org, Paul Mackerras , Michael Ellerman , "H. Peter Anvin" , Wanpeng Li , Alexander Duyck , Kees Cook , devel@driverdev.osuosl.org, Stefano Stabellini , Stephen Hemminger , "Aneesh Kumar K.V" , Joerg Roedel , x86@kernel.org, YueHaibing , Mike Rapoport , Madhumitha Prabakaran , Peter Zijlstra , Ingo Molnar , Vlastimil Babka , Nishka Dasgupta , Anthony Yznaga , Oscar Salvador , Dan Carpenter , "Isaac J. Manjarres" , Juergen Gross , Haiyang Zhang , =?UTF-8?Q?Simon_Sandstr=c3=b6m?= , Dan Williams , kvm-ppc@vger.kernel.org, Qian Cai , Alex Williamson , Mike Rapoport , Borislav Petkov , Nicholas Piggin , Andy Lutomirski , xen-devel@lists.xenproject.org, Boris Ostrovsky , Todd Poynor , Vitaly Kuznetsov , Allison Randal , Jim Mattson , Christophe Leroy , Vandana BN , Greg Kroah-Hartman , Cornelia Huck , Pavel Tatashin , Mel Gorman , Sean Christopherson , Rob Springer , Thomas Gleixner , Johannes Weiner , Paolo Bonzini , Andrew Morton , linuxppc-dev@lists.ozlabs.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On 24.10.19 05:53, Anshuman Khandual wrote: > > 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. > > Why hot plugged memory at runtime cannot have holes (e.g a semi bad DIMM). Important: HWPoison != memory hole A memory hole is memory that is not "IORESOURCE_SYSRAM". These pages are currently marked PG_reserved. Such holes are sometimes used for mapping something into kernel space. Some archs use the PG_reserved to detect 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 pass one memory resource (that is all IORESOURCE_SYSRAM | IORESOURCE_BUSY) Hotplugging memory with holes is not supported (nor can I imagine a use case for that). >> >> When we stop allowing to offline memory blocks with holes, we implicitly >> stop to online memory blocks with holes. > > 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. Keeping code around that nobody really needs that limits cleanups, no thanks. Similar to us not supporting to offline memory blocks that span multiple nodes/zones. E.g., have a look at the isolation code. It is full of code that jumps over memory holes (start_isolate_page_range() -> __first_valid_page()). That made sense for our complicated memory offlining code, but it is actually harmful when dealing with alloc_contig_range(). Allocation never wants to jump over memory holes. After this patch, we can just fail hard on any memory hole we detect, instead of ignoring it (or special-casing it). > >> >> 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. > > 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 it boils down to us having to deal with it in onlining/offlining code. And that is some handling nobody really seems to need. > >> >> Offlining memory blocks added during boot is usually not guranteed to work >> either way. So stopping to do that (if anybody really used and tested > > That guarantee does not exist right now because how boot memory could have > been used after boot not from a limitation of the memory hot remove itself. Yep. However, Michal and I are not even aware of a setup that would made this work and guarantee that the existing code actually still is able to deal with holes. Are you? > >> 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) > > Holes on DIMM could be due to HW errors affecting only parts of it. By not Again, HW errors != 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! -- Thanks, David / dhildenb _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel