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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D584C3DA59 for ; Fri, 19 Jul 2024 12:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qbbjKuhbbvUYpkBSuhBVInsptupV4f2A5Xnr2kbjA0o=; b=kIxo4pygFuOYTV7eeYn1ZPt5ok 1dsgNrYy6tnSwBA7/pxC81CEgc/k9wE7OA1VubIxC5cooP2dSL9abosWm52lNoP1W00gY3DjwSiVZ kjdYZJQ1/uHoQk/Lvzjbi76Top/PxBExQvZDSAuqtCrDX3yRR3T8LdcPwE1omBRxivb2HJrjc+i7+ OZRWAN+IMz7LfPxOcdEZnV3y/1P1swBbO8iF7V2BAUaZXEWIC5bD2bCrEmcLgDVXBocjpa8QXZXk1 Nz1TCF8/bJt9h1IgJ820ra+4wMKtRxVq1vgrzsG0DJuMzLegYTeuVMrFBEjWZyTCPlarSOk1ilSlW 1X4k8SSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUmm9-00000002e1U-0Lix; Fri, 19 Jul 2024 12:31:53 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUmll-00000002dtd-1x2o for linux-arm-kernel@lists.infradead.org; Fri, 19 Jul 2024 12:31:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721392286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qbbjKuhbbvUYpkBSuhBVInsptupV4f2A5Xnr2kbjA0o=; b=XrfySA1I23mysgiw/ilgHVFRJ8iJJIJPEMQkOa4Vi9Em04AOXyOxgU52Y4qaE/BUCHDwWc 7ZZn2puBMduHuDBmNzE1K2YQZ3D2KRkYs++sarzh6jE07ZkV4t+/TuJJXcVcpkNbEOjhuD l9Qb7vbzjfBtuBC6epl63YQbcn31qoE= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-329-EXZgBTCeMM-_M4_CybQBlA-1; Fri, 19 Jul 2024 08:31:24 -0400 X-MC-Unique: EXZgBTCeMM-_M4_CybQBlA-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5C09D1955F41; Fri, 19 Jul 2024 12:31:14 +0000 (UTC) Received: from localhost (unknown [10.72.112.23]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7787119560B2; Fri, 19 Jul 2024 12:30:55 +0000 (UTC) Date: Fri, 19 Jul 2024 20:29:18 +0800 From: Baoquan He To: Jinjie Ruan Cc: linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, chenhuacai@kernel.org, kernel@xen0n.name, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, vgoyal@redhat.com, dyoung@redhat.com, arnd@arndb.de, afd@ti.com, akpm@linux-foundation.org, linus.walleij@linaro.org, eric.devolder@oracle.com, gregkh@linuxfoundation.org, javierm@redhat.com, deller@gmx.de, robh@kernel.org, thunder.leizhen@huawei.com, hbathini@linux.ibm.com, tangyouling@kylinos.cn, chenjiahao16@huawei.com, kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v4 2/3] crash: Fix x86_32 crash memory reserve dead loop Message-ID: References: <20240719095735.1912878-1-ruanjinjie@huawei.com> <20240719095735.1912878-3-ruanjinjie@huawei.com> MIME-Version: 1.0 In-Reply-To: <20240719095735.1912878-3-ruanjinjie@huawei.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240719_053129_588172_5B697D65 X-CRM114-Status: GOOD ( 21.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 07/19/24 at 05:57pm, Jinjie Ruan wrote: > On x86_32 Qemu machine with 1GB memory, the cmdline "crashkernel=512M" will > also cause system stall as below: > > ACPI: Reserving FACP table memory at [mem 0x3ffe18b8-0x3ffe192b] > ACPI: Reserving DSDT table memory at [mem 0x3ffe0040-0x3ffe18b7] > ACPI: Reserving FACS table memory at [mem 0x3ffe0000-0x3ffe003f] > ACPI: Reserving APIC table memory at [mem 0x3ffe192c-0x3ffe19bb] > ACPI: Reserving HPET table memory at [mem 0x3ffe19bc-0x3ffe19f3] > ACPI: Reserving WAET table memory at [mem 0x3ffe19f4-0x3ffe1a1b] > 143MB HIGHMEM available. > 879MB LOWMEM available. > mapped low ram: 0 - 36ffe000 > low ram: 0 - 36ffe000 > (stall here) > > The reason is that the CRASH_ADDR_LOW_MAX is equal to CRASH_ADDR_HIGH_MAX > on x86_32, the first "low" crash kernel memory reservation for 512M fails, > then it go into the "retry" loop and never came out as below (consider > CRASH_ADDR_LOW_MAX = CRASH_ADDR_HIGH_MAX = 512M): > > -> reserve_crashkernel_generic() and high is false > -> alloc at [0, 0x20000000] fail > -> alloc at [0x20000000, 0x20000000] fail and repeatedly > (because CRASH_ADDR_LOW_MAX = CRASH_ADDR_HIGH_MAX). > > Fix it by skipping meaningless calls of memblock_phys_alloc_range() with > `start = end` > > After this patch, the retry dead loop is avoided and print below info: > cannot allocate crashkernel (size:0x20000000) > > And apply generic crashkernel reservation to 32bit system will be ready. ~~~ applying Other than this nit, it looks good to me. Acked-by: Baoquan He > > Fixes: 9c08a2a139fe ("x86: kdump: use generic interface to simplify crashkernel reservation code") > Signed-off-by: Jinjie Ruan > Suggested-by: Baoquan He > --- > v4: > - Signed-off-by -> Suggested-by as suggested. > - Remove the Tested-by as suggested. > - Update the commit subject > v3: > - Fix it as Baoquan suggested. > - Update the commit message. > --- > kernel/crash_reserve.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/crash_reserve.c b/kernel/crash_reserve.c > index c5213f123e19..dacc268429e2 100644 > --- a/kernel/crash_reserve.c > +++ b/kernel/crash_reserve.c > @@ -414,7 +414,8 @@ void __init reserve_crashkernel_generic(char *cmdline, > search_end = CRASH_ADDR_HIGH_MAX; > search_base = CRASH_ADDR_LOW_MAX; > crash_low_size = DEFAULT_CRASH_KERNEL_LOW_SIZE; > - goto retry; > + if (search_base != search_end) > + goto retry; > } > > /* > -- > 2.34.1 >