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.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY, 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 29DE8C433E2 for ; Fri, 4 Sep 2020 12:40:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AB5DA206F2 for ; Fri, 4 Sep 2020 12:40:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB5DA206F2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DAC276B00BC; Fri, 4 Sep 2020 08:40:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5D936B00BD; Fri, 4 Sep 2020 08:40:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C4D586B00BE; Fri, 4 Sep 2020 08:40:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id AB8126B00BC for ; Fri, 4 Sep 2020 08:40:29 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6B64B8248076 for ; Fri, 4 Sep 2020 12:40:29 +0000 (UTC) X-FDA: 77225337378.27.pest19_280e342270b2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 41C773D668 for ; Fri, 4 Sep 2020 12:40:29 +0000 (UTC) X-HE-Tag: pest19_280e342270b2 X-Filterd-Recvd-Size: 6200 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Sep 2020 12:40:28 +0000 (UTC) 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 348C0ACB5; Fri, 4 Sep 2020 12:40:28 +0000 (UTC) Subject: Re: [PATCH v5 3/3] xen: add helpers to allocate unpopulated memory To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Cc: linux-kernel@vger.kernel.org, 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: <20200901083326.21264-1-roger.pau@citrix.com> <20200901083326.21264-4-roger.pau@citrix.com> <20200903163837.GM753@Air-de-Roger> <6fd73d30-5525-7f00-1e9c-d7bb96ea34a6@suse.com> <20200904084229.GN753@Air-de-Roger> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <41905296-c157-938b-4953-19af3435c085@suse.com> Date: Fri, 4 Sep 2020 14:40:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200904084229.GN753@Air-de-Roger> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 41C773D668 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 Content-Transfer-Encoding: quoted-printable 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 04.09.20 10:42, Roger Pau Monn=C3=A9 wrote: > On Fri, Sep 04, 2020 at 09:00:18AM +0200, J=C3=BCrgen Gro=C3=9F wrote: >> On 03.09.20 18:38, Roger Pau Monn=C3=A9 wrote: >>> On Thu, Sep 03, 2020 at 05:30:07PM +0200, J=C3=BCrgen Gro=C3=9F wrote= : >>>> On 01.09.20 10:33, Roger Pau Monne wrote: >>>>> To be used in order to create foreign mappings. This is based on th= e >>>>> ZONE_DEVICE facility which is used by persistent memory devices in >>>>> order to create struct pages and kernel virtual mappings for the IO= MEM >>>>> 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-plac= e >>>>> 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 pa= ges >>>>> 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 t= he >>>>> correct thing to do in order to avoid mappings of foreign pages dep= end >>>>> on memory hotplug. >>>>> >>>>> Note the driver is currently not enabled on Arm platforms because i= t >>>>> would interfere with the identity mapping required on some platform= s. >>>>> >>>>> Signed-off-by: Roger Pau Monn=C3=A9 >>>> >>>> Sorry, I just got a build error for x86 32-bit build: >>>> >>>> WARNING: unmet direct dependencies detected for ZONE_DEVICE >>>> Depends on [n]: MEMORY_HOTPLUG [=3Dn] && MEMORY_HOTREMOVE [=3Dn]= && >>>> SPARSEMEM_VMEMMAP [=3Dn] && ARCH_HAS_PTE_DEVMAP [=3Dn] >>>> Selected by [y]: >>>> - XEN_UNPOPULATED_ALLOC [=3Dy] && XEN [=3Dy] && X86 [=3Dy] >>>> GEN Makefile >>>> CC kernel/bounds.s >>>> CALL /home/gross/korg/src/scripts/atomic/check-atomics.sh >>>> UPD include/generated/bounds.h >>>> CC arch/x86/kernel/asm-offsets.s >>>> In file included from /home/gross/korg/src/include/linux/mmzone.h:19= :0, >>>> from /home/gross/korg/src/include/linux/gfp.h:6, >>>> from /home/gross/korg/src/include/linux/slab.h:15= , >>>> from /home/gross/korg/src/include/linux/crypto.h:= 19, >>>> from /home/gross/korg/src/arch/x86/kernel/asm-off= sets.c:9: >>>> /home/gross/korg/src/include/linux/page-flags-layout.h:95:2: error: = #error >>>> "Not enough bits in page flags" >>>> #error "Not enough bits in page flags" >>>> ^~~~~ >>>> make[2]: *** [/home/gross/korg/src/scripts/Makefile.build:114: >>>> arch/x86/kernel/asm-offsets.s] Error 1 >>>> make[1]: *** [/home/gross/korg/src/Makefile:1175: prepare0] Error 2 >>>> make[1]: Leaving directory '/home/gross/korg/x8632' >>>> make: *** [Makefile:185: __sub-make] Error 2 >>> >>> Sorry for this. I've tested a 32bit build but I think it was before >>> the last Kconfig changes. I'm a little unsure how to solve this, as >>> ZONE_DEVICE doesn't select the required options for it to run, but >>> rather depends on them to be available. >>> >>> You can trigger something similar on x86-64 by doing: >>> >>> $ make ARCH=3Dx86_64 xen.config >>> Using .config as base >>> Merging ./kernel/configs/xen.config >>> Merging ./arch/x86/configs/xen.config >>> # >>> # merged configuration written to .config (needs make) >>> # >>> scripts/kconfig/conf --olddefconfig Kconfig >>> >>> WARNING: unmet direct dependencies detected for ZONE_DEVICE >>> Depends on [n]: MEMORY_HOTPLUG [=3Dy] && MEMORY_HOTREMOVE [=3Dn] = && SPARSEMEM_VMEMMAP [=3Dy] && ARCH_HAS_PTE_DEVMAP [=3Dy] >>> Selected by [y]: >>> - XEN_UNPOPULATED_ALLOC [=3Dy] && XEN [=3Dy] && X86_64 [=3Dy] >>> # >>> # configuration written to .config >>> # >>> >>> I think the only solution is to have XEN_UNPOPULATED_ALLOC depend on >>> ZONE_DEVICE rather than select it? >> >> Yes, I think so. >> >> I've folded that in and now build is fine. >=20 > Thanks, I assume no further action is needed on my side. Right. Juergen