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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1907DC433F5 for ; Thu, 13 Jan 2022 15:56:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236393AbiAMP4o (ORCPT ); Thu, 13 Jan 2022 10:56:44 -0500 Received: from smtp2.axis.com ([195.60.68.18]:56611 "EHLO smtp2.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234589AbiAMP4o (ORCPT ); Thu, 13 Jan 2022 10:56:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1642089404; x=1673625404; h=date:to:cc:subject:message-id:references:mime-version: content-transfer-encoding:in-reply-to:from; bh=pVFUw84t0ZxJUeZ6BPOuXb3c1W/dG1Ig3PSqQS+VfvQ=; b=eMxq+q6wgR564HU29EGjjSzsZZywTZrywgANx6cvTjQKbBzANhZ6T1sl Ju+gNsx8xnVGVDQkc26By5Tg5TTcyFMHI4BF5b1sIMd/DHnYSpZK57Y95 xA9G7kYvOuh0RZHBwSfBzE7g+bEXBUTBRO/enUiMzRY9+0/qqjrpfTKxn ZCBNJy1XpR7eNP3gvcW+o9RfN4c53xc8pDcwGgmQl7EOPcTTMY8zsF+jg mdRvkOQRcER7FObNu9/iPQORwSbRTV1+AbQoIY6q35WFBs9gFclgnGIK6 ibnAB/IYJKSL6YZSu6nHK/lIfPg2mwTKXY4yrBSonEM7QClinOdrDq+8m A==; Date: Thu, 13 Jan 2022 16:56:42 +0100 To: Rob Herring CC: =?iso-8859-1?Q?M=E5rten?= Lindahl , Stephen Boyd , Frank Rowand , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck , kernel , "devicetree@vger.kernel.org" Subject: Re: [PATCH] of: fdt: Check overlap of reserved memory regions Message-ID: References: <20220111122111.3869046-1-marten.lindahl@axis.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: From: Marten Lindahl Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Tue, Jan 11, 2022 at 07:34:00PM +0100, Rob Herring wrote: > On Tue, Jan 11, 2022 at 6:25 AM Mårten Lindahl wrote: Hi Rob! Thanks for looking at this. > > > > If a DT specified reserved memory region overlaps an already registered > > reserved region no notification is made. Starting the system with > > overlapped memory regions can make it very hard to debug what is going > > wrong. This is specifically true in case the ramoops console intersects > > with initrd since the console overwrites memory that is used for initrd, > > which leads to memory corruption. > > > > Highlight this by printing a message about overlapping memory regions. > > Won't this be noisy if a region is described in both /memreserve/ and > /reserved-memory node? > Yes, it can potentially be noisy if doing so. But I think notifying this can be useful. Should it perhaps be a notification instead of a warning? Kind regards Mårten > > > > Signed-off-by: Mårten Lindahl > > --- > > drivers/of/fdt.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c > > index bdca35284ceb..c6b88a089b35 100644 > > --- a/drivers/of/fdt.c > > +++ b/drivers/of/fdt.c > > @@ -521,6 +521,11 @@ static int __init __reserved_mem_reserve_reg(unsigned long node, > > base = dt_mem_next_cell(dt_root_addr_cells, &prop); > > size = dt_mem_next_cell(dt_root_size_cells, &prop); > > > > + if (size && memblock_is_reserved(base)) { > > + pr_warn("WARNING: 0x%08llx+0x%08llx overlaps reserved memory region\n", > > + (u64)base, (u64)size); > > + } > > + > > if (size && > > early_init_dt_reserve_memory_arch(base, size, nomap) == 0) > > pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %lu MiB\n", > > -- > > 2.30.2 > >