Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1110154ybg; Mon, 27 Jul 2020 08:10:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxWZ9R6EwmOzy21P7SHuXGWU+vC4D2RlFA+XMLn3od02nMz4iB26LDA7ar233FP448pZLs X-Received: by 2002:aa7:c2c6:: with SMTP id m6mr6878475edp.118.1595862600159; Mon, 27 Jul 2020 08:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595862600; cv=none; d=google.com; s=arc-20160816; b=cZWQb4YT4/rqHq6YU7fs4qbtHCpcMGQiLHC8lEShkpXbkZzhMXFMcf70KGT/rpX+a1 lfKyiN2Esmm/xVJtTPzMtR9mS18Ed8SBQbgjidQE2CJfZkaU8nbmeJGenVPhU037YVUy PMZ2YLnWTC66W8RXZMHBK69rXb14iYHJra6msLjeD/QxnFsy4Ulp4m9CduLuHIi2X+Bz 1yp2BcMy3PHQMhLSV//48+84LCixlxvgDG/HK7LIIWVlGVFVdUX7rHaR/+nT7RLaFvZp x+nBzwN7bzrhFjYor2Qt6FLutqQpcmglpA/N3jFDv9a4h5EgHQl9CvFfhSkjs/Z3cg0Z 4v8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=NA1GgAcCdIvoriWuA+LCvdLOFJCwfNr9MC6JBtTpszI=; b=HSyGuO05deVKXhLMqwAnBqrAzfj+pMXxWl/TXiIszesVu+8NXsNq9LnT5+a+NI2g6a UIib59vU/vBwT0LSS+uq3TRlrU9S2NC961poO07huQBdeHk8FzhnT613zzoCHINsHaR8 ubnzhR2FKL0L1CLLek0cUFSGGiKBfYVQ9IJj4DvESMmrONixZbkKCVfN44Uh0J6kWnr2 GMnVFWkHfBxVmMCmltyuj8UWSZp8Pxc2sQQgDm4ZVf5t8ebo6U6odaGYjgwlJz/K6Kjw KAr5dLbIRGe63FuHO+Euo+s8nmnJz4NLTC4HvSchB0ukQe1OjSVX2FRSX4bnXQqbOmPb /lcQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yk11si1051705ejb.113.2020.07.27.08.09.37; Mon, 27 Jul 2020 08:10:00 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730510AbgG0PJL (ORCPT + 99 others); Mon, 27 Jul 2020 11:09:11 -0400 Received: from mx2.suse.de ([195.135.220.15]:42466 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729507AbgG0PJL (ORCPT ); Mon, 27 Jul 2020 11:09:11 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 88571B71A; Mon, 27 Jul 2020 15:09:19 +0000 (UTC) Subject: Re: [PATCH v3 4/4] xen: add helpers to allocate unpopulated memory To: Roger Pau Monne , linux-kernel@vger.kernel.org Cc: Oleksandr Andrushchenko , David Airlie , Daniel Vetter , Boris Ostrovsky , Stefano Stabellini , Dan Carpenter , Wei Liu , Yan Yankovskyi , dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, linux-mm@kvack.org, David Hildenbrand , Michal Hocko , Dan Williams References: <20200727091342.52325-1-roger.pau@citrix.com> <20200727091342.52325-5-roger.pau@citrix.com> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <06e21488-25a6-1c9f-366b-3c2ab63e4632@suse.com> Date: Mon, 27 Jul 2020 17:09:07 +0200 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: <20200727091342.52325-5-roger.pau@citrix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.07.20 11:13, Roger Pau Monne wrote: > To be used in order to create foreign mappings. This is based on the > ZONE_DEVICE facility which is used by persistent memory devices in > order to create struct pages and kernel virtual mappings for the IOMEM > areas of such devices. Note that on kernels without support for > ZONE_DEVICE Xen will fallback to use ballooned pages in order to > create foreign mappings. > > The newly added helpers use the same parameters as the existing > {alloc/free}_xenballooned_pages functions, which allows for in-place > replacement of the callers. Once a memory region has been added to be > used as scratch mapping space it will no longer be released, and pages > returned are kept in a linked list. This allows to have a buffer of > pages and prevents resorting to frequent additions and removals of > regions. > > If enabled (because ZONE_DEVICE is supported) the usage of the new > functionality untangles Xen balloon and RAM hotplug from the usage of > unpopulated physical memory ranges to map foreign pages, which is the > correct thing to do in order to avoid mappings of foreign pages depend > on memory hotplug. > > Signed-off-by: Roger Pau Monné > --- > I've not added a new memory_type type and just used > MEMORY_DEVICE_DEVDAX which seems to be what we want for such memory > regions. I'm unsure whether abusing this type is fine, or if I should > instead add a specific type, maybe MEMORY_DEVICE_GENERIC? I don't > think we should be using a specific Xen type at all. What about introducing MEMORY_DEVICE_VIRT? The comment for MEMORY_DEVICE_DEVDAX doesn't really fit, as there is no character device involved. In the end its the memory management maintainers to decide that. Other than that you can have my Reviewed-by: Juergen Gross Juergen