Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2972049rdb; Sat, 9 Dec 2023 06:23:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcYKjoLW1wXFN7KQT/9Pg26V3cZbI4X+BV95nv6g5mUUYVFyARyjnLm+J0QNeQgQediUAy X-Received: by 2002:a17:90a:6607:b0:285:a163:c25b with SMTP id l7-20020a17090a660700b00285a163c25bmr892413pjj.5.1702131803028; Sat, 09 Dec 2023 06:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702131803; cv=none; d=google.com; s=arc-20160816; b=bV/OXdQedITA3bVRHFsc/kkuDl1Lvluk6dAbJqD70jSug3+Wy5NSy3791SXMA1mWI2 NPhZf4y4IEec0iJRD2NX68JZUbJm31MKjOI423vwiGTyN/IPrmEkoaZDiGK1H2c8CR/X Mq2bQP7Wqi9sIxiNn/hWwrwN446fCb9ENAEi1iRZAR0Ip3WvWDKZjAddAJK/030B4sMz 6h68mHfawetTqnYdI/DVxg/441klaKKQh9h8GouBgLlDxFtV8dOYpFTEZHQe33HUeb2h BPQATDodtYUFAmR6lVDm+gV+W7Vmg7b2GrraCjO2bGtYzJNY4RM55L0x0rhuIFUFfNsz OT2Q== 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:dkim-signature; bh=dOqfTtQ7ulCx2hj31UovM4Dg0r3q4oUpbgRbtAdcj1A=; fh=L36rGnJjUVbpNjCVB5j5a/bzP72c+Y/LdumPUtE95Pk=; b=AvpMnTPqtrakDMkQ7ynatIYTaydw0+lK4aOaOzgQi3QUg3EQxMJ+cJHA8S6lae2rqt Cq2rBI2WxWe78V2hiOU/BuYFTWa9z7vGtMG0lJUcGM9vVxzzwAHi6JVCx3wkFXEqQ8f7 JHizsUc9AyLhOVI5O3yPTHOhknTDTQD5VkLGfTKObTr9vqLOSuumq0MBzJjrqG81H/yv jIgCsAf/xFY120GzApo6Sv6FixR6Ytj47msuZnF8x26WSSTX3jpEvjVVvvhHvNLGiwD6 Ce5/cSuZQtOcKZLAeTJLKHilqFC2vIcFlt0PMfSQMIUkiZt+0nvqAc/6qJP8TgseqLv9 hHJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TZwV+7h1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id l7-20020a17090a850700b00286c7b26eb0si4574184pjn.70.2023.12.09.06.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 06:23:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=TZwV+7h1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E0BAE805ED36; Sat, 9 Dec 2023 06:23:20 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbjLIOPN (ORCPT + 99 others); Sat, 9 Dec 2023 09:15:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjLIOPM (ORCPT ); Sat, 9 Dec 2023 09:15:12 -0500 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AE4910E6 for ; Sat, 9 Dec 2023 06:15:19 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6ce76f0748fso2088268b3a.2 for ; Sat, 09 Dec 2023 06:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702131318; x=1702736118; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=dOqfTtQ7ulCx2hj31UovM4Dg0r3q4oUpbgRbtAdcj1A=; b=TZwV+7h1mfOyMA/bfmKRVLiMrfIRwD/xd4vsdJKvCoqDHnpSMIxsrC2PnUgjgwPrbc koax3n9bkZ13o0jSgmxWorZzYXI7x4lQi0VZch7ISjntL/Hta4VTeTzav/CUgkyVO5Af 7VIe1jiNxrLjrWSaQ1mf6O+vafX5f+wH0aJIvH/2hftcSUuCqxbSd7xMr8hUrULMXQ1X ShGtNZ4OldFLh9qXwwgPLCjrlIgcGAWTjcjo51zE/CHUgd3nxV/1ROyCsC6Xluot8K9z elo0jBcPFfdYwV+FH/m138UF7ntnjbgMgVJ0IvFEh7G6pbfeqPRgZnt/hs3rxNVxIu2Z h/Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702131318; x=1702736118; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dOqfTtQ7ulCx2hj31UovM4Dg0r3q4oUpbgRbtAdcj1A=; b=dszqdCDemZxztYAsluXWQgDwa/+/xpodsWHhf245a7HKLhxm59Ht0xNB+786l4d/hZ wHKvQrbQKEfXERM4C8KZtMMmhiGbfZBI/ZHI7TFOXOrb8nTarSuyD0mEXHMUapLWl9A2 ZEFN15oDiR6vlDhYT9kPARF+6Z6J56Q0KBDV+mucKzCFxQbSZxelKPTg9opxzzw70a2u NVNkxrOL8DgFGFhPCcEwMzKJX/6p5zheOaqf8HHMi/pa9DsqkdBnghYpImydIR7KJWGe VsAYWK0xjiL8nRYi2oCkv4hFwlj4GdNd35fxsJXrwIO3NR2jFgtyqFeGocl+B0lafYHf kccQ== X-Gm-Message-State: AOJu0YyyPWx8IAhR1UmmKaS6TFzT+NGpUOk5/cRmWCQpT2/IKNx8gMbZ 7oXXpSZ9/8n+UWozeaXlsJ6qXHuWl34= X-Received: by 2002:a05:6a20:7fa6:b0:18f:dde5:7211 with SMTP id d38-20020a056a207fa600b0018fdde57211mr861786pzj.7.1702131318201; Sat, 09 Dec 2023 06:15:18 -0800 (PST) Received: from code.. ([144.202.108.46]) by smtp.gmail.com with ESMTPSA id m2-20020a635802000000b005b6c1972c99sm3281644pgb.7.2023.12.09.06.15.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Dec 2023 06:15:17 -0800 (PST) From: Yuntao Wang To: linux-kernel@vger.kernel.org, kexec@lists.infradead.org Cc: Baoquan He , Vivek Goyal , Dave Young , Zhen Lei , Andrew Morton , Yuntao Wang Subject: [PATCH] crash_core: Fix the check for whether crashkernel is from high memory Date: Sat, 9 Dec 2023 22:14:38 +0800 Message-ID: <20231209141438.77233-1-ytcoode@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Sat, 09 Dec 2023 06:23:21 -0800 (PST) If crash_base is equal to CRASH_ADDR_LOW_MAX, it also indicates that the crashkernel memory is allocated from high memory. However, the current check only considers the case where crash_base is greater than CRASH_ADDR_LOW_MAX. Fix it. This patch also includes some minor cleanups. Fixes: 0ab97169aa05 ("crash_core: add generic function to do reservation") Signed-off-by: Yuntao Wang --- kernel/crash_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index efe87d501c8c..d4313b53837e 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -199,7 +199,7 @@ static __initdata char *suffix_tbl[] = { * It returns 0 on success and -EINVAL on failure. */ static int __init parse_crashkernel_suffix(char *cmdline, - unsigned long long *crash_size, + unsigned long long *crash_size, const char *suffix) { char *cur = cmdline; @@ -268,9 +268,9 @@ static int __init __parse_crashkernel(char *cmdline, unsigned long long *crash_base, const char *suffix) { - char *first_colon, *first_space; - char *ck_cmdline; - char *name = "crashkernel="; + char *first_colon, *first_space; + char *ck_cmdline; + char *name = "crashkernel="; BUG_ON(!crash_size || !crash_base); *crash_size = 0; @@ -440,7 +440,7 @@ void __init reserve_crashkernel_generic(char *cmdline, return; } - if ((crash_base > CRASH_ADDR_LOW_MAX) && + if ((crash_base >= CRASH_ADDR_LOW_MAX) && crash_low_size && reserve_crashkernel_low(crash_low_size)) { memblock_phys_free(crash_base, crash_size); return; -- 2.43.0