From patchwork Wed Oct 9 19:47:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Woods X-Patchwork-Id: 11182031 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8D911668 for ; Wed, 9 Oct 2019 19:50:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C2A4520B7C for ; Wed, 9 Oct 2019 19:50:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="YgE1oYUa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C2A4520B7C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iIHwo-0003qF-OX; Wed, 09 Oct 2019 19:48:34 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iIHwn-0003pF-KP for xen-devel@lists.xenproject.org; Wed, 09 Oct 2019 19:48:33 +0000 X-Inumbo-ID: c5e081c0-eacd-11e9-8c93-bc764e2007e4 Received: from NAM01-SN1-obe.outbound.protection.outlook.com (unknown [40.107.82.70]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id c5e081c0-eacd-11e9-8c93-bc764e2007e4; Wed, 09 Oct 2019 19:48:32 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O0O59CdmHuwlkmz6l8qipzEGoGk1EEk54oC1rio4SLb1yBOXUjofn+B9kud+y7/xC0Zc2fUG3mqBmOABFKVyLDyM5AFIan/+IvII6qVXhfYZ4uTmWos81ov+1o7uQ+QPYr2/LRooCiU4q0T75RsSv0cACvE2KXNUzrfYwAHznf1cM9T2zOTLqZRyFDtSuEPQuN5VBySOtLzLGMVFYtV7TwCZpza3MfXsMboANoZMMiugTAmBV7HXk+Fm3Lo+NFMHcv7aOm9r0LlBmFbQgLv+glptPAYYghqvy+stqbkpcyo+bLe/p7SOLAlO9jxOJZHICO+7ZP/p6mCe2iDBExjB7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lWBpE0pKeR2Jk4Lh4QmLckDhf4gzK1hkXZqsFTE2UVU=; b=LM6Xts8uZ1/3tfz2ibCTk9lW+AR1M6PTqhE1nST3nCqt1HEFsspPBq4O9rQGvPyLZ4N/Gai6WFkiPp/uTMW2klU+YM14/g1hrT3wbXRfWM6AtNcfTxCuXhJ2Q0VSMu2s9p2ZdRd2lkCgRXDk7FV38Csxm6RtqDc5RIFvjrfynsgxko/estFM6/soKH/h35TR7E4NRiVDywoTBXf7OraCLXUNkXB8wT4l4Gc4soADRepB2T0U+owGWxCtvpngAATEY9+r2PaGuEw20msbagj36rgeaf9rxk67CK+480f/qE3oO5oBzh70msY9NI3/zW7J2J02M7AsC0VH51rMI25Dxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=epam.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lWBpE0pKeR2Jk4Lh4QmLckDhf4gzK1hkXZqsFTE2UVU=; b=YgE1oYUaeRcNEnLupeMoVLeJhWhPAxBAnGU9r+nWkP69/f8qRGLzcOOjZlOpvir/fr1lAxottg0BCPzd4VEi1M6t+RqvVPqA6xDl2OJVOdx0J8GMg3mGSrfVYoUk9Un70yzo0ME6zCnfsTF42GabUdCdHq0oHlzydF3xI0LToRg= Received: from SN6PR02CA0034.namprd02.prod.outlook.com (2603:10b6:805:a2::47) by BN7PR02MB5332.namprd02.prod.outlook.com (2603:10b6:408:30::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Wed, 9 Oct 2019 19:48:28 +0000 Received: from CY1NAM02FT008.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::209) by SN6PR02CA0034.outlook.office365.com (2603:10b6:805:a2::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2220.19 via Frontend Transport; Wed, 9 Oct 2019 19:48:28 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; epam.com; dkim=none (message not signed) header.d=none;epam.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT008.mail.protection.outlook.com (10.152.75.59) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2347.16 via Frontend Transport; Wed, 9 Oct 2019 19:48:27 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iIHwh-0002be-Ah; Wed, 09 Oct 2019 12:48:27 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iIHwc-00051T-6X; Wed, 09 Oct 2019 12:48:22 -0700 Received: from xsj-pvapsmtp01 (smtp-fallback.xilinx.com [149.199.38.66] (may be forged)) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id x99JmK32024453; Wed, 9 Oct 2019 12:48:20 -0700 Received: from [172.19.2.62] (helo=xsjwoods50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iIHwZ-00050c-Uj; Wed, 09 Oct 2019 12:48:19 -0700 From: Brian Woods To: xen-devel@lists.xenproject.org Date: Wed, 9 Oct 2019 12:47:27 -0700 Message-Id: <1570650447-3225-1-git-send-email-brian.woods@xilinx.com> X-Mailer: git-send-email 2.7.4 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(189003)(199004)(8676002)(36756003)(70586007)(54906003)(47776003)(26005)(2906002)(50226002)(81156014)(186003)(14444005)(81166006)(106002)(70206006)(9786002)(498600001)(2616005)(126002)(16586007)(476003)(486006)(50466002)(7696005)(44832011)(336012)(2361001)(6916009)(305945005)(48376002)(51416003)(5660300002)(6666004)(356004)(2351001)(36386004)(8936002)(86362001)(4326008)(426003)(42866002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR02MB5332; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; MX:1; A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5facd43-7874-4cf2-d839-08d74cf1a7b6 X-MS-TrafficTypeDiagnostic: BN7PR02MB5332: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:765; X-Forefront-PRVS: 018577E36E X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LtSO/dGUSHU0SJsZLJITnbaGmGtXAzPwAmab6kMvazpfPzlcw4sR8+Sr2ryJ15fQeejAKi3NZgdCTL5XtIbhnK9nAyfvQQatdZ0X4WzE9oygqCIvaTec9mRzgMwFaGr6Rke15u+oKDD1DhAnLsRQwKp9FopqTxzrc6xsK6OMMVZRToMMZXim8pChbj2M1lbms4DXAI30Y9FLawuXZjDL0Jia7UwXV8w2QWBJbuQU6n5B+jwXAlRIFmbkhOHbpA5B1zbQ/cH+N6xLVmOwmImDv77LXzAwEjaNmCskuq/eD3tCTD462ZBAba2jWVuWu1lp3cmBQHM09RhHzE52k158JqA8xWHGoIUu+Zumtfofx9L/To3UBk47YBwXroY2sBvyCQPOAEZyfQA2KDEWO+dNJ7J+EV4/tUlWNFC0EDsBPOQ= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2019 19:48:27.8419 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5facd43-7874-4cf2-d839-08d74cf1a7b6 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB5332 Subject: [Xen-devel] [PATCH] xen/arm: add warning if memory modules overlap X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Brian Woods , Stefano Stabellini , Julien Grall , Volodymyr Babchuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" It's possible for a misconfigured device tree to cause Xen to crash when there are overlapping addresses in the memory modules. Add a warning when printing the addresses to let the user know there's a possible issue when DEBUG is enabled. Signed-off-by: Brian Woods --- sample output: ... (XEN) MODULE[0]: 0000000001400000 - 000000000153b8f1 Xen (XEN) MODULE[1]: 00000000076d2000 - 00000000076dc080 Device Tree (XEN) MODULE[2]: 00000000076df000 - 0000000007fff364 Ramdisk (XEN) MODULE[3]: 0000000000080000 - 0000000003180000 Kernel (XEN) RESVD[0]: 00000000076d2000 - 00000000076dc000 (XEN) RESVD[1]: 00000000076df000 - 0000000007fff364 (XEN) (XEN) WARNING: modules Xen and Kernel overlap (XEN) (XEN) Command line: console=dtuart dtuart=serial0 dom0_mem=1G bootscrub=0 maxcpus=1 timer_slop=0 ... xen/arch/arm/bootfdt.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index 08fb59f..3cb0c43 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -387,6 +387,23 @@ static void __init early_print_info(void) mem_resv->bank[j].start + mem_resv->bank[j].size - 1); } printk("\n"); + +#ifndef NDEBUG + /* + * Assuming all combinations are checked, only the starting address + * has to be checked if it's in another memory module's range. + */ + for ( i = 0 ; i < mods->nr_mods; i++ ) + for ( j = 0 ; j < mods->nr_mods; j++ ) + if ( (i != j) && + (mods->module[i].start >= mods->module[j].start) && + (mods->module[i].start < + mods->module[j].start + mods->module[j].size) ) + printk("WARNING: modules %-12s and %-12s overlap\n", + boot_module_kind_as_string(mods->module[i].kind), + boot_module_kind_as_string(mods->module[j].kind)); +#endif + for ( i = 0 ; i < cmds->nr_mods; i++ ) printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start, cmds->cmdline[i].dt_name,