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=-8.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,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 650B1C433E1 for ; Fri, 14 Aug 2020 13:52:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1668F207DA for ; Fri, 14 Aug 2020 13:52:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1668F207DA 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 B47A66B0005; Fri, 14 Aug 2020 09:52:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1FDA6B0007; Fri, 14 Aug 2020 09:52:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A35636B0008; Fri, 14 Aug 2020 09:52:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 8D7496B0005 for ; Fri, 14 Aug 2020 09:52:42 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 49C09180AD80F for ; Fri, 14 Aug 2020 13:52:42 +0000 (UTC) X-FDA: 77149314564.13.yard71_441542f26ffd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 1523B18140B70 for ; Fri, 14 Aug 2020 13:52:42 +0000 (UTC) X-HE-Tag: yard71_441542f26ffd X-Filterd-Recvd-Size: 5505 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Aug 2020 13:52:41 +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 2F143B167; Fri, 14 Aug 2020 13:53:03 +0000 (UTC) Subject: Re: [PATCH v4 2/2] xen: add helpers to allocate unpopulated memory To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Cc: Christoph Hellwig , 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: <20200811094447.31208-1-roger.pau@citrix.com> <20200811094447.31208-3-roger.pau@citrix.com> <20200813073337.GA16160@infradead.org> <20200813075420.GC975@Air-de-Roger> <20200814072920.GA6126@infradead.org> <20200814095629.GJ975@Air-de-Roger> <20200814124724.GK975@Air-de-Roger> <20200814133536.GL975@Air-de-Roger> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <2f0e2484-d4ec-adb3-4182-6db2c542c633@suse.com> Date: Fri, 14 Aug 2020 15:52:39 +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: <20200814133536.GL975@Air-de-Roger> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 1523B18140B70 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 14.08.20 15:35, Roger Pau Monn=C3=A9 wrote: > On Fri, Aug 14, 2020 at 02:54:38PM +0200, J=C3=BCrgen Gro=C3=9F wrote: >> On 14.08.20 14:47, Roger Pau Monn=C3=A9 wrote: >>> On Fri, Aug 14, 2020 at 12:27:32PM +0200, J=C3=BCrgen Gro=C3=9F wrote= : >>>> On 14.08.20 11:56, Roger Pau Monn=C3=A9 wrote: >>>>> On Fri, Aug 14, 2020 at 08:29:20AM +0100, Christoph Hellwig wrote: >>>>>> On Thu, Aug 13, 2020 at 09:54:20AM +0200, Roger Pau Monn?? wrote: >>>>>>> On Thu, Aug 13, 2020 at 08:33:37AM +0100, Christoph Hellwig wrote= : >>>>>>>> On Tue, Aug 11, 2020 at 11:44:47AM +0200, Roger Pau Monne wrote: >>>>>>>>> If enabled (because ZONE_DEVICE is supported) the usage of the = new >>>>>>>>> functionality untangles Xen balloon and RAM hotplug from the us= age 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. >>>>>>>> >>>>>>>> So please just select ZONE_DEVICE if this is so much better rath= er >>>>>>>> than maintaining two variants. >>>>>>> >>>>>>> We still need to other variant for Arm at least, so both need to = be >>>>>>> maintained anyway, even if we force ZONE_DEVICE on x86. >>>>>> >>>>>> Well, it still really helps reproducability if you stick to one >>>>>> implementation of x86. >>>>>> >>>>>> The alternative would be an explicit config option to opt into it, >>>>>> but just getting a different implementation based on a random >>>>>> kernel option is strange. >>>>> >>>>> Would adding something like the chunk below to the patch be OK? >>>>> >>>>> ---8<--- >>>>> diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig >>>>> index 018020b91baa..5f321a1319e6 100644 >>>>> --- a/drivers/xen/Kconfig >>>>> +++ b/drivers/xen/Kconfig >>>>> @@ -328,7 +328,14 @@ config XEN_FRONT_PGDIR_SHBUF >>>>> tristate >>>>> config XEN_UNPOPULATED_ALLOC >>>>> - bool >>>>> - default y if ZONE_DEVICE && !ARM && !ARM64 >>>>> + bool "Use unpopulated memory ranges for guest mappings" >>>>> + depends on X86 >>>>> + select ZONE_DEVICE >>>>> + default y >>>> >>>> I'd rather use "default XEN_BACKEND" here, as mappings of other gues= t's >>>> memory is rarely used for non-backend guests. >>> >>> There's also the privcmd and gnt devices which make heavy use of this= , >>> so I'm not sure only selecting by default on XEN_BACKEND is the best >>> option. >> >> I just want to avoid that kernels built for running as Xen guest, but >> not as dom0, will be forced to select ZONE_DEVICE. >> >> As privcmd is dom0-only, this is no problem. >=20 > Oh, didn't know that, I somehow assumed privcmd would be available to > all Xen guests regardless of whether dom0 support was selected. My remark above should have been more precise in this regard: privcmd operations dealing with foreign mappings are normally limited to dom0 (there might be special cases, like linux-based stubdoms, but those will be configured carefully for that purpose, so they don't need to be considered for selecting the default IMO). >=20 >> In case you are worrying about gnt devices, I'd be fine to switch to >> >> default XEN_BACKEND || XEN_GNTDEV >=20 > Sure. maybe even: >=20 > default XEN_BACKEND || XEN_GNTDEV || XEN_DOM0 Yes. >=20 > Do you want me to resend with this changed or are you happy to fixup > if there are no further comments? I'd prefer a resend (maybe after Patch 1 has gained its missing Ack, and then with Patch 1 sent to me, too). Juergen