Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2374118rdg; Sun, 13 Aug 2023 23:36:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqIAOybxL9Hz9kBNqwyiDs+0KOP6arfsbTJAZb+Xrbfs1oJ8iu3cpoNL/enve80GD0cQoA X-Received: by 2002:a19:e057:0:b0:4fd:f7fa:8017 with SMTP id g23-20020a19e057000000b004fdf7fa8017mr4996020lfj.60.1691994994754; Sun, 13 Aug 2023 23:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691994994; cv=none; d=google.com; s=arc-20160816; b=IdQUIZxwioIMgrVsE9DtLBu1ji/9vh558U0pYkp9Ph0U9iH8QWe5ADsp1vgR8iChLw eUf8cKpgKvV6NRW0GRW5hMJMIQ9QG0mJP3VFyTc0k5CDLTJEHGpw9fzKjJ3dV/5k1d/l Dp5o4sKAbjR7oJQ6yLOG2HT+0My4RQKWDXn+NGpIOiNahAknnw7tdetZQlc84QzapOy4 /sV3jrmS3GI5ZSWJcQziR/dJ0RffMMDGAdyrg41sNZCXqOBDaD4H9OZRF0K8kV/Im7pE DFLJr4+k6hWFOBz1VCMfj86F2+lyC8/BMbvMZAZdKhdoMSa6gqumbR1sHHKKtUSYwlat Et2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=5nAt4s5++9geJV4e8eesm3/O1yv/MDUWo+DaiGBBDyg=; fh=lTYsb6471+XUZ0yAF677p3dZHC8B7E0PniTCcwptngc=; b=pwb6Hcs7OUu8L4FDSnqWBbbrPfeXriLavDsTW0L2f0LtUrea+cBXzGd43bmnEFlfCJ kKZ02vj/AAPRLDjOXPIjF/ND5w9MPb0QllVZM34u6FhOWHMREHswz38qsucEHAq10HqA 7DdtjaEzEEvIW8ND5LB4EWhK+MVZn9zR41/gQmNPxxCpp+zZvv2TuX67JaWc1+QCcieO byQKfkQ9uUaq8AMLDfnIkRn0J2fPXtjIWoJGNZBInrOeUr6KXN1n0DGU25Y9E5IbyBl4 /b9hnH5f2WiNGrDTSvaKkZfE4nOiEegIDptIM1LZ2cS/YOERKxb61bh5QYV3wKDIb6Mh eZbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RNGQ0sit; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v6-20020aa7cd46000000b005231fbd6936si7302804edw.396.2023.08.13.23.36.03; Sun, 13 Aug 2023 23:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RNGQ0sit; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231488AbjHNGN2 (ORCPT + 99 others); Mon, 14 Aug 2023 02:13:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233663AbjHNGND (ORCPT ); Mon, 14 Aug 2023 02:13:03 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C88D41BC3; Sun, 13 Aug 2023 23:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691993173; x=1723529173; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=igwqY+DlLN1XbqdBe2kVLRnBm1tJGTmIQMvEm+2XvxA=; b=RNGQ0sitM+oj0a0ZNSahtoOMhnatE0nkGahWMiAr84aODzsULDwxD3MQ BoE1EdkSrwsLEW/mfM6+xf7MBaGtTWaZhL/4PsJc874GVQ8DDnbpGoxWY FbXK+h/JeST/DOPc/k0M7yGRjG2eFYqj23uSAH0dSqHjFuOzw8psUl/Yp 7fP4dybVD6jI0UziPqq1RrubiTJ96UV1HqiUWFtVZMPlPAoRFZyR6m2tq VhfQh7qzq14NInTf+xVW9TMXjIoJ5l9+ZC0/ddrARrrzQWHZw3SPNvyp/ qsjTywc6s5ZOBA4d0dJ9uRtVT8WDTXs6lj61jQAzk5v8pA5TBfxr+tfRo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="458333705" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="458333705" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 23:06:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10801"; a="710214230" X-IronPort-AV: E=Sophos;i="6.01,171,1684825200"; d="scan'208";a="710214230" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2023 23:06:09 -0700 From: "Huang, Ying" To: "Verma, Vishal L" Cc: "aneesh.kumar@linux.ibm.com" , "david@redhat.com" , "Jiang, Dave" , "linux-mm@kvack.org" , "osalvador@suse.de" , "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , "Williams, Dan J" , "dave.hansen@linux.intel.com" , "Jonathan.Cameron@Huawei.com" , "nvdimm@lists.linux.dev" , "jmoyer@redhat.com" , "linux-cxl@vger.kernel.org" Subject: Re: [PATCH v2 2/3] mm/memory_hotplug: split memmap_on_memory requests across memblocks References: <20230720-vv-kmem_memmap-v2-0-88bdaab34993@intel.com> <20230720-vv-kmem_memmap-v2-2-88bdaab34993@intel.com> <87a5vmadcw.fsf@linux.ibm.com> <87351e2e43.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Mon, 14 Aug 2023 14:04:31 +0800 In-Reply-To: (Vishal L. Verma's message of "Wed, 2 Aug 2023 14:02:12 +0800") Message-ID: <87o7ja9n2o.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Verma, Vishal L" writes: > On Mon, 2023-07-24 at 11:16 +0800, Huang, Ying wrote: >> "Aneesh Kumar K.V" writes: >> > >> > > @@ -1339,27 +1367,20 @@ int __ref add_memory_resource(int nid, >> > > struct resource *res, mhp_t mhp_flags) >> > > /* >> > > * Self hosted memmap array >> > > */ >> > > - if (mhp_flags & MHP_MEMMAP_ON_MEMORY) { >> > > - if (!mhp_supports_memmap_on_memory(size)) { >> > > - ret = -EINVAL; >> > > + if ((mhp_flags & MHP_MEMMAP_ON_MEMORY) && >> > > + mhp_supports_memmap_on_memory(memblock_size)) { >> > > + for (cur_start = start; cur_start < start + size; >> > > + cur_start += memblock_size) { >> > > + ret = add_memory_create_devices(nid, >> > > group, cur_start, >> > > + memblock_ >> > > size, >> > > + mhp_flags >> > > ); >> > > + if (ret) >> > > + goto error; >> > > + } >> > >> > We should handle the below error details here. >> > >> > 1) If we hit an error after some blocks got added, should we >> > iterate over rest of the dev_dax->nr_range. >> > 2) With some blocks added if we return a failure here, we remove >> > the >> > resource in dax_kmem. Is that ok? >> > >> > IMHO error handling with partial creation of memory blocks in a >> > resource range should be >> > documented with this change. >> >> Or, should we remove all added memory blocks upon error? >> > I didn't address these in v3 - I wasn't sure how we'd proceed here. > Something obviously went very wrong and I'd imagine it is okay if this > memory is unusable as a result. > > What woyuld removing the blocks we added look like? Just call > try_remove_memory() from the error path in add_memory_resource()? (for > a range of [start, cur_start) ? I guess that we can just keep the original behavior. Originally, if something goes wrong, arch_remove_memory() and remove_memory_block() (in create_memory_block_devices()) will be called for all added memory range. So, we should do that too? -- Best Regards, Huang, Ying