Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1246891ybi; Thu, 30 May 2019 14:09:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJhKQjTqxaGiVtC2kEdNudM9rqoMbWYr11vjd3WZSbUkRjxPQyiRitsu5df35Xq6pLmUwe X-Received: by 2002:a17:902:44a4:: with SMTP id l33mr5420179pld.337.1559250595090; Thu, 30 May 2019 14:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559250595; cv=none; d=google.com; s=arc-20160816; b=wTQCJtaEL6W5wasSo0NP/sq2OaMRvj7RBIyBg6hxb/QwWVJVqVZJJvvOtX3a8Xet9H aIPA0gsA55ytAa5B9pElVZv4OPIKGkSgh4veEDlb/F/J5YxjXz4Km73pJgL3EOcGbD8F f5RXbNYeL3VgbkroHb/D+SpUwZXybCCKhk+izz9RtjOikpyR1yjCftTXPlt5DHJ5oWni bOPWQCH3aBhJDnH9+h/AYK2yJLTZPyOWrQ3TyzOzLkprHXnWqFx78CJkWywbv3SPibd8 g3EAWDD9sPxxCfbhRc+qRVyGKof/BEwNPoUDvVAAj+smxnlrpXuq39BnR3drat2NdzWF so6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Pv5CB4WwZj0N9C+rEj8/2lRh5EGUHdn0uj79m0rM0oo=; b=w6pK+i0XGVhZluj8sA+iXuFi/2Y9Dng7NxqyGHiyQGvQCFc+/fTPizWZ1rhDqVg6vz 5jhq6EmO5nYIW3tghdFQryXOHFX32ytBDBSsumaqOWx3b9DYmKuStlIANJTpicUleHu3 jwrcZ22nbBcYcjT/xJBQbx1f7iK42wBmnF5iy3UiO1QjZUQDRmNpez138fetgbkuI9Oj aI9Ye/YIGAqycYMnLQozeASspmWDKObajEZXoLH3jBDGMYYPn7Ru4RNSofFKYEMXI2aY sLpeSELcuo2RZzn4hPK75eLihdNdsL31hoGP0Urqu3xtnIgfSWO7p5hY+8nAZtlBwPEj nqCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=VEU5u5GD; 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 j22si4325349pfe.43.2019.05.30.14.09.39; Thu, 30 May 2019 14:09:55 -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; dkim=pass header.i=@soleen.com header.s=google header.b=VEU5u5GD; 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 S1726666AbfE3VHS (ORCPT + 99 others); Thu, 30 May 2019 17:07:18 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42011 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726079AbfE3VHR (ORCPT ); Thu, 30 May 2019 17:07:17 -0400 Received: by mail-ed1-f65.google.com with SMTP id g24so1452255eds.9 for ; Thu, 30 May 2019 14:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Pv5CB4WwZj0N9C+rEj8/2lRh5EGUHdn0uj79m0rM0oo=; b=VEU5u5GDrcgB8PRAclAeTaxHNWRXxNgMKQuxMFD2SFRizhpvwX2vSFrW58YKLvKdGO eVuKFZtXyc1RHb9iKevkl1RKESa8X+H4JsE7X49/wDWGTTF1++R+Oi6bCGLu0qiMFC7q hWo0t+OsCQNb5YJC5V+PLRuPaGXL4SH2RlhfYwJV76d+wtYGM87zkTYGJrmM5dahxIDn qHnxrRKHJ981k6zXutXR8rLnD27RwSUR9gdS6t3qdzrPraAAqPEeILMrt+Xu+DkaI8aO CnVCUN2x67n04/yYkoMoVaF4yzXSA1yTow1K1ywH4DmLZh4o+OnP8FcuMAvRu6sLPZIL UDpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Pv5CB4WwZj0N9C+rEj8/2lRh5EGUHdn0uj79m0rM0oo=; b=JlPWsGfCayQP4lI4jgIc+5134oQNXrQ44r7AM2IbpfbPdT9tEWdsftOMfFphlXgnoh jb3Z4aqxwzg+PpEQSsKu42c1ANNDIwuDmAGYlWkrjCmbQ97n7fS+butRDeuPGnxGRldo CEpibGao/OhaI9tG+so1MkQ7XOf6xqPjeI5e+BrhjtKacpdxgdL3J0s5jKk3imacObt8 nBkNb7wG95zvVUW4UKS+7U5o8b8jTRpvU8Ki2d16P952aKWNurx/LfmpMqvSPpEfAKWW ZneHZrBRxh1HXW0pt4RAx0pwjKHunoCdvGtI5OwAh9I6XA4e+n+xEkZ245IDgP2+gNRz otKQ== X-Gm-Message-State: APjAAAXXUYVPs2rDqrFvJoGW2DGcTwaPqctQIIBUvq+asQaSjIhlJDd3 XFQToAPAGmWpnQ7twAzTwW/8JtM5O5hRHxzCDuZelA== X-Received: by 2002:aa7:d711:: with SMTP id t17mr7195382edq.80.1559250436307; Thu, 30 May 2019 14:07:16 -0700 (PDT) MIME-Version: 1.0 References: <20190527111152.16324-1-david@redhat.com> <20190527111152.16324-8-david@redhat.com> In-Reply-To: <20190527111152.16324-8-david@redhat.com> From: Pavel Tatashin Date: Thu, 30 May 2019 17:07:05 -0400 Message-ID: Subject: Re: [PATCH v3 07/11] mm/memory_hotplug: Create memory block devices after arch_add_memory() To: David Hildenbrand Cc: linux-mm , LKML , linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, Linux ARM , Andrew Morton , Dan Williams , Wei Yang , Igor Mammedov , Greg Kroah-Hartman , "Rafael J. Wysocki" , "mike.travis@hpe.com" , Ingo Molnar , Andrew Banman , Oscar Salvador , Michal Hocko , Qian Cai , Arun KS , Mathieu Malaterre Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 27, 2019 at 7:12 AM David Hildenbrand wrote: > > Only memory to be added to the buddy and to be onlined/offlined by > user space using /sys/devices/system/memory/... needs (and should have!) > memory block devices. > > Factor out creation of memory block devices. Create all devices after > arch_add_memory() succeeded. We can later drop the want_memblock parameter, > because it is now effectively stale. > > Only after memory block devices have been added, memory can be onlined > by user space. This implies, that memory is not visible to user space at > all before arch_add_memory() succeeded. > > While at it > - use WARN_ON_ONCE instead of BUG_ON in moved unregister_memory() > - introduce find_memory_block_by_id() to search via block id > - Use find_memory_block_by_id() in init_memory_block() to catch > duplicates > > Cc: Greg Kroah-Hartman > Cc: "Rafael J. Wysocki" > Cc: David Hildenbrand > Cc: "mike.travis@hpe.com" > Cc: Andrew Morton > Cc: Ingo Molnar > Cc: Andrew Banman > Cc: Oscar Salvador > Cc: Michal Hocko > Cc: Pavel Tatashin > Cc: Qian Cai > Cc: Wei Yang > Cc: Arun KS > Cc: Mathieu Malaterre > Signed-off-by: David Hildenbrand LGTM Reviewed-by: Pavel Tatashin