Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2402954imc; Tue, 12 Mar 2019 13:07:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAxFDo7ghkrCd/Uq2467rQvX9TVnoNhwQ9dp4QBf9Jx5r7L9dC+hijfQ/FUUdc06Dr7dL9 X-Received: by 2002:a62:503:: with SMTP id 3mr39660470pff.176.1552421236652; Tue, 12 Mar 2019 13:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552421236; cv=none; d=google.com; s=arc-20160816; b=cD5EQaPj589RenEaHfZMabwSUCAarYuw/2J3qmuHdMai3x6cBX4YQJXPJzqACQFZQR S83gZS9bDgFB5IbvDIwxvfk2DF+qROlM6rQWkeTXoIhUTv2x+0dxZ4RFBloH+GwxLft6 CyHOAJMESPnEBoAFBLtMz+ApVDIpvFVdG4polBFWOLoG2UfiyBrOXXiXFupdG7pIcyZe ygVvxpOX269gNKafwiaQPD6oxMz1QSeCTQrcYXtakELFTlqmGtCKpYw7eKYhShz0/upl 9C+aQ2yXR3nkkdjz29SDUZaYWcQB8ZDafimhrME5Ct8tMrSJ9K0+S2Yfmo8hQ9qDSI4C DuLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=ZzuQUjuIyQry9cpk+loZKo2wUJ3QhPm/8jnVFPwnHLI=; b=UWylHqDlp5XlUCd+JmYPYFSNN406Cdt0ps7Abgs1Bjr82AzjT1tXEujBcSy6hgMgcf QI0uxnonT4Z/nNTtrhxR5Jd18rdi4PBGuiO/LqIupV0ngY61fD15SfnM7sNMSH4uGU7o dxPnYJCyqND++v+lGTZ0uXT1VowHnkdswci59o9b3bS8OaP+IiRgpavyaVERUzEdhKS6 sWwMhhj3k5oXELdDVnzAG8RUv4gjrooGtCOZ+kHpto/VW+4QW0yEPDTudjuHmd0mO/BH jber7FZ31ySZ1i/Z2z+WbsT3E0iSnb+m5GNK0dE8Q2ixY+ndkLRfdMTGeLYnedNJR7Fv bJKw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10si8414410pgk.326.2019.03.12.13.07.01; Tue, 12 Mar 2019 13:07:16 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727249AbfCLUFH convert rfc822-to-8bit (ORCPT + 99 others); Tue, 12 Mar 2019 16:05:07 -0400 Received: from tyo161.gate.nec.co.jp ([114.179.232.161]:47359 "EHLO tyo161.gate.nec.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbfCLUFG (ORCPT ); Tue, 12 Mar 2019 16:05:06 -0400 X-Greylist: delayed 471 seconds by postgrey-1.27 at vger.kernel.org; Tue, 12 Mar 2019 16:05:05 EDT Received: from mailgate01.nec.co.jp ([114.179.233.122]) by tyo161.gate.nec.co.jp (8.15.1/8.15.1) with ESMTPS id x2CJpSbo027851 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 13 Mar 2019 04:51:28 +0900 Received: from mailsv02.nec.co.jp (mailgate-v.nec.co.jp [10.204.236.94]) by mailgate01.nec.co.jp (8.15.1/8.15.1) with ESMTP id x2CJpSeK016858; Wed, 13 Mar 2019 04:51:28 +0900 Received: from mail01b.kamome.nec.co.jp (mail01b.kamome.nec.co.jp [10.25.43.2]) by mailsv02.nec.co.jp (8.15.1/8.15.1) with ESMTP id x2CJpSQX006898; Wed, 13 Mar 2019 04:51:28 +0900 Received: from bpxc99gp.gisp.nec.co.jp ([10.38.151.136] [10.38.151.136]) by mail03.kamome.nec.co.jp with ESMTP id BT-MMP-3278575; Wed, 13 Mar 2019 04:47:38 +0900 Received: from BPXM09GP.gisp.nec.co.jp ([10.38.151.201]) by BPXC08GP.gisp.nec.co.jp ([10.38.151.136]) with mapi id 14.03.0319.002; Wed, 13 Mar 2019 04:47:38 +0900 From: Kazuhito Hagio To: Bhupesh Sharma CC: "linux-kernel@vger.kernel.org" , "Boris Petkov" , Ingo Molnar , Thomas Gleixner , James Morse , Will Deacon , Michael Ellerman , Paul Mackerras , Benjamin Herrenschmidt , "Dave Anderson" , "x86@kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" , "kexec@lists.infradead.org" Subject: RE: [PATCH v2 2/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo Thread-Topic: [PATCH v2 2/2] crash_core, vmcoreinfo: Append 'MAX_PHYSMEM_BITS' to vmcoreinfo Thread-Index: AQHU1yi7KXHpUX+rcU2iQwrK9lGXaKYIEatw Date: Tue, 12 Mar 2019 19:47:37 +0000 Message-ID: <4AE2DC15AC0B8543882A74EA0D43DBEC03569E6D@BPXM09GP.gisp.nec.co.jp> References: <1552212242-9479-1-git-send-email-bhsharma@redhat.com> <1552212242-9479-3-git-send-email-bhsharma@redhat.com> In-Reply-To: <1552212242-9479-3-git-send-email-bhsharma@redhat.com> Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [143.101.134.92] Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bhupesh, -----Original Message----- > 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); Some architectures define MAX_PHYSMEM_BITS only with CONFIG_SPARSEMEM, so we need to move this to the #ifdef section that exports some mem_section things. Thanks! Kazu > > arch_crash_save_vmcoreinfo(); > update_vmcoreinfo_note(); > -- > 2.7.4 >