Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 84485D462B3 for ; Wed, 13 Nov 2024 14:40:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.835772.1251622 (Exim 4.92) (envelope-from ) id 1tBEXY-00018B-Se; Wed, 13 Nov 2024 14:40:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 835772.1251622; Wed, 13 Nov 2024 14:40:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tBEXY-000184-Q8; Wed, 13 Nov 2024 14:40:16 +0000 Received: by outflank-mailman (input) for mailman id 835772; Wed, 13 Nov 2024 14:40:15 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tBEXX-00017y-GV for xen-devel@lists.xenproject.org; Wed, 13 Nov 2024 14:40:15 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.96) (envelope-from ) id 1tBEXW-003Hol-2r; Wed, 13 Nov 2024 14:40:15 +0000 Received: from [2a02:8012:3a1:0:2c06:4644:c8a3:2b5e] by xenbits.xenproject.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tBEXW-00373N-2o; Wed, 13 Nov 2024 14:40:14 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=PLR4zoU55fn0X90PYwPCmHLO/lWCzCpN21zjbKzRi94=; b=tgQfN2/hwnfadSlt1vQVoRtb3v f4FpWW5pAzwX++u3GGDvNx8eqLkmz5MaoGWAyj5rRCHSDFDd+tBG16hjzl9iTmdu45uby08fiZVMI 0s+07A+eI2cdfSAfga4eXUpsNwtl9ayWGahiS2OjQ39qHC8gS1ZogzbyfJIEkaXCG6+g=; Message-ID: <91140571-9237-42dc-8eb1-2263bbb23b07@xen.org> Date: Wed, 13 Nov 2024 14:40:13 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] xen/device-tree: Allow exact match for overlapping regions Content-Language: en-GB To: Michal Orzel , Luca Fancellu , xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk , Shawn Anastasio , Grygorii Strashko References: <20241106134132.2185492-1-luca.fancellu@arm.com> From: Julien Grall In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On 13/11/2024 14:19, Michal Orzel wrote: > > > On 13/11/2024 14:50, Julien Grall wrote: >> >> >> Hi Michal, >> >> On 06/11/2024 15:07, Michal Orzel wrote: >>> >>> >>> On 06/11/2024 14:41, Luca Fancellu wrote: >>>> >>>> >>>> There are some cases where the device tree exposes a memory range >>>> in both /memreserve/ and reserved-memory node, in this case the >>>> current code will stop Xen to boot since it will find that the >>>> latter range is clashing with the already recorded /memreserve/ >>>> ranges. >>>> >>>> Furthermore, u-boot lists boot modules ranges, such as ramdisk, >>>> in the /memreserve/ part and even in this case this will prevent >>>> Xen to boot since it will see that the module memory range that >>>> it is going to add in 'add_boot_module' clashes with a /memreserve/ >>>> range. >>>> >>>> When Xen populate the data structure that tracks the memory ranges, >>>> it also adds a memory type described in 'enum membank_type', so >>>> in order to fix this behavior, allow the 'check_reserved_regions_overlap' >>>> function to check for exact memory range match given a specific memory >>>> type; allowing reserved-memory node ranges and boot modules to have an >>>> exact match with ranges from /memreserve/. >>>> >>>> While there, set a type for the memory recorded during ACPI boot. >>>> >>>> Fixes: 53dc37829c31 ("xen/arm: Add DT reserve map regions to bootinfo.reserved_mem") >>>> Reported-by: Shawn Anastasio >>>> Reported-by: Grygorii Strashko >>>> Signed-off-by: Luca Fancellu >>>> --- >>>> I tested this patch adding the same range in a /memreserve/ entry and >>>> /reserved-memory node, and by letting u-boot pass a ramdisk. >>>> I've also tested that a configuration running static shared memory still works >>>> fine. >>>> --- >>> So we have 2 separate issues. I don't particularly like the concept of introducing MEMBANK_NONE >>> and the changes below look a bit too much for me, given that for boot modules we can only have >>> /memreserve/ matching initrd. >> >> How so? Is this an observation or part of a specification? > Not sure what specification you would want to see. Anything that you bake your observation. My concern with observation is ... It's all part of U-Boot and Linux behavior that is not documented (except for code comments). > My statement is based on the U-Boot and Linux behavior. U-Boot part only present for initrd: > https://github.com/u-boot/u-boot/blob/master/boot/fdt_support.c#L249 ... a user is not forced to use U-boot. So this is not a good reason to rely on it. If Linux starts to rely on it, then it is probably a better argument, but first I would need to see the code. Can you paste a link? > > For things that Xen can be interested in, only region for ramdisk for dom0 can match the /memreserve/ region. > Providing a generic solution (like Luca did) would want providing an example of sth else that can match which I'm not aware of. I would argue this is the other way around. If we are not certain that /memreserve/ will not be used for any other boot module, then we should have a generic solution. Otherwise, we will end up with similar weird issue in the future. Cheers, -- Julien Grall