From patchwork Wed May 13 18:52:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 11547075 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 87630618 for ; Wed, 13 May 2020 18:53:18 +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 85D532054F for ; Wed, 13 May 2020 18:53:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="d+dx+CT9"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HHLryqNl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85D532054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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=u/Bc9Gtxl/n9HLDO7h8Xpq3bQJuiTzsQEuu5hIpxI+A=; b=d+dx+CT9liKfds/DgB5MOSoUah gHFZlBuGyZ0g1zT/OZFMjYboz91yMJ67nC2jP+Cn9Ko1yXxAV90rYlgZrepOFBRwrri4D6gqAeIuQ 9M1+EtX4mFWbY8l3xJo3uz3CxwthPnlCrNyEMb20r9YEdzsv3XgL+/c0msf4tnsoAERkV87qd/E/v G2yDqeGECEe5vzvHQXg4HWlxwnpOTMxxajO1NnKxPyGSXXZ9ImoBeauxZs6E914ZlsGrsryxUXU+R Xij/UttvtA0xT2sSMs74yC+PFWbtnNwSwF6n7v4mTBYokwYK+H0dHSo0mxaArf85VY7Azlh5QrsAW rZLrXfsg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYwV5-0003Uj-Q6; Wed, 13 May 2020 18:53:03 +0000 Received: from us-smtp-1.mimecast.com ([207.211.31.81] helo=us-smtp-delivery-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYwUs-0003IB-9w for linux-arm-kernel@lists.infradead.org; Wed, 13 May 2020 18:52:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589395968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=wHSBbB5/QZT/EwoeOOweY77s6h/009zkbzY0iSlBYP8=; b=HHLryqNldBR7dZR9scZO95SPBot4qn2EOy2DQ9c8me2paIGsr45ucbRE1GZVJjWxpp9P6/ De7tLd0Ml10zfUzEi0W0rwbnVag8JlBFyIzjuaLKKapDpPvBlkLh7rex/IwJj/47UW0/Tq hXYZff2ljJ6y6mLKKapHT38LGyU6iU0= Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-f5sPb6yzMcaJ99vZKh0N7g-1; Wed, 13 May 2020 14:52:47 -0400 X-MC-Unique: f5sPb6yzMcaJ99vZKh0N7g-1 Received: by mail-pg1-f199.google.com with SMTP id l7so329436pgb.2 for ; Wed, 13 May 2020 11:52:46 -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=wHSBbB5/QZT/EwoeOOweY77s6h/009zkbzY0iSlBYP8=; b=V/1FI5x2YPkeuzBW45yPHcpApq48bintlzU8K32eXItBxRXhEbW01VK+r+N1onv+tD JbV5/3ge2BWilYVi262VhC00HZrAMN38+wDdW8xgPkoGYgoWJYL65WPsrHUW+5gFYJb3 cabOevf3wA8jscn3x9Ih/lzugEO3KHXeAztHgKN6WOzkjDhPWG+27h+DPvQnmQAM2lcY w/3KBAo1NzR3yG32VT8TqpVmrW8IQXJR4fRBXTc05NHE7jUXEOKz1gK+wCaguJy8i8VJ yROnYoK+AGJMdi/i6dMgQTeO1ieYe33hDjCYJwf4NGkzM6l9HpJLCpnNTKExMXF2AGYA +8lw== X-Gm-Message-State: AOAM532b1cff4/gBUkYWAtdilTJmfpkgP8TKsTt9hv1I9pZ6VNsNnofK 0aBCL1LlDKm/xZKWF/oB9xfVxmxsxTjrxpQbhqBW/UZ9F4YStQR58SSnJccYqcL6ePTQxmPpg4C mMMOZ/qNiNzLEv5MRUek01+81soCWgOmg93I= X-Received: by 2002:aa7:82d4:: with SMTP id f20mr638947pfn.253.1589395964831; Wed, 13 May 2020 11:52:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5Sglv3QSN2AQ8L8vX+EbHi2Jv4mN3LxBZJj8ZVFGF26HEK+cSiLoq/r1EcEne4FxQ9u0lwQ== X-Received: by 2002:aa7:82d4:: with SMTP id f20mr638933pfn.253.1589395964561; Wed, 13 May 2020 11:52:44 -0700 (PDT) Received: from localhost ([122.177.166.225]) by smtp.gmail.com with ESMTPSA id d2sm230168pfa.164.2020.05.13.11.52.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2020 11:52:43 -0700 (PDT) From: Bhupesh Sharma To: linux-arm-kernel@lists.infradead.org, x86@kernel.org Subject: [PATCH v6 1/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo Date: Thu, 14 May 2020 00:22:36 +0530 Message-Id: <1589395957-24628-2-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589395957-24628-1-git-send-email-bhsharma@redhat.com> References: <1589395957-24628-1-git-send-email-bhsharma@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200513_115250_417969_79E4EA8C X-CRM114-Status: GOOD ( 17.85 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [207.211.31.81 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [207.211.31.81 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kazuhito Hagio , Michael Ellerman , bhsharma@redhat.com, kexec@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, James Morse , Benjamin Herrenschmidt , Boris Petkov , Thomas Gleixner , bhupesh.linux@gmail.com, Will Deacon , Ingo Molnar , Paul Mackerras , Dave Anderson MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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: While at it also update vmcoreinfo documentation for 'MAX_PHYSMEM_BITS' variable being added to vmcoreinfo. 'MAX_PHYSMEM_BITS' defines the maximum supported physical address space memory. Cc: Boris Petkov Cc: Ingo Molnar Cc: Thomas Gleixner Cc: James Morse Cc: Mark Rutland 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 Tested-by: John Donnelly Signed-off-by: Bhupesh Sharma Acked-by: Dave Young --- Documentation/admin-guide/kdump/vmcoreinfo.rst | 5 +++++ kernel/crash_core.c | 1 + 2 files changed, 6 insertions(+) diff --git a/Documentation/admin-guide/kdump/vmcoreinfo.rst b/Documentation/admin-guide/kdump/vmcoreinfo.rst index e4ee8b2db604..2a632020f809 100644 --- a/Documentation/admin-guide/kdump/vmcoreinfo.rst +++ b/Documentation/admin-guide/kdump/vmcoreinfo.rst @@ -93,6 +93,11 @@ It exists in the sparse memory mapping model, and it is also somewhat similar to the mem_map variable, both of them are used to translate an address. +MAX_PHYSMEM_BITS +---------------- + +Defines the maximum supported physical address space memory. + page ---- diff --git a/kernel/crash_core.c b/kernel/crash_core.c index 9f1557b98468..18175687133a 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -413,6 +413,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);