Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3942100pxj; Mon, 21 Jun 2021 09:51:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymQLVWE/wDTkJ55j3ZQoad2xFdYGK0sngfaIsxLA7gvHr7JTS+BktdUh4++2x308+Wl4gn X-Received: by 2002:a92:de05:: with SMTP id x5mr10159947ilm.161.1624294315766; Mon, 21 Jun 2021 09:51:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624294315; cv=none; d=google.com; s=arc-20160816; b=KJ7+HVpepe3n7Meozw/nfjYp4fOaXrj4KVIXdzJgYNeDMXCVNVKTWeCnIP2alO7b95 HDdSxKijntt3wjrHpgpeuXJyDZi2sYi207yfLPW+X41gQaT8UMm7PbJM1k7iVEWWkkHZ /shwlbDc+Jb3Dhtr/uvSe8WzKqN61w0aGdiwy+MWYnN2QNcp4wTPskM9ICI1L+5cCXBr Vxvr8X2P+hpkzM9ST2RB374Wn4D9QumHRE4TNWhpRcdW6TsqwneNEXKU38+hH3uxhvI1 SpFKq3ocD7uKgJUkM5KGZUia2Jwq97cVBRi6jzsjgOlPuFb/VOoNzIP9zp6g6I6wbYPx 55cA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pdC4rJolp/RNl8GpNc8UB1IReIGjn2xcTlPJGrVd6yo=; b=VMeVBxkrDH3Gb1gDTBd5eF58IcgntVhVvQqkNL+wHHXA8ICuyIg/LTctbQsiNraiFM aq50X4ELL6AcAHfm1YNWYLRCRcKl63PLEOKFpBUbnrIhOfAhv8pP/Ki2WSVS1VCvb7w/ FtmJn0m4CWQ3Shc8QldeTpTfLTdyb6rX2zsZSltSMb3sa+LxyZiW3wtMVvQ0ydHNNI/p GKrWEByVBBvHGlDT4AmpoXHb8/iSKDTJ6XzEO3pUWUDkCQd9clqg00MfG/Q5IEL7Axjb 2LPKju0qBA3i8XJ2/tBaOjZpg1MHyVSbdMVyrk9898CtbuDlg9lxa+0qQm4we3M94EVG FbZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Al1Y6wN4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i15si12020795ila.101.2021.06.21.09.51.43; Mon, 21 Jun 2021 09:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Al1Y6wN4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232976AbhFUQwR (ORCPT + 99 others); Mon, 21 Jun 2021 12:52:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:37574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232746AbhFUQr7 (ORCPT ); Mon, 21 Jun 2021 12:47:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 80F8F6145C; Mon, 21 Jun 2021 16:33:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624293238; bh=krHw4hiRnmPWyW69uCFr1bjPgmcwELw5Yevr8rfOP1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Al1Y6wN4viGl8nb4U0HPkC8K7nOTSnvqT/zVF2ym8kVw68ZdkjBgadb7HenMskXkV Rnf6rlWIRF9pY0wWxl5VkPWneFeSWg9LGcDCCUod9/axs+XjzkT4sC+UjDlL6BZGbH MncE4K1fI3upKhsIiEHedTyFO/02ay4KUAo2A2a0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pingfan Liu , Baoquan He , Bhupesh Sharma , Kazuhito Hagio , Dave Young , Boris Petkov , Ingo Molnar , Thomas Gleixner , James Morse , Mark Rutland , Will Deacon , Catalin Marinas , Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , Dave Anderson , Andrew Morton , Linus Torvalds Subject: [PATCH 5.12 149/178] crash_core, vmcoreinfo: append SECTION_SIZE_BITS to vmcoreinfo Date: Mon, 21 Jun 2021 18:16:03 +0200 Message-Id: <20210621154927.838117976@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210621154921.212599475@linuxfoundation.org> References: <20210621154921.212599475@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pingfan Liu commit 4f5aecdff25f59fb5ea456d5152a913906ecf287 upstream. As mentioned in kernel commit 1d50e5d0c505 ("crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo"), SECTION_SIZE_BITS in the formula: #define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS) Besides SECTIONS_SHIFT, SECTION_SIZE_BITS is also used to calculate PAGES_PER_SECTION in makedumpfile just like kernel. Unfortunately, this arch-dependent macro SECTION_SIZE_BITS changes, e.g. recently in kernel commit f0b13ee23241 ("arm64/sparsemem: reduce SECTION_SIZE_BITS"). But user space wants a stable interface to get this info. Such info is impossible to be deduced from a crashdump vmcore. Hence append SECTION_SIZE_BITS to vmcoreinfo. Link: https://lkml.kernel.org/r/20210608103359.84907-1-kernelfans@gmail.com Link: http://lists.infradead.org/pipermail/kexec/2021-June/022676.html Signed-off-by: Pingfan Liu Acked-by: Baoquan He Cc: Bhupesh Sharma Cc: Kazuhito Hagio Cc: Dave Young Cc: Boris Petkov Cc: Ingo Molnar Cc: Thomas Gleixner Cc: James Morse Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: Michael Ellerman Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: Dave Anderson Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/crash_core.c | 1 + 1 file changed, 1 insertion(+) --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -464,6 +464,7 @@ static int __init crash_save_vmcoreinfo_ VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS); VMCOREINFO_STRUCT_SIZE(mem_section); VMCOREINFO_OFFSET(mem_section, section_mem_map); + VMCOREINFO_NUMBER(SECTION_SIZE_BITS); VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS); #endif VMCOREINFO_STRUCT_SIZE(page);