Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8519577ybc; Fri, 29 Nov 2019 12:01:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzSKASoGoNLrtU6vQhOWtvBdII+vVsFyWJ+8D7ZmOzStGiIxL+XvKl/wBMpcqUVhQrjbyLK X-Received: by 2002:a50:a9e3:: with SMTP id n90mr47200681edc.52.1575057669688; Fri, 29 Nov 2019 12:01:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575057669; cv=none; d=google.com; s=arc-20160816; b=aoqj3JkfY675BSb8d1cyI9I/AwQVoF2uvmlqQ8fC/8Pc4gFKWgYsDTQXq+YSS4RJnz O7As91S+uBevOjlb0LmFko0vhpMqiINNJCAjXPSXMj1VRutbu87fPYy99HrfhHmlOQ7i abqw1k5uEdVrVkxotQMfFnr/ok2OxrAjySDsFJk2c3CO1D7EF3Uz+y3nKYzEwxaT7Iz2 uz/bflLJdkkYtFoVRfCkHEzg7YWiJKUgqww1q8K7GIQA4G5Kfr3Xq/zcGTeo4tp4wy0M Fio7rGRcwmDADYPrgqLPx+Z3gx2kDJMcW1Iv9rfuosCHyoOa1rOfOXGsruLy/YCDrgIi WYDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=/y8p7TWJ4+9dx0qZYntYI0vqqca78jHSFlqFEn+6Y9I=; b=w4pBJP9WNDSmz/Uo7tckIdDRvcOi1JAcsLaG/w9C90TGV5sqX0/FPxVolvTfoGv1KJ vxHbU+dxvW4g73f78h4chjsM9j4fNuWU4iF7l9C5AbSM7JyiTOJyOuz3Ph5cseM+2SwQ Ecg7amB/7SfPMKzDXQhPABIXAX5kmbgjdnRENB/QbZmZhaJXmkRmjcWDnurWaf2e8UcQ kbECTwk/8EeDBK0TGiYYZFqKnoJRvKGL/3Er2JUX6Nk2MBiha+h0TzoA6hITDWb/7p10 F05h9aASmC/JcuR6twUrcaJtD0Sxudj8KA9W2qE1K29zaoxnCM78a3LWVCuCCosmPUqR Vvjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXkmupl3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si15604959edw.352.2019.11.29.12.00.45; Fri, 29 Nov 2019 12:01:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YXkmupl3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727118AbfK2T7l (ORCPT + 99 others); Fri, 29 Nov 2019 14:59:41 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:54053 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727107AbfK2T7l (ORCPT ); Fri, 29 Nov 2019 14:59:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575057580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/y8p7TWJ4+9dx0qZYntYI0vqqca78jHSFlqFEn+6Y9I=; b=YXkmupl3b6m/6g7V0RJKTlWyd3F3cWO5v4Z+4hft9LbjXJqGpxyDYIcTUw19KTCzUZBbQX 9gTwJG5dlKSZ27iBWXQ20wwAyvnhA0gtWU4BNVGprkuBH5h4mEEBh4d2co3zoga1xxll1z 3ee7Pd90ZJ/0evvupakme6jFkh6sMU8= Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-336-OSpe2VMAMbqDnecsklNsWA-1; Fri, 29 Nov 2019 14:59:38 -0500 Received: by mail-pf1-f199.google.com with SMTP id b17so18586118pfb.8 for ; Fri, 29 Nov 2019 11:59:37 -0800 (PST) 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=D7Q1sNAJK7KGCeC1/osi4u/yd8LMbojW2DcAg7eyhwk=; b=tUWxtv/4woHH1PCIgbXqOYIxgqOYrKa+1OSHoDJdQScYgDcgS+WxuX5ZunYCxXmHeu saWukriU41IGqIdiMX9mVGz55qP0u6XutEyFecKNLvpbyLei4GUkH4yqNWaMw+2RMFsa eK23n6Sm9aIirQG5R33mxILkeh3WaW29u2XCxMSAwvdpNyyJazquNngLyPyNSP1sUO5D cq/gviHInQV837GXa2W/BIVt8hDetAsSleztE7p/QhkOeJbP1QlRa5ZZqpN6S2sVUr9U EBWe2IshaGWDj15pyetPpobrvW5SJPWjMynSRor4sgWUL5P3LTlqE7hBMe2E/21DYPlH G9BA== X-Gm-Message-State: APjAAAWaJue9ijh3TXCh+UFWV26htzjMzlLcPdCglm/FL8hXV+zlRvlt 1MCx9tqrUlduklq/PuboOvwE7zts7kjIwjFEe1V5Aayy4PRROZx6oAreoZOuY+t5VIs58JggikW J47oPFgX3hBGlw31KH7NTuXgu X-Received: by 2002:a63:6f4c:: with SMTP id k73mr15574206pgc.374.1575057575545; Fri, 29 Nov 2019 11:59:35 -0800 (PST) X-Received: by 2002:a63:6f4c:: with SMTP id k73mr15574178pgc.374.1575057575265; Fri, 29 Nov 2019 11:59:35 -0800 (PST) Received: from localhost ([122.177.85.74]) by smtp.gmail.com with ESMTPSA id r28sm23294033pgk.75.2019.11.29.11.59.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Nov 2019 11:59:34 -0800 (PST) From: Bhupesh Sharma To: linux-kernel@vger.kernel.org Cc: bhsharma@redhat.com, bhupesh.linux@gmail.com, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, kexec@lists.infradead.org, Boris Petkov , Ingo Molnar , Thomas Gleixner , James Morse , Mark Rutland , Will Deacon , Steve Capper , Catalin Marinas , Ard Biesheuvel , Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , Dave Anderson , Kazuhito Hagio Subject: [RESEND PATCH v5 1/5] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo Date: Sat, 30 Nov 2019 01:29:15 +0530 Message-Id: <1575057559-25496-2-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1575057559-25496-1-git-send-email-bhsharma@redhat.com> References: <1575057559-25496-1-git-send-email-bhsharma@redhat.com> X-MC-Unique: OSpe2VMAMbqDnecsklNsWA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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: [0]. https://github.com/bhupesh-sharma/makedumpfile/blob/remove-max-phys-me= m-bit-v1/arch/ppc64.c#L471 Cc: Boris Petkov Cc: Ingo Molnar Cc: Thomas Gleixner Cc: James Morse Cc: Mark Rutland Cc: Will Deacon Cc: Steve Capper Cc: Catalin Marinas Cc: Ard Biesheuvel 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 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) =09VMCOREINFO_LENGTH(mem_section, NR_SECTION_ROOTS); =09VMCOREINFO_STRUCT_SIZE(mem_section); =09VMCOREINFO_OFFSET(mem_section, section_mem_map); +=09VMCOREINFO_NUMBER(MAX_PHYSMEM_BITS); #endif =09VMCOREINFO_STRUCT_SIZE(page); =09VMCOREINFO_STRUCT_SIZE(pglist_data); --=20 2.7.4