Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3218759pxu; Sun, 29 Nov 2020 19:32:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQtnbQ1bJpSTYZ2EvOJRkV/h3vj9P8FGTmjtsnGn/eS6HZWZOUm2dxnPqBTRngSj3gYWwB X-Received: by 2002:aa7:d40f:: with SMTP id z15mr263203edq.172.1606707149556; Sun, 29 Nov 2020 19:32:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606707149; cv=none; d=google.com; s=arc-20160816; b=AvhKVrKdjbVXqL0yxb3gfSYQptJgWrzZVd95bOUj3z4HlJMszIclfnhV96Em0v6zJE 503Ds15V8/5Js9Vz3i+8KrtZVAbzQj3XBGdTLr6TwA/GIQnPJN97D1IpRZ+xLmPtbg6b MkB36FKZSQpZ6jodZ6a65YRVt/0jc026EwaSY+dyGpTthqN/C28WPQMjQOmnrNeDX0at iOE5YzUDLBqoTMr5zuxalbqj8OzBZETEOq/mKDdqzOJCbGiN/DZJqH1E7JxvZNH6T8JA RoFj+mRkkupkRE+NiyoIo7STVE+RMftTJw1HA9oZBkPn86xXKatzKFPa1VPi9zDFuS1i /1dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=cu12CG8Q1EwRHsTInzdkgFpz72EEJSFUXRUZlYrdtLY=; b=kvJ0AU+iOhNaGPzt6jhr+KwGoeZE2JAhyfqSQiu/GQcHcTS/Z/kk4We1Zt9ZpxRb+Q HhGb2ipUbYzotGPKa+LV8BBr8+aXLuAg2LQ/+N1P3pZFSyRLh8JTEOo5NzjxxCwJXZfq 4QOSyM49CZ6zl6EZnFtXkiOxmprD0l70fjE/fumImn6mS4/RETxqjUrqAPN/ESPsvn7O 6vEnQsdHwkWx8melRXnHWSQj8xhwoxyj6tNg8C8zBaKPmtHoYfyWGJfnKSDIV309Zcs7 WCs95dRSWgonLEKM/pHxFwG1PdYNY3on5otX0A60fASoQD4Ocd+e24o5SAQqtb1Gxws8 7B8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si10272415edi.566.2020.11.29.19.32.07; Sun, 29 Nov 2020 19:32:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbgK3Das (ORCPT + 99 others); Sun, 29 Nov 2020 22:30:48 -0500 Received: from foss.arm.com ([217.140.110.172]:48666 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726000AbgK3Dar (ORCPT ); Sun, 29 Nov 2020 22:30:47 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 17C6C30E; Sun, 29 Nov 2020 19:30:02 -0800 (PST) Received: from p8cg001049571a15.arm.com (unknown [10.163.84.86]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 344A73F23F; Sun, 29 Nov 2020 19:29:57 -0800 (PST) From: Anshuman Khandual To: linux-mm@kvack.org, akpm@linux-foundation.org, david@redhat.com Cc: linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Anshuman Khandual , Heiko Carstens , Vasily Gorbik , Catalin Marinas , Will Deacon , Ard Biesheuvel , Mark Rutland Subject: [RFC V2 0/3] mm/hotplug: Pre-validate the address range with platform Date: Mon, 30 Nov 2020 08:59:49 +0530 Message-Id: <1606706992-26656-1-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds a mechanism allowing platforms to weigh in and prevalidate incoming address range before proceeding further with the memory hotplug. This helps prevent potential platform errors for the given address range, down the hotplug call chain, which inevitably fails the hotplug itself. This mechanism was suggested by David Hildenbrand during another discussion with respect to a memory hotplug fix on arm64 platform. https://lore.kernel.org/linux-arm-kernel/1600332402-30123-1-git-send-email-anshuman.khandual@arm.com/ This mechanism focuses on the addressibility aspect and not [sub] section alignment aspect. Hence check_hotplug_memory_range() and check_pfn_span() have been left unchanged. Wondering if all these can still be unified in an expanded memhp_range_allowed() check, that can be called from multiple memory hot add and remove paths. This series applies on v5.10-rc6 and has been slightly tested on arm64. But looking for some early feedback here. Changes in RFC V2: Incorporated all review feedbacks from David. - Added additional range check in __segment_load() on s390 which was lost - Changed is_private init in pagemap_range() - Moved the framework into mm/memory_hotplug.c - Made arch_get_addressable_range() a __weak function - Renamed arch_get_addressable_range() as arch_get_mappable_range() - Callback arch_get_mappable_range() only handles range requiring linear mapping - Merged multiple memhp_range_allowed() checks in register_memory_resource() - Replaced WARN() with pr_warn() in memhp_range_allowed() - Replaced error return code ERANGE with E2BIG Changes in RFC V1: https://lore.kernel.org/linux-mm/1606098529-7907-1-git-send-email-anshuman.khandual@arm.com/ Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Catalin Marinas Cc: Will Deacon Cc: Ard Biesheuvel Cc: Mark Rutland Cc: David Hildenbrand Cc: Andrew Morton Cc: linux-arm-kernel@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Anshuman Khandual (3): mm/hotplug: Prevalidate the address range being added with platform arm64/mm: Define arch_get_mappable_range() s390/mm: Define arch_get_mappable_range() arch/arm64/mm/mmu.c | 14 +++---- arch/s390/mm/extmem.c | 5 +++ arch/s390/mm/vmem.c | 13 ++++-- include/linux/memory_hotplug.h | 2 + mm/memory_hotplug.c | 77 +++++++++++++++++++++++++--------- mm/memremap.c | 6 ++- 6 files changed, 84 insertions(+), 33 deletions(-) -- 2.20.1