From patchwork Wed Mar 20 05:09:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 10860831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55969922 for ; Wed, 20 Mar 2019 05:10:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5E7929894 for ; Wed, 20 Mar 2019 05:10:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9B95299AD; Wed, 20 Mar 2019 05:10:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 99A5629894 for ; Wed, 20 Mar 2019 05:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Dz5LmFq5hta+SMCqk+qIOpssePXO8bWRcSyDKl5HaB4=; b=uz6DB2zFzYiNVrwESYlfa6qHau 4ivDQGFPdL1cTELZIa4eIocZ0SDqbZKkX+JT+R0WR/qYv0ctaqnrs5Yif4qNmKrzIAHIowygrqBhn T6NFDFit1xsoJyY7rudF0o6ERiikCvSyimVkxKDCEvSAwpadYaxiY3zZ/CnlPMTPsQg/h7YtX/gA8 73YtitZmEuVOFydi4BuVcnY2/yn5rkRmDZ4ITfMOOnequx7j4VXYMXVpSNdnCzWlNAcjbIc2xnMSb FotzxG9zd6L/vGyEyWuV0K5gT5vjWUz3EZHq7iQdkyu+MflQAOoezsoj0jT0PVem2QS4f1EZq3pxV f2f1+UbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6TUY-0006fP-8v; Wed, 20 Mar 2019 05:10:18 +0000 Received: from mail-pf1-f195.google.com ([209.85.210.195]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6TU7-0004zb-0r for linux-arm-kernel@lists.infradead.org; Wed, 20 Mar 2019 05:09:57 +0000 Received: by mail-pf1-f195.google.com with SMTP id c8so1008040pfd.10 for ; Tue, 19 Mar 2019 22:09:50 -0700 (PDT) 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:in-reply-to :references; bh=e4gf7gQQRDrHYkHmBGmiy/271ro0jZqvmttHmTXDjOw=; b=lOFyHr8abB9EdVGDeX8s9Tn9kADVUH9hTDCIEB+Lef04Tg72CBDKdMgsmyHR+2p7Rq 7I4amIrCLgchB0+A0UNZzQuc8PeA0BwNjmdcYQkRS3qqx5Z2oh95YUCbqCTbvv12RYW8 7dpxQr+Y9yFTnqjwEf556UzkHgRiIW8tnV4OW9i9gn802Et1hEAj5XOQtaIAlXMg6qUL 4Jmg1JxZLz7bq4fO3xg62M+/g6h7NwUlqDQY3n9Nq2nAMtUnrDDOodoK9D/9QZtTsvU3 oqBajYr0Xtewrx59xNkL03Kr+5DRFSppyQYWTqEGW2dURnGfn9fBz4Vy7AXit2OZFM8Z jEhA== X-Gm-Message-State: APjAAAVYu0T3KuX2DXkyYLhCNmJ/W9bKfYMAbrSJZDZeepdR6Ecsp2mu GhDzk6fzuXwHxAAxO+4cqMkqzA== X-Google-Smtp-Source: APXvYqwquzJ/LobGlm7cNilKJM6zRdniDHacYy1BqPtGwxNdqRtts7VAQpU4ybvYWD6CVPzQvfam4A== X-Received: by 2002:a63:e002:: with SMTP id e2mr5901612pgh.300.1553058590559; Tue, 19 Mar 2019 22:09:50 -0700 (PDT) Received: from localhost ([122.177.144.121]) by smtp.gmail.com with ESMTPSA id e123sm958508pfe.35.2019.03.19.22.09.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Mar 2019 22:09:49 -0700 (PDT) From: Bhupesh Sharma To: linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo Date: Wed, 20 Mar 2019 10:39:33 +0530 Message-Id: <1553058574-18606-3-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553058574-18606-1-git-send-email-bhsharma@redhat.com> References: <1553058574-18606-1-git-send-email-bhsharma@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190319_220951_355548_22AF948E X-CRM114-Status: GOOD ( 15.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kazuhito Hagio , Michael Ellerman , bhsharma@redhat.com, x86@kernel.org, Will Deacon , linuxppc-dev@lists.ozlabs.org, kexec@lists.infradead.org, James Morse , linux-arm-kernel@lists.infradead.org, Benjamin Herrenschmidt , Boris Petkov , Thomas Gleixner , bhupesh.linux@gmail.com, Dave Anderson , Ingo Molnar , Paul Mackerras MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Right now user-space tools like 'makedumpfile' and 'crash' need to rely on a best-guess method of determining value of 'MAX_PHYSMEM_BITS' supported by underlying kernel. This value is used in user-space code to calculate the bit-space required to store a section for SPARESMEM (similar to the existing calculation method used in the kernel implementation): #define SECTIONS_SHIFT (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS) Now, regressions have been reported in user-space utilities like 'makedumpfile' and 'crash' on arm64, with the recently added kernel support for 52-bit physical address space, as there is no clear method of determining this value in user-space (other than reading kernel CONFIG flags). As per suggestion from makedumpfile maintainer (Kazu), it makes more sense to append 'MAX_PHYSMEM_BITS' to vmcoreinfo in the core code itself rather than in arch-specific code, so that the user-space code for other archs can also benefit from this addition to the vmcoreinfo and use it as a standard way of determining 'SECTIONS_SHIFT' value in user-land. A reference 'makedumpfile' implementation which reads the 'MAX_PHYSMEM_BITS' value from vmcoreinfo in a arch-independent fashion is available here: [0]. https://github.com/bhupesh-sharma/makedumpfile/blob/remove-max-phys-mem-bit-v1/arch/ppc64.c#L471 Cc: Boris Petkov Cc: Ingo Molnar Cc: Thomas Gleixner Cc: James Morse Cc: Will Deacon Cc: Michael Ellerman Cc: Paul Mackerras Cc: Benjamin Herrenschmidt Cc: Dave Anderson Cc: Kazuhito Hagio Cc: x86@kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: kexec@lists.infradead.org Signed-off-by: Bhupesh Sharma --- kernel/crash_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 093c9f917ed0..495f09084696 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -415,6 +415,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(MAX_PHYSMEM_BITS); #endif VMCOREINFO_STRUCT_SIZE(page); VMCOREINFO_STRUCT_SIZE(pglist_data);