Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp935089rdh; Sun, 24 Sep 2023 19:43:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVgZ3TfJxmLRUqFWe7+vcKUAiIDaHR1hPAyRS+pwAe/7cvC6Uf8cA+OewxBEqVqs+Ih4Zf X-Received: by 2002:a17:903:22cb:b0:1c6:11ca:8861 with SMTP id y11-20020a17090322cb00b001c611ca8861mr3089256plg.21.1695609836942; Sun, 24 Sep 2023 19:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695609836; cv=none; d=google.com; s=arc-20160816; b=pbkWbVFmPD5yG/HfLNNG9/wh3Exzg1cOea54T32MWuIAC5N45lxTjx85xK1yFfWxOs Z1aVJ34MZNCRgWywHupxuZiDvhXCgbLJ+7iZrPwX9nLvFzRXDGnupeH16r75864566uy z/7M7IC91TQrUyF5pEPoLVrolX6eAJkl/If9eWQQ6l1s6zqzxy/ysdYk3ExCUMQOkT/f VWAyWuJ9iD993vt9PKpATnw4XKQl2US6CV2mLdt4S6tsLmBlpCyt3vSkzf82EM44aV5e a9bphqSwgVw4DbpePTvDoijG9ESHq2v3vPcEE7zkiB0pfba1iIEjvyOaUZmTPwhg3Lzu q0LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=u67gd2Vui97aEwMYqT3oh6/x+WmOtleQp+WROZqglUU=; fh=SpN9CFJ/p0uuiqaD4wHkVoHbmmbtM5y2/it5hbgDvo4=; b=fZQyLNf9Ts3W9xYiHwihDve3tahfEBPN2F9ppU3B+dUGIcAXQ8CRYKWergJ+UMND93 wjDkihPWPbNvYEjX8VMejvLXc1KvA0LCna1oAz7vmIPsZEZ0ic9lm97pyxp+NC3Yqm7U t5rOPjcUHsu4UgG2/d+4Qq39UaQ8sPGX8aTfygiH99c/v8Jc1JVEhIWjmT9pioPRbRkS fHwU5W1I75qFQqHXSHbT/SPmTwgei33ZLTRDB2z4z8QhILOd4Y6fh1X4YqJYpW61yqok gyi44BAMboYcdzYHCDUib/cK64bXaLVsZqIWHaGP5A/yJ/w6cdSoVxoNlFXuVm7P8BhF rwbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id y23-20020a17090264d700b001c4e9d53501si8919995pli.372.2023.09.24.19.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 19:43:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 2934A801F954; Sun, 24 Sep 2023 19:43:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231826AbjIYCny (ORCPT + 99 others); Sun, 24 Sep 2023 22:43:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbjIYCny (ORCPT ); Sun, 24 Sep 2023 22:43:54 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33E6092 for ; Sun, 24 Sep 2023 19:43:46 -0700 (PDT) Received: from dggpemm500016.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rv6Y00FB5zMlpJ; Mon, 25 Sep 2023 10:40:04 +0800 (CST) Received: from huawei.com (10.67.174.58) by dggpemm500016.china.huawei.com (7.185.36.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 25 Sep 2023 10:43:44 +0800 From: Chen Jiahao To: , , , , , , , , , , , , , , , CC: Subject: [PATCH -next v2] riscv: kdump: fix crashkernel reserving problem on RISC-V Date: Mon, 25 Sep 2023 10:43:33 +0800 Message-ID: <20230925024333.730964-1-chenjiahao16@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.58] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500016.china.huawei.com (7.185.36.25) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 24 Sep 2023 19:43:54 -0700 (PDT) When testing on risc-v QEMU environment with "crashkernel=" parameter enabled, a problem occurred with the following message: [ 0.000000] crashkernel low memory reserved: 0xf8000000 - 0x100000000 (128 MB) [ 0.000000] crashkernel reserved: 0x0000000177e00000 - 0x0000000277e00000 (4096 MB) [ 0.000000] ------------[ cut here ]------------ [ 0.000000] WARNING: CPU: 0 PID: 0 at kernel/resource.c:779 __insert_resource+0x8e/0xd0 [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.0-rc2-next-20230920 #1 [ 0.000000] Hardware name: riscv-virtio,qemu (DT) [ 0.000000] epc : __insert_resource+0x8e/0xd0 [ 0.000000] ra : insert_resource+0x28/0x4e [ 0.000000] epc : ffffffff80017344 ra : ffffffff8001742e sp : ffffffff81203db0 [ 0.000000] gp : ffffffff812ece98 tp : ffffffff8120dac0 t0 : ff600001f7ff2b00 [ 0.000000] t1 : 0000000000000000 t2 : 3428203030303030 s0 : ffffffff81203dc0 [ 0.000000] s1 : ffffffff81211e18 a0 : ffffffff81211e18 a1 : ffffffff81289380 [ 0.000000] a2 : 0000000277dfffff a3 : 0000000177e00000 a4 : 0000000177e00000 [ 0.000000] a5 : ffffffff81289380 a6 : 0000000277dfffff a7 : 0000000000000078 [ 0.000000] s2 : ffffffff81289380 s3 : ffffffff80a0bac8 s4 : ff600001f7ff2880 [ 0.000000] s5 : 0000000000000280 s6 : 8000000a00006800 s7 : 000000000000007f [ 0.000000] s8 : 0000000080017038 s9 : 0000000080038ea0 s10: 0000000000000000 [ 0.000000] s11: 0000000000000000 t3 : ffffffff80a0bc00 t4 : ffffffff80a0bc00 [ 0.000000] t5 : ffffffff80a0bbd0 t6 : ffffffff80a0bc00 [ 0.000000] status: 0000000200000100 badaddr: 0000000000000000 cause: 0000000000000003 [ 0.000000] [] __insert_resource+0x8e/0xd0 [ 0.000000] ---[ end trace 0000000000000000 ]--- [ 0.000000] Failed to add a Crash kernel resource at 177e00000 The crashkernel memory has been allocated successfully, whereas it failed to insert into iomem_resource. This is due to the unique reserving logic in risc-v arch specific code, i.e. crashk_res/crashk_low_res will be added into iomem_resource later in init_resources(), which is not aligned with current unified reserving logic in reserve_crashkernel_{generic,low}() and therefore leads to the failure of crashkernel reservation. Removing the arch specific code within #ifdef CONFIG_KEXEC_CORE in init_resources() to fix above problem. Fixes: 31549153088e ("riscv: kdump: use generic interface to simplify crashkernel reservation") Signed-off-by: Chen Jiahao --- arch/riscv/kernel/setup.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index e600aab116a4..aac853ae4eb7 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -173,19 +173,6 @@ static void __init init_resources(void) if (ret < 0) goto error; -#ifdef CONFIG_KEXEC_CORE - if (crashk_res.start != crashk_res.end) { - ret = add_resource(&iomem_resource, &crashk_res); - if (ret < 0) - goto error; - } - if (crashk_low_res.start != crashk_low_res.end) { - ret = add_resource(&iomem_resource, &crashk_low_res); - if (ret < 0) - goto error; - } -#endif - #ifdef CONFIG_CRASH_DUMP if (elfcorehdr_size > 0) { elfcorehdr_res.start = elfcorehdr_addr; -- 2.34.1