From patchwork Mon Dec 4 02:19:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 173042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2510050vqy; Sun, 3 Dec 2023 18:20:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IEV4YNvdho5soL1c4hZ5Avd7jztAPdoFjVMMRCD8F7QnXUkS3O7uuHDVd06ntrbz/7OSOSJ X-Received: by 2002:a17:903:2352:b0:1d0:6ffd:cea3 with SMTP id c18-20020a170903235200b001d06ffdcea3mr1530069plh.92.1701656401456; Sun, 03 Dec 2023 18:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701656401; cv=none; d=google.com; s=arc-20160816; b=ANIzONeSa4HPGQfApUGFFmc2E84SfLR9cpmVHIzwUA6ZtfcUFaN0qlndYfpq8UttxR BWvnQE2sIzNwIrd8ft6/qMg2EHVIAprAVwirexSoihHASCe3vT8hkqywy1Td/DysMH7c 4BcNXpxArmG8hm2KopXuNS2xnRz4Uf9cNy9mYl0MzpZeAT3RrmDAWtCngf98kZcsy+dG POg0vVDJxKgT2sk/CwdBzSzu877NC0s2vweomUvbAswyUXfYgI5ipYRwMlRYJDYK3CTX PBYP6WpVz+UvDPnAIyIGg5noTffXygI8z9f2wKDYnmjg8qHBqGbJusdDimja85gU/aDT Camw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kEYLn+UWJXzVvOdXDQoSl0HV2uxdkFhIxrNZEqvidvw=; fh=HAejCrz4htgyq+AHWa8EfdAgsX8pXGw7u/85G1yKZnc=; b=MH6XbGOd1PPDzRxrAFH1cBrR1ty7/oPecoS2rjjgHW1yRwFtZod4UnzVWeb8aq/WFp Q3OMLTnoZCHxsAipjFO4j2HX630F+VRHTCRu+OWKBoOP8zhn1SQPz8SBUJ5zDW0JEwQg 7LrvfQwyPNjAkokPYCdl0sh6erGbtITxFSLHGqBemuUpHkBVpo0ZiLUNdW4vuZZVes3v lR3A+ZBdMDXOrso6ORAc6jNxavheAPMmAuD/2ouG2A8MJpbqnRJ7nYE9EXQm1OtDKUQa JRZcrkeAYHLrucae22RDRj7aKFX6MTuPQ918BfE77T5ibNahPWMbeAcLTiI7tPRJB0gZ Th/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MGJi+Zdr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m3-20020a170902bb8300b001cff624a64asi1566839pls.532.2023.12.03.18.20.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 18:20:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MGJi+Zdr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id E525880725E1; Sun, 3 Dec 2023 18:19:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234275AbjLDCTt (ORCPT + 99 others); Sun, 3 Dec 2023 21:19:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjLDCTs (ORCPT ); Sun, 3 Dec 2023 21:19:48 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F73BC3 for ; Sun, 3 Dec 2023 18:19:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701656387; 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=kEYLn+UWJXzVvOdXDQoSl0HV2uxdkFhIxrNZEqvidvw=; b=MGJi+ZdrtezuwyY2qyF5EBGsmAYOd8JTuD/nQx4+mPQhTMbVtYolzvhjpNQis6Lons6MHU 4ESNJ5sOruQ9AsgPBwPPWrYb27ojydSl3iSKkw/+vuU4nX+dT7We+8GW3drN5a5aKEW/dx 77QewwRWPfVed8C3Ue9vLIQ2erHiU94= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-527-IJdQXgyNMci1xrid06S4Qw-1; Sun, 03 Dec 2023 21:19:41 -0500 X-MC-Unique: IJdQXgyNMci1xrid06S4Qw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id F151E1C041BF; Mon, 4 Dec 2023 02:19:40 +0000 (UTC) Received: from localhost (unknown [10.72.113.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F2A9492BFC; Mon, 4 Dec 2023 02:19:39 +0000 (UTC) Date: Mon, 4 Dec 2023 10:19:36 +0800 From: Baoquan He To: Randy Dunlap 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 Subject: [PATCH 1/2] riscv, crash: don't export some symbols when CONFIG_MMU=n Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 03 Dec 2023 18:19:58 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784316062843770649 X-GMAIL-MSGID: 1784316062843770649 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 ...... ----------------------- ------------------------------------------------------------------------------------------------- arch/riscv/kernel/crash_core.c:8:27: error: 'VA_BITS' undeclared (first use in this function) 8 | VMCOREINFO_NUMBER(VA_BITS); | ^~~~~~~ include/linux/crash_core.h:78:64: note: in definition of macro 'VMCOREINFO_NUMBER' 78 | vmcoreinfo_append_str("NUMBER(%s)=%ld\n", #name, (long)name) | ^~~~ arch/riscv/kernel/crash_core.c:14:64: error: 'VMEMMAP_START' undeclared (first use in this function) 14 | vmcoreinfo_append_str("NUMBER(VMEMMAP_START)=0x%lx\n", VMEMMAP_START); | ^~~~~~~~~~~~~ arch/riscv/kernel/crash_core.c:15:62: error: 'VMEMMAP_END' undeclared (first use in this function); did you mean 'MEMREMAP_ENC'? 15 | vmcoreinfo_append_str("NUMBER(VMEMMAP_END)=0x%lx\n", VMEMMAP_END); | ^~~~~~~~~~~ | MEMREMAP_ENC arch/riscv/kernel/crash_core.c:17:64: error: 'MODULES_VADDR' undeclared (first use in this function) 17 | vmcoreinfo_append_str("NUMBER(MODULES_VADDR)=0x%lx\n", MODULES_VADDR); | ^~~~~~~~~~~~~ arch/riscv/kernel/crash_core.c:18:62: error: 'MODULES_END' undeclared (first use in this function) 18 | vmcoreinfo_append_str("NUMBER(MODULES_END)=0x%lx\n", MODULES_END); ------------------------------------------------------------------------------------------------- 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 Tested-by: Randy Dunlap # build-tested Signed-off-by: Baoquan He Reported-by: Randy Dunlap Acked-by: Randy Dunlap Tested-by: Randy Dunlap # build-tested --- 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", From patchwork Mon Dec 4 02:23:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 173044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp2511384vqy; Sun, 3 Dec 2023 18:23:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDBFapmDCR+0SyulsKhrKblkWM5OZKvrgsSwUJtWrBtjELNp32r6YXmpxRfNRffLdnADY5 X-Received: by 2002:a05:6358:281e:b0:16e:34f4:185b with SMTP id k30-20020a056358281e00b0016e34f4185bmr4800173rwb.20.1701656616891; Sun, 03 Dec 2023 18:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701656616; cv=none; d=google.com; s=arc-20160816; b=SZkHVVudzJ4Nbu8j6zY6Q1UvqmEvNIYddol8fF+0R0P588LnvSCk6KEzH+PG+/ar1b qIlu+U1rKJvwyvH4nJSD7OzGzsRbngiY9boU2r7Xc9rhgTBn8UqHk3Eyzrv9LnG8Pqd2 0Sam3zLA/g6TK9yipCAjYa3UMYO5WzmdLCAh8Aj4bTctGh0vwCLAe+I4HAw4LbAHsd5E /qDjSgcvEG/7s1XQeN/eVhYj8id6yKVPLRUKoKS1BCYTnyf9bUsyBIIo6Pr0bVjphjzV aQWn9ydUqVPGcmlV2oHtNV/5YUkwbTYZIZrRbQjs5BL8WKbNx8nRYQqGdQnWx0xDc1e0 QHtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N3oj/lBQzpBpheCv8g6m9tnnqQ9YL5qzNhLYbMSq4hU=; fh=HAejCrz4htgyq+AHWa8EfdAgsX8pXGw7u/85G1yKZnc=; b=YAeDRWsizgPkDEFa63WE06HtVO+ffmBRFvMLrwX51dVhf+4naLuNsrd9YaDT7U9o4p CddyUClbeguSEyQFMVjqq5PL68lxdn12ZTvswYt7i898g9zlWMWyOPhKAnaU6iIBxu0z 6pMiILAXBekmAlNvQy7i0i/Xnnb5nIkHgmkbKqbyV6R43fTIwphKxnYWCUCP04fWzL0F taYfD0bGhg35vvHaAxtEfWeHx3U4MIuADHM/zyPPZ3nz7Lp2KmFcfEg1gpxMinAvFUsk 7tvuGZKkeCXHLHVgpRUiFIy509kMEKZn8RNxVoQltYzDlmNPMw9pEI3JUXnFafqxPerH xQpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SIKrtVdD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id k15-20020aa788cf000000b0068fe0f46f27si7158935pff.171.2023.12.03.18.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 18:23:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SIKrtVdD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 2D4DE8072442; Sun, 3 Dec 2023 18:23:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234331AbjLDCXZ (ORCPT + 99 others); Sun, 3 Dec 2023 21:23:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbjLDCXY (ORCPT ); Sun, 3 Dec 2023 21:23:24 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BB0FCB for ; Sun, 3 Dec 2023 18:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701656609; 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=N3oj/lBQzpBpheCv8g6m9tnnqQ9YL5qzNhLYbMSq4hU=; b=SIKrtVdDtLNtboFkQnNvawwXMFgLcmNW1wgxoUEyKzNc8j/W7+2PREJSZZGVG4NW9KQFnd /SL00dOdwjEviiaXvC3tn0EJcz7wXTS5X7PtbWGCWE8EE7XHJkjoeQ6RpVnAcGsVBl4V9G ZQootjWlBjvEyGKP0sWpIThDTqR5aUo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-623-itdX0an8McWg5ZpBNZWuxQ-1; Sun, 03 Dec 2023 21:23:27 -0500 X-MC-Unique: itdX0an8McWg5ZpBNZWuxQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D4C180F82F; Mon, 4 Dec 2023 02:23:27 +0000 (UTC) Received: from localhost (unknown [10.72.113.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80B4A2026D6E; Mon, 4 Dec 2023 02:23:26 +0000 (UTC) Date: Mon, 4 Dec 2023 10:23:23 +0800 From: Baoquan He To: Randy Dunlap 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 Subject: [PATCH 2/2] riscv, kexec: fix dependency of two items Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 03 Dec 2023 18:23:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784316288363936232 X-GMAIL-MSGID: 1784316288363936232 Drop the dependency on MMU from ARCH_SUPPORTS_KEXEC and ARCH_SUPPORTS_KEXEC_FILE because CONFIG_MMU could be disabled while people may still want to have KEXEC/KEXEC_FILE functionality. Signed-off-by: Baoquan He Tested-by: Randy Dunlap # build-tested --- arch/riscv/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 95a2a06acc6a..24c1799e2ec4 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -685,7 +685,7 @@ config RISCV_BOOT_SPINWAIT If unsure what to do here, say N. config ARCH_SUPPORTS_KEXEC - def_bool MMU + def_bool y config ARCH_SELECTS_KEXEC def_bool y @@ -693,7 +693,7 @@ config ARCH_SELECTS_KEXEC select HOTPLUG_CPU if SMP config ARCH_SUPPORTS_KEXEC_FILE - def_bool 64BIT && MMU + def_bool 64BIT config ARCH_SELECTS_KEXEC_FILE def_bool y