Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7178106ybc; Thu, 28 Nov 2019 12:26:57 -0800 (PST) X-Google-Smtp-Source: APXvYqx6FpwjFigM0ZSdDm5+EUJhehjWv9F4MXW7BzCUu/KdqGbNGTVl4/aWVmdu0SYTaxp3fbwz X-Received: by 2002:a17:907:43c1:: with SMTP id i1mr2903673ejs.138.1574972817115; Thu, 28 Nov 2019 12:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574972817; cv=none; d=google.com; s=arc-20160816; b=pH3HkoH81UonzPoxP6LKKhRYiNfvSUFDg1SpSSG7Jjd+jW+muj50eHGbBDovCqYLcc hNsqvKmxxpq0MDd7+N1v+04bKWtEIngxzQQKzhN/1rhtzRv3/2dCgdNA6pQ59My29uPG lX2jX33Imphac4Tu7BDSp2kaFGEiiFkNNhMYV7hEswwTSHrgPHNmW8TzgB248lVvM02Z owbGv4h5dY6H0EYvoU+8QoFkF6sOlqrEjstMwvsvTA3lGYkhAm/swOhnWUee7ZEx6ebP Aen8SKVOJqYC18Mk0EsKcjIiZZjlTSzxXfdnQ5oHLIxEIAwVUMKC+Y5Rc/Y1r1QSTF2M 2D3w== 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=sGR7LydUs99hk46XREtcYdX173w6Bt1XQ7NhjjwAXPTSYVxELNgEJUlJRximEiE6YB bE6Vlbd7Cvk2Vx+it1KTlxzV3lFMx0BNJ2DQdWMI89yLN+OpDgeY7x8qZ+9q1/1NGrUr 8G8eUzxcJdJUOsohAwFCOqopGE7cP44tdM0dqs/7VmLHS6RZIS1SjMTTfdeMz+L7upS9 27iwuCx2T5SCO07vAAf68RUcB7tccs28zPNu7fBr/iH9eixW0Z3+Zzt5Ok/eJSxhDEGX E+uTqL3WOvpnUdGsYZlAx6TEwgZ9gnYk7wrgS+YBc+i8lJPllLnlm6Hzts+7kfGtpV49 gIgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U5QygCir; 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 x17si12344111ejs.178.2019.11.28.12.26.32; Thu, 28 Nov 2019 12:26:57 -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=U5QygCir; 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 S1726698AbfK1UYG (ORCPT + 99 others); Thu, 28 Nov 2019 15:24:06 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:32342 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726565AbfK1UYF (ORCPT ); Thu, 28 Nov 2019 15:24:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574972645; 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=U5QygCirj36G/oqHsvBG9TtGy23xi8kkhfKEtFl9Kv/deTdY4Ws+T2kBSy4PqefM98vEmo BFIa7FDFBVTY7SAbQGIRpnuyygsM5TkwLulaHhssbRsFosMss6aL+ewQdfHq4YHabFRL5D lovJ3ivXwOSXV2nhGAdqaOK0fpmopzs= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-46JDEDlPNPaG_8AyXo45oQ-1; Thu, 28 Nov 2019 15:24:03 -0500 Received: by mail-pj1-f72.google.com with SMTP id b10so660086pju.18 for ; Thu, 28 Nov 2019 12:24:03 -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=qQwXvQ6UjvaojZ8S42TgkdRwYIF5BYTEPv+S5G1F+AIEOT3FV4YkhnYhakOFoT0YBy jfJmNikzN4onD19MRNajYC90zTgAxkFNOT9djYbUHEmCgl7Aqrlv02cBKDIhb2xHaZuw 6bJFdK2gsOparFOjUwEs+96HPWxJ3Myy11Pt8P8MMFJWL+BCG59OWppy8g+cux8p083M 4i10ybutFCIPSchek503V0Ns3By2/tlM4/cTW0QMSTPFIiIzMDiiJ6ZGH7JB9Y5rlnGl gmiYXe/LjjhAvYHwfh7c069ODKlGLoq4WlprOthAhUzrn6H94EtVyK3r6Yq+8Sbow5CC PL+Q== X-Gm-Message-State: APjAAAVT+iTulPjsAFFKINEyesya7viecLB4C8V8cfmAwxbSEgvC6Fls 2EoiMiG1oXA38lWjn5nyCUGWmzqG+WU57xZ57ingHBIoxP4RkVoPZfGu74Yymd3nk5ZnHpbXIa4 q/Vpqh7MiR+NDjj0HI5bihTeR X-Received: by 2002:a17:90a:3663:: with SMTP id s90mr14556244pjb.1.1574972639261; Thu, 28 Nov 2019 12:23:59 -0800 (PST) X-Received: by 2002:a17:90a:3663:: with SMTP id s90mr14556206pjb.1.1574972638976; Thu, 28 Nov 2019 12:23:58 -0800 (PST) Received: from localhost ([122.177.85.74]) by smtp.gmail.com with ESMTPSA id s66sm22322578pfb.38.2019.11.28.12.23.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Nov 2019 12:23:58 -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: [PATCH v5 1/5] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo Date: Fri, 29 Nov 2019 01:53:37 +0530 Message-Id: <1574972621-25750-2-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1574972621-25750-1-git-send-email-bhsharma@redhat.com> References: <1574972621-25750-1-git-send-email-bhsharma@redhat.com> X-MC-Unique: 46JDEDlPNPaG_8AyXo45oQ-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