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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 BC2D1C433E0 for ; Tue, 12 Jan 2021 04:25:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4312522D05 for ; Tue, 12 Jan 2021 04:25:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4312522D05 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 82E2E6B01F8; Mon, 11 Jan 2021 23:25:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DE4D6B0202; Mon, 11 Jan 2021 23:25:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CCBE6B0203; Mon, 11 Jan 2021 23:25:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id 53B916B01F8 for ; Mon, 11 Jan 2021 23:25:14 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 14B35824556B for ; Tue, 12 Jan 2021 04:25:14 +0000 (UTC) X-FDA: 77695833348.16.idea86_241206b27512 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id EAC86100E6903 for ; Tue, 12 Jan 2021 04:25:13 +0000 (UTC) X-HE-Tag: idea86_241206b27512 X-Filterd-Recvd-Size: 3998 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Jan 2021 04:25:13 +0000 (UTC) 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 9D9A31042; Mon, 11 Jan 2021 20:25:12 -0800 (PST) Received: from [192.168.0.130] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7EDA23F66E; Mon, 11 Jan 2021 20:25:06 -0800 (PST) Subject: Re: [PATCH RFC] virtio-mem: check against memhp_get_pluggable_range() which memory we can hotplug To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, "Michael S. Tsirkin" , Jason Wang , Pankaj Gupta , Michal Hocko , Oscar Salvador , Wei Yang , Andrew Morton , catalin.marinas@arm.com, teawater , Pankaj Gupta , Jonathan Cameron , hca@linux.ibm.com, Vasily Gorbik , Will Deacon , Ard Biesheuvel , Mark Rutland References: <1608218912-28932-1-git-send-email-anshuman.khandual@arm.com> <20210111124140.11423-1-david@redhat.com> From: Anshuman Khandual Message-ID: <0d5b797b-8a1c-7ee5-c821-99e065e9c489@arm.com> Date: Tue, 12 Jan 2021 09:55:26 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210111124140.11423-1-david@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 1/11/21 6:11 PM, David Hildenbrand wrote: > Right now, we only check against MAX_PHYSMEM_BITS - but turns out there > are more restrictions of which memory we can actually hotplug, especially > om arm64 or s390x once we support them: we might receive something like > -E2BIG or -ERANGE from add_memory_driver_managed(), stopping device > operation. > > So, check right when initializing the device which memory we can add, > warning the user. Try only adding actually pluggable ranges: in the worst > case, no memory provided by our device is pluggable. > > In the usual case, we expect all device memory to be pluggable, and in > corner cases only some memory at the end of the device-managed memory > region to not be pluggable. > > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: Pankaj Gupta > Cc: Michal Hocko > Cc: Oscar Salvador > Cc: Wei Yang > Cc: Andrew Morton > Cc: catalin.marinas@arm.com > Cc: teawater > Cc: Anshuman Khandual > Cc: Pankaj Gupta > Cc: Jonathan Cameron > Cc: hca@linux.ibm.com > Cc: Vasily Gorbik > Cc: Will Deacon > Cc: Ard Biesheuvel > Cc: Mark Rutland > Cc: Heiko Carstens > Cc: Michal Hocko > Signed-off-by: David Hildenbrand > --- > > This is an example how virito-mem intends to use an interface like > memhp_get_pluggable_range() once around. See: > > "[PATCH V2 0/3] mm/hotplug: Pre-validate the address range with platform" > https://lkml.kernel.org/r/1608218912-28932-1-git-send-email-anshuman.khandual@arm.com > > @Anshuman, feel free to pick up and carry this patch. I'll retest the final > result / new versions of you series. Makes sense, will carry this patch in the series.