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=-3.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 64E16C433DF for ; Thu, 8 Oct 2020 21:22:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB76B22200 for ; Thu, 8 Oct 2020 21:22:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SgyGmn8N"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GhWLLKlj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB76B22200 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Iq5wvr8MAHXsPt2nkjaUTJfpsdZM7mrQwwa75YexlAs=; b=SgyGmn8NGi0irow4EgTc5i4TB r+p79N/LkPGVlpCCVDyQup4Iu3Mq4zA7G3LQFFbgWxeinkCKa6ZIanIV8I0ARfftR+tbbMLSssHPw gBBGLVFkosEYffz1+ayDTbJB6Bm8VwA5V7Z0bcOaj96L0RV64hLAnjyVDEAzY40hcqEHAtUZc8Tiy l5h7QEq3q/Co4/XK1nrrffqfOGna43LuC5Jcll3Htto6PvrlW6QwwJLBRcVOV7J/ObmIfui8IETv3 p0A6vuNOuMWLdkfo2X7w8FnDVslyX2Vtxsq10O7L3rb50VNQftKKUsdfRWiLN2RuCg6T4Vdo1HIld GdXloW6Zg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQdLG-0004k4-JL; Thu, 08 Oct 2020 21:20:50 +0000 Received: from mail-lf1-x143.google.com ([2a00:1450:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQdLE-0004jZ-52 for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 21:20:48 +0000 Received: by mail-lf1-x143.google.com with SMTP id l2so8288396lfk.0 for ; Thu, 08 Oct 2020 14:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YswObbWMgxkd2Es/EpjzmF8G0H6kB02USSUo8S+y6kY=; b=GhWLLKljFnCD9BsvCGQFfVvg9nN1pKAj+gmsHPpP1J5jQ6ndC0cMBTf566pqTwupUB KSPGUBbivmFnAI9WHviqhsHWKN8jsTUQts5YFgygnS5vwhBUIZDY128ZSlWHLlq1ACvg 6HfALY01xCVJdlaJL3PRMXqLmBcYJu3flOu6/+cjMGKD7TVtlMJnwRp0S/c9hTFJdWnA zL2tXN/acalFvjLMmf0b0hjPPrexNiyuhQ4GnQVR/LIwTtaMFDzrWco2FkbT4DwVZ5Ao wCgrVzgDr0q76HUMPFUARREEmBWNPcK4fM6Fr6+ugBYBy8na7Oyo6htR/XcEJUpN1O2R Nh3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YswObbWMgxkd2Es/EpjzmF8G0H6kB02USSUo8S+y6kY=; b=I3W7NcveLNJjyu45Mby3mjcIRRuErgprUFfwFl6at2aq2DcBME7XYas897PxHIwZIm pQeMmoVn9fX3VVte5dJIFy8c3E32Ph7+epJX18sdNraZ0ageqCVABYj+rTlWzTzI+1Wn nfvxuk5hzTKuVO2hyCyqpxtPMghDW2WAv7HFt4LELrGCxtx8MMF/4hZciVyACpsRhkN4 AL/g90oQ8N+ZM4TvUorM9iTIqNEfMb6TMC4QKxOV0+9T2X5fuGLkco5kDzt60D0Dyvnw BnaAlGrfekvirGSSdE4v27ALf3x/dRXrwDpEYqK8C2lwwOoWobEU2f8xTgr1WhQ6kdNH 2ptg== X-Gm-Message-State: AOAM530GzgiQymJpyFYtHj3EKp3FOgglsEY2ci90w0ROQ/1aIS1gtIRC UBympzG+pWZN0p/H1GeLr1M= X-Google-Smtp-Source: ABdhPJwHl1H1UEj/AqlDCq7iMbPC8W4sohfIJ8YHEtsM2uph7672HBW7Wfr3Tlad05F0BxMgi3q33w== X-Received: by 2002:ac2:58d2:: with SMTP id u18mr2050429lfo.390.1602192046634; Thu, 08 Oct 2020 14:20:46 -0700 (PDT) Received: from mobilestation ([95.79.141.114]) by smtp.gmail.com with ESMTPSA id i11sm1155977ljn.119.2020.10.08.14.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 14:20:45 -0700 (PDT) Date: Fri, 9 Oct 2020 00:20:43 +0300 From: Serge Semin To: Florian Fainelli Subject: Re: [PATCH v2] MIPS: replace add_memory_region with memblock Message-ID: <20201008212043.uolf4orh6ctr6ihz@mobilestation> References: <20201008084357.42780-1-tsbogend@alpha.franken.de> <20201008152006.4khkbzsxqmmz76rw@mobilestation> <20201008155454.kaal2bchjq7wusqr@mobilestation> <91e52fa1-ecf9-7acc-62f6-16fccfae927c@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <91e52fa1-ecf9-7acc-62f6-16fccfae927c@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_172048_197796_31B45298 X-CRM114-Status: GOOD ( 32.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Bogendoerfer , Hauke Mehrtens , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , linux-mips@vger.kernel.org, Jiaxun Yang , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, "Maciej W. Rozycki" , John Crispin , Keguang Zhang , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 08, 2020 at 09:49:46AM -0700, Florian Fainelli wrote: > > > On 10/8/2020 8:54 AM, Serge Semin wrote: > > On Thu, Oct 08, 2020 at 04:30:35PM +0100, Maciej W. Rozycki wrote: > > > On Thu, 8 Oct 2020, Serge Semin wrote: > > > > > > > At least I don't see a decent reason to preserve them. The memory registration > > > > method does nearly the same sanity checks. The memory reservation function > > > > defers a bit in adding the being reserved memory first. That seems redundant, > > > > since the reserved memory won't be available for the system anyway. Do I miss > > > > something? > > > > > > > > At the very least it serves informational purposes as it shows up in > > > /proc/iomem. > > > > I thought about that, but /proc/iomem prints the System RAM up. Adding the reserved > > memory regions to be just memory region first still seem redundant, since > > reserving a non-reflected in memory region most likely indicates an erroneous > > dts. I failed to find that, but do the kernel or DTC make sure that the reserved > > memory regions has actual memory behind? (At least in the framework of the > > memblock.memory vs memblock.reserved arrays or in the DT source file) > > AFAICT DTC does not do any validation that regions you declare in > /memreserve or /reserved-memory are within the 'reg' property defined for > the /memory node. > Not that it could not but that goes a little beyond is > compiler job. You are probably right, but it does the #{address,size}-cells validations against the subnode' "reg" properties. It even does I2C controllers subnodes "reg" validation so they wouldn't be greater than 7 or 10 bits wide. It also does some magic checks of SPI controllers subnodes. See scripts/dtc/checks.c for details. So I thought DTC might do some memory/reserved-memory validations too. Apparently it doesn't. On the other hand it would probably be pointless, since a system bootloader may change the "memory" node' "reg" value anyway if a platform has a variable memory layout. So any validation being passed at the DTS compile time wouldn't surely mean the memory/reserved-memory nodes coherency at the system boot time. > > The kernel ought to be able to do that validation through memblock but there > could be valid use cases behind declaring a reserved memory region that is > not backed by a corresponding DRAM region. For instance if you hotplugged > memory through the sysfs probe interface, and that memory was not initially > declared in the Device Tree, but there were reserved regions within that > hot-plugged range that you would have to be aware of, then this would break. Yeah, it seems to me all hot-pluggable regions are also marked as reserved. So hot-plugging a memory device behind the manually reserved regions (reserved by means of the DT reserved-memory/memreserve nodes) will unreserve them, which most likely isn't what has been originally wanted. Alas I don't have any hardware with hot-pluggable memory device to check out the problem availability. > > > > > I also don't see the other platforms doing that, since the MIPS arch only > > redefines these methods. So if a problem of adding a reserved memory with > > possible no real memory behind exist, it should be fixed in the cross-platform > > basis, don't you think? > > Would we be breaking any use case if we stopped allowing reserved region > that are not part of DRAM being declared? Hm, good question. I don't really know. But AFAICS from the reserved-memory node DT bindings the reserved regions can be used to declare both normal RAM and some vendor-specific regions. The later one theoretically can be some resource, bus or memory-mapped device thing especially if it's marked with "no-map" boolean property. --- Getting back to the topic. In the MIPS-specific early_init_dt_reserve_memory_arch() method (which is called for every region declared in reserved-memory/memreserve nodes) we currently consider the reserved region as DRAM if 'no-map' property isn't specified. The main question here is whether it is correct... -Sergey > -- > Florian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel