Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2926839rdb; Mon, 4 Dec 2023 11:14:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEt4pQyRpJRSzaNgFRILkDcobdo7lrXx6DaygGz7vZCDhS1+q8DNXmOuSwmUZkKpBDXxgfB X-Received: by 2002:a05:6358:9141:b0:170:17eb:14b8 with SMTP id r1-20020a056358914100b0017017eb14b8mr2144283rwr.40.1701717258582; Mon, 04 Dec 2023 11:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701717258; cv=none; d=google.com; s=arc-20160816; b=fyMcDP6kmSEGCylvDmhZa65whmRsWuwkiIJVRP9s+9x7iFQzVLunE+9YxnUQx7A06s hUoSslopTT9KVVhjhZidAYgN/LqNUsd3wZIH02Pbo9ha/+1LdoS4Ch/Ncu1nwe7XtWC0 A4XmqpRZd2ctF6DqJ2VF1y1prvLIw4xdzf8Wc59fOfz6RA3c83V4EzqHIKqq4vg72znP n6UeEQ4PKfxR6UgBEh3ojkCc3+ovUXFHUlLL5D+h6Smn3w7Y04GzGblm4ivrqbM/F9Yk BNfdEvuizytcrssWjgNOqVsLkTt/P0dwe4Ti3pcbD96uipE44N/8SwYOWFxIKKnIHs5c S/nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=KckcuocL2z013G2jrCsZXwyF7IERThcABs04nHeio4Q=; fh=QNAU/5NZxVvp2DlElz/Hms8qzlAVfxtJgUuaY402hro=; b=rqhhWmCh9VtbBw4+lGJC09z6xaq/5WEP+0uUoDeOGn9EMdxs5Z8eTvbYhim1qPU/iu 5zH8GrR0NG2IcC9DDPGALWbMHH/nOebiY0EyDq75zpC4IWw7r3/KTnH4GFLEAY5A8Q0i 0FM0fYKB/OBqRzo/MlziVtxTy7djjZojbwRlzi2X1EbwSaQxyQemPCEkmyW5FR8Ke+ZZ 9h3pAA2df9L8gMRRcPRUW6LuO25K5xFb65NSKgY4ogC47nKJZWODeZQhthdb/HN3eDs1 OAkyWxKj5rUdptF8HpPlVAo5lVWqSyrWmFXGK37J9h3d711gN/ntgQdP95b1Wjh+nFxj RCsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uLGPocLJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b7-20020a655cc7000000b005b96c4292bbsi8104158pgt.420.2023.12.04.11.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 11:14:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uLGPocLJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id EB0AC809BBB5; Mon, 4 Dec 2023 11:14:15 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232908AbjLDTOC (ORCPT + 99 others); Mon, 4 Dec 2023 14:14:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231462AbjLDTOB (ORCPT ); Mon, 4 Dec 2023 14:14:01 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8EE2E6; Mon, 4 Dec 2023 11:14:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=KckcuocL2z013G2jrCsZXwyF7IERThcABs04nHeio4Q=; b=uLGPocLJryyVBdclvJmHRrEnpC YndbkH1IgbGIOzzYzSwEKth5SwUHdzaHgzpTN9eMopfPocO6/lTlWXIYz+D0bfuZq8dJQpUBKZzPX 6wQYf6WjajFJ/LCT01aQ+9ieH2dJMcVNqee+608ZySrxSiUcrdjXtVpRl+pKDvy+qtgrJpGTmVNNp wCiqHi9roalMj7f1uoNq82hjk3rFGoa2fUeV8SYMYZXVK4Z+dH6ilGlAGSPRQPAmb65llmza0tRVo Si7PliuCEBT29WN0umlmDS9EVfCkY6xv5yYuQHKyrsTCYP0kQAZlfY8uzJEdyMecnP05yrFtBN4gR SZyMXzWg==; Received: from [50.53.46.231] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rAEOJ-005QO4-3B; Mon, 04 Dec 2023 19:14:04 +0000 Message-ID: <694baf13-65d0-4877-b6c7-56e3006f83be@infradead.org> Date: Mon, 4 Dec 2023 11:14:03 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Content-Language: en-US To: Baoquan He Cc: Stephen Rothwell , akpm@linux-foundation.org, ignat@cloudflare.com, linux-next@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org, eric_devolder@yahoo.com References: From: Randy Dunlap In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 groat.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 (groat.vger.email [0.0.0.0]); Mon, 04 Dec 2023 11:14:16 -0800 (PST) On 12/3/23 18:19, Baoquan He wrote: > When dropping select of KEXEC and dependency on ARCH_SUPPORTS_KEXEC > from CRASH_DUMP, compiling error is reported when below config items are > set: > ----------------------- > CONFIG_CRASH_CORE=y > CONFIG_KEXEC_CORE=y > CONFIG_CRASH_DUMP=y > ...... > ----------------------- > [] > > Currently, riscv's ARCH_SUPPORTS_KEXEC has dependency on MMU. Before > dropping ARCH_SUPPORTS_KEXEC, disabling CONFIG_MMU will unset > CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, CONFIG_CRASH_CORE. Hence > crash_core related codes won't be compiled. > > --------------------- > arch/riscv/Kconfig: > config ARCH_SUPPORTS_KEXEC > def_bool MMU > --------------------- > > After dropping ARCH_SUPPORTS_KEXEC, CONFIG_CRASH_DUMP, CONFIG_KEXEC_CORE, > CONFIG_CRASH_CORE can be set independently of CONFIG_MMU. However, there > are several macro definitions, such as VA_BITS, VMEMMAP_START, VMEMMAP_END, > MODULES_VADDR, MODULES_END are only available when CONFIG_MMU=y. Then > compiling errors are triggered. > > Here, add CONFIG_MMU ifdeffery in arch_crash_save_vmcoreinfo() to export > those symbols when CONFIG_MMU is enabled. > > Signed-off-by: Baoquan He > --- > arch/riscv/kernel/crash_core.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/riscv/kernel/crash_core.c b/arch/riscv/kernel/crash_core.c > index 55f1d7856b54..8706736fd4e2 100644 > --- a/arch/riscv/kernel/crash_core.c > +++ b/arch/riscv/kernel/crash_core.c > @@ -5,17 +5,19 @@ > > void arch_crash_save_vmcoreinfo(void) > { > - VMCOREINFO_NUMBER(VA_BITS); > VMCOREINFO_NUMBER(phys_ram_base); > > vmcoreinfo_append_str("NUMBER(PAGE_OFFSET)=0x%lx\n", PAGE_OFFSET); > vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START); > vmcoreinfo_append_str("NUMBER(VMALLOC_END)=0x%lx\n", VMALLOC_END); > +#ifdef CONFIG_MMU > + VMCOREINFO_NUMBER(VA_BITS); > vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); > vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); > #ifdef CONFIG_64BIT > vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR); > vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END); > +#endif > #endif > vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR); > vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n", Both riscv 32-bit and 64-bit complain: ../arch/riscv/kernel/crash_core.c: In function 'arch_crash_save_vmcoreinfo': ../arch/riscv/kernel/crash_core.c:11:58: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'int' [-Wformat=] 11 | vmcoreinfo_append_str("NUMBER(VMALLOC_START)=0x%lx\n", VMALLOC_START); | ~~^ | | | long unsigned int | %x Otherwise this builds without failure. Tested-by: Randy Dunlap # build-tested Thanks. -- ~Randy