From patchwork Tue Jun 8 10:33:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 12306253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EABFC47082 for ; Tue, 8 Jun 2021 10:36:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 06B9E61263 for ; Tue, 8 Jun 2021 10:36:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06B9E61263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=JSkBEVL2lwlli8gH5dDixEqazjJhFDN7o4TkyHZClIg=; b=PECkK0ubtdTylk BtuiOXhUgLmL0QdeYpLt0C1a4YjdXime2ef2TWy3i+7jBsfxex5JChsm9uxD26Yknr5WLnDVfchGo 9JCB6MH1faeqFle4FefitEfsTwaRIp7IuNtc4ZYquXRjeHMqNRw2cLlYwAg2piLWUiPvWILp+DvVj M/8sjHcgItIx0E3oGwiKs0Y6AV6zzjIjn6L/cV2ker3LocfB+0V91VdKil8Th7ccU8hGPrX4mOwC1 oUBXvn48qc3jJ0QT5XrAy5bqWGD7G9nzgyKTZhAqPzqw29uGkKOQEMwVWimT5y6ZRNFWoqBJnZvCy /30as/JjW3msEobCTs8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqZ3q-007iMe-TL; Tue, 08 Jun 2021 10:34:19 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqZ3m-007iLC-CT; Tue, 08 Jun 2021 10:34:15 +0000 Received: by mail-qv1-xf33.google.com with SMTP id w9so10447300qvi.13; Tue, 08 Jun 2021 03:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=J48k4WcLJ93C6a4z5qvH4NdBXcXofCtpkZgQyGSY/Bw=; b=f9s3tlGdv+Y1LSpT+BfcUXtXM2IKhT7mXXeAXGNZVv9grY44lipLCrOVlyDsoNqFHY bgRAtbzCs0cwsYch3IqjUkRg21qKS89A0AvC/4hjJpGDX8cSkRKtUGIzPDwgYi9y+T31 8TAJrWW5ruMltyaKoq0xV+xGYunqeX5PTvyvcT1gXDjiJ+SWx42GiARauzNeLu799E7w lDoMh2hpfafy5xC8CoMGZ4dlEujFKrS0wSuarkwsCOAPKTSiLxeRJBlLEVts/CKlGdvE mMCenIyU7M1vbyvJ3RVCjBI/ZXYJixFMzu/bSlpoKLuIDf0YZxDH93cd2ya4ma5A6ezs dAuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=J48k4WcLJ93C6a4z5qvH4NdBXcXofCtpkZgQyGSY/Bw=; b=ehRj711KWVFBXit7O4QwbVdh9kRU7jequZhF857jzBRni4zXuUWgKEFO/4Yz1gFzkG Y2lyx5AUlD/EU5c4WI1PZbicBWrmMrhFZMQogJoGOoxGT4D099B8ZYUCSP6pyj08kbDc rGmBj46QhYn44PmM36VOK+nFlRt0CAVFxmrr2Ve1kHoVY6pMR7q1gG47ghfAMFGw15Kd bJTkLkkuGWLqK3Cejr+j5jMz+ZQNIkh1nKKn3BHlSlnIajWC4cPr4uBUnv3H8ZRgbzzx cIdfosYB1MERkI3rx7xu2ck6Wt89fGq3BsSEP35oNK1YXaazv5ccZkvT+Zdf9pYVRbO9 tXCA== X-Gm-Message-State: AOAM5310IUCioylDBtc/cGpOCh9voqWP2v7ITfx2b29Q8p3J1RRH+v2I spx2YceMgPY19crWxzKV6Q== X-Google-Smtp-Source: ABdhPJzwosaCGBBwjiwr3ftTAMod+g7XPn30t+/0BRzJxX9QrrUMaPQenkgIE6i5E4uZVVsWsh1sig== X-Received: by 2002:a0c:ed46:: with SMTP id v6mr22752280qvq.46.1623148451751; Tue, 08 Jun 2021 03:34:11 -0700 (PDT) Received: from qualcomm-amberwing-rep-18.khw4.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id e3sm2260682qts.34.2021.06.08.03.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 03:34:11 -0700 (PDT) From: Pingfan Liu To: Cc: Pingfan Liu , Bhupesh Sharma , Kazuhito Hagio , Dave Young , Baoquan He , Boris Petkov , Ingo Molnar , Thomas Gleixner , James Morse , Mark Rutland , Will Deacon , Catalin Marinas , Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , Dave Anderson , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] crash_core, vmcoreinfo: Append 'SECTION_SIZE_BITS' to vmcoreinfo Date: Tue, 8 Jun 2021 06:33:59 -0400 Message-Id: <20210608103359.84907-1-kernelfans@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210608_033414_459371_ACB6DB8A X-CRM114-Status: GOOD ( 12.51 ) 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 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. Signed-off-by: Pingfan Liu Cc: Bhupesh Sharma Cc: Kazuhito Hagio Cc: Dave Young Cc: Baoquan He 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: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org Cc: x86@kernel.org Cc: linux-arm-kernel@lists.infradead.org Acked-by: Baoquan He --- kernel/crash_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 825284baaf46..684a6061a13a 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -464,6 +464,7 @@ static int __init crash_save_vmcoreinfo_init(void) 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);