From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,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 BFD22C433DF for ; Wed, 13 May 2020 18:52:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 661CD2065C for ; Wed, 13 May 2020 18:52:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XNKC5K6G" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390294AbgEMSww (ORCPT ); Wed, 13 May 2020 14:52:52 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:57671 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390263AbgEMSwt (ORCPT ); Wed, 13 May 2020 14:52:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589395967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:in-reply-to:in-reply-to:references:references; bh=wHSBbB5/QZT/EwoeOOweY77s6h/009zkbzY0iSlBYP8=; b=XNKC5K6G/mfo8AKKLTtuLBsXi/K+dlZeEVFIiRACByhsrnRXasb7YTzsY1V4W2ugxgU08z xJy3I8u4dE9fdEMh5VjEqzqJ+Amm7uMgWU5XazNwhZIw9ioxd3Jk3dLu4UCt0ekk3yhBt7 FvyuNjMCYscxLr3EACtDbHkKCbTBYzM= 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-235-65YgdnZGO9CHMQl_Qezs1A-1; Wed, 13 May 2020 14:52:46 -0400 X-MC-Unique: 65YgdnZGO9CHMQl_Qezs1A-1 Received: by mail-pg1-f199.google.com with SMTP id y4so321187pgo.6 for ; Wed, 13 May 2020 11:52:45 -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=EtFhrkcOPrkYkVd0KC05aF4a4fk21lUAZAJDGu8Z2u5k1UBRGFfjE1Emap62L7vbwU CuHoQZ/phCIn0j7YXWuTVLpNWoNUJw52SNNEMJAiFOIyQnbKlR1OurrxEboYLvjx8bVl SLIFLAInoIOA/m7s59wPOoVaVkvZsOUl0ZefhEHHRcMPpcTsjrjb+sqEgfJ3J6FMYARi Zm0zHGifD261UXtn5rH6LjSxHQPsyKAsMXDimOwC3i3PltRmmL9xOCBDZ8pt3webeai4 Q8L6ca8RKSF9CEYrf0acLX775DNmjbP9E6bTaDfR9mb9poBMqrdOKhFhSAyN+FyfSx2E YZcQ== X-Gm-Message-State: AOAM530isrOT7gjF5s5I0tbMD4PFuBfZXL4OHKTGDLsX48fc21OuPlYD woZtgkXErL29JJQspIYlKjbM+mHxmuXdtnnvXtjvQRUoiK//jrTpFWHUG48/8X7x6jhf2BdY2uP z/m9FSTDQlkrSyV5BESwCVfMg X-Received: by 2002:aa7:82d4:: with SMTP id f20mr638950pfn.253.1589395964832; 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 Cc: bhsharma@redhat.com, bhupesh.linux@gmail.com, Boris Petkov , Ingo Molnar , Thomas Gleixner , James Morse , Mark Rutland , Will Deacon , Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , Dave Anderson , Kazuhito Hagio , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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); -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 09A8EC433E0 for ; Wed, 13 May 2020 18:55:01 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (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 3271C2054F for ; Wed, 13 May 2020 18:55:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Hl5KliNg"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Hl5KliNg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3271C2054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49MkPY50QHzDqcq for ; Thu, 14 May 2020 04:54:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=207.211.31.81; helo=us-smtp-delivery-1.mimecast.com; envelope-from=bhsharma@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Hl5KliNg; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Hl5KliNg; dkim-atps=neutral Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49MkM95TSBzDqc8 for ; Thu, 14 May 2020 04:52:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589395967; 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=Hl5KliNg4qQzUnYPVH7Wqp/eS41pyypOIZ7VRVKPUQ+EQL771Z4MFD7dRZjurIZ8vQFt7y rjalnhMsr6XT+9BNTYhuiV6QqOpVTaayMbxGI2/En3nVeOTTTzuHIHOsawActAXIDBH8Kx OvduGoLhHiwU4pinJis5vMTp0WTY5p8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589395967; 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=Hl5KliNg4qQzUnYPVH7Wqp/eS41pyypOIZ7VRVKPUQ+EQL771Z4MFD7dRZjurIZ8vQFt7y rjalnhMsr6XT+9BNTYhuiV6QqOpVTaayMbxGI2/En3nVeOTTTzuHIHOsawActAXIDBH8Kx OvduGoLhHiwU4pinJis5vMTp0WTY5p8= Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-fXpxRmKdMJiMWtSbmhH0oA-1; Wed, 13 May 2020 14:52:45 -0400 X-MC-Unique: fXpxRmKdMJiMWtSbmhH0oA-1 Received: by mail-pg1-f200.google.com with SMTP id g1so312169pgk.10 for ; Wed, 13 May 2020 11:52:45 -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=k/PizjXahgT4VeVAb9HW22wtmnMCKgnOp1F3x7DKbJWWwHm5LuvhBWICz8CAfc5T3X IfRMEkZB3pyEXPSq0047X6W8yQsmdKyig1NoAgv/6y8E2ZkgiGJl6oHq2cYQcQfXbMtA 7/3u4b+UP2sLOYEOhL1CSI/oREf/sDjBnNtBFDpOlo8pB5S3++vue36uznOenmS06ou/ K/Ng3z4Bt8b0AxfGgiO51PgHCneSJF4rDHEdyzov++FPTqd7ijU6BgoSyDyLOEmT9KFk F3lc22ipkfKV+LZhCfzRhzuhod05fwFRuvP2eXebtj8Cu+S8mnA4yDDu99idB2jj73OM 4RRg== X-Gm-Message-State: AOAM532C1hhb+EGuWeB/Q9V3n4Pd/V3z690xVu19kXXMo/uDl3sbGkQ8 KaICdwn5i/aH7K3enn/TC3PhS24kq7FF+D2uxhWo5/ceS5ZWk8rkHs4FXHBNuMZ+xY77DXRU5zN /poCFmlvV6iZQLThXc7ADrvRXXg== X-Received: by 2002:aa7:82d4:: with SMTP id f20mr638964pfn.253.1589395964884; 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 Content-Type: text/plain; charset=US-ASCII X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kazuhito Hagio , bhsharma@redhat.com, kexec@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, James Morse , Boris Petkov , Thomas Gleixner , bhupesh.linux@gmail.com, Will Deacon , Ingo Molnar , Paul Mackerras , Dave Anderson Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 --- 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); -- 2.7.4 From mboxrd@z Thu Jan 1 00:00:00 1970 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=-9.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 C5C41C433DF for ; Wed, 13 May 2020 18:53:08 +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 455A22054F for ; Wed, 13 May 2020 18:53:09 +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 455A22054F 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+infradead-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.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-JU; 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-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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.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 --- 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); -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120] helo=us-smtp-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYwUs-0003Ie-DW for kexec@lists.infradead.org; Wed, 13 May 2020 18:52:52 +0000 Received: by mail-pf1-f197.google.com with SMTP id 126so488460pfd.10 for ; Wed, 13 May 2020 11:52:47 -0700 (PDT) From: Bhupesh Sharma 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> In-Reply-To: <1589395957-24628-1-git-send-email-bhsharma@redhat.com> References: <1589395957-24628-1-git-send-email-bhsharma@redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: linux-arm-kernel@lists.infradead.org, x86@kernel.org 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 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 --- 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); -- 2.7.4 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec