From patchwork Sun Mar 10 10:04:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 10846269 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 5152D1390 for ; Sun, 10 Mar 2019 10:05:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F227287E3 for ; Sun, 10 Mar 2019 10:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2092728FD2; Sun, 10 Mar 2019 10:05:37 +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 A8DAC287E3 for ; Sun, 10 Mar 2019 10:05:36 +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=3p8tKXQNMEIgJB0Xi1Sn/O13YkX/vEPys1cgAZujqDQ=; b=M/uJQMzEikZQ043OUTvbI7qR/E /66uZroa92F6FIRheAbOeogGBe3Ezc9loMBihbHb+XltN7etPnXzDFzoVWe8p6nolf1KHvYxrIucD M3fQlYPvxv7JaWsYZghrrEH5FPm6BbMluszhDSnyqMnYIC2R3avAAhjH1xY6k5yP/CE56/2G+O9LN zaugeAW4gX5/2N6Q/jFkqT8CKw+LAvlVIdKrsll8BsoQLBxRUfQLrza8+SHGckGCqIQYtbVZZY6mP z23PhvJi0eIzmclgMYkw93Sd7t7+9xQeG0DnP2gm0DJlsWwEH6prJeX3btnOYVpdGNcgGcuQ1TvYr 0+VKJyWA==; 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 1h2vKo-0000kX-Ph; Sun, 10 Mar 2019 10:05:34 +0000 Received: from mail-pg1-f193.google.com ([209.85.215.193]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h2vKI-0007Uo-T3 for linux-arm-kernel@lists.infradead.org; Sun, 10 Mar 2019 10:05:09 +0000 Received: by mail-pg1-f193.google.com with SMTP id h11so1721384pgl.0 for ; Sun, 10 Mar 2019 03:05:02 -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=L1C+T2uli6R0dd/vYObZu3h9qXje3TBmGHmavCoixHE=; b=qk6R3GVa/h2L6qeH3rkIwm4Wf4fYxWEOdui2He59FGV3J9yL3U/0xhSQxC0xjiWJFF v6yrvlhZ5jC+YodsAh3Rx+0luETNzjOOCO72ithSCqS/24/eAkIFa1ocrM1NFBEf6hgR VqI5U2lrZg0MUK9wIQ5CdSLewrSduEnSX+uIL+6wlxkjxFKbWVJYkgcElUk8W1nqqc55 lXFTpFZE48ExE35MmbcHzLusl4/8JASeFM+70nN7VKiuIRqfFTW3ppT0F1r4vSSxDdx2 F4g0VKHHwjenXbxnKzFmGBk08jv9kEigID4JreMd+xvrVxHR/F8N0Vn3xez6O9pHmDMV Jmtw== X-Gm-Message-State: APjAAAUkdouXvJR/t83DFt8E/nXCZRegRcBpB7kbDO+HpIclLicgbLxw NEoXewXRH4+yE3lVY9+kVF9gWA== X-Google-Smtp-Source: APXvYqz8b9xjsFFZhd8G7xPoAENZwwwAhyiJlWkWEOR5IOWPW8b/pqUd6GSXZ5C0atZumHSeryF4cQ== X-Received: by 2002:a63:cd06:: with SMTP id i6mr25240388pgg.267.1552212301991; Sun, 10 Mar 2019 03:05:01 -0700 (PDT) Received: from localhost ([106.215.118.61]) by smtp.gmail.com with ESMTPSA id e26sm3979010pfd.124.2019.03.10.03.05.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Mar 2019 03:05:01 -0700 (PDT) From: Bhupesh Sharma To: linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo Date: Sun, 10 Mar 2019 15:34:02 +0530 Message-Id: <1552212242-9479-3-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552212242-9479-1-git-send-email-bhsharma@redhat.com> References: <1552212242-9479-1-git-send-email-bhsharma@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190310_030503_301678_18471E4B X-CRM114-Status: GOOD ( 15.55 ) 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..44b90368e183 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -467,6 +467,7 @@ static int __init crash_save_vmcoreinfo_init(void) #define PAGE_OFFLINE_MAPCOUNT_VALUE (~PG_offline) VMCOREINFO_NUMBER(PAGE_OFFLINE_MAPCOUNT_VALUE); #endif + VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS); arch_crash_save_vmcoreinfo(); update_vmcoreinfo_note();