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=-14.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 CAEB2C432C0 for ; Fri, 29 Nov 2019 20:05:14 +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 6FAFF21721 for ; Fri, 29 Nov 2019 20:05:14 +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="CVkLQ2YP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FAFF21721 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 lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 47PlqC6wD2zDrFH for ; Sat, 30 Nov 2019 07:05:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=205.139.110.120; helo=us-smtp-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.b="CVkLQ2YP"; dkim-atps=neutral Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 47Plhs6v5WzDrDN for ; Sat, 30 Nov 2019 06:59:41 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575057579; 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=CVkLQ2YPfUd0ow96XqRNs2ttNX55K8yO+kCNLm0bxS+OSsHGuyqQDqELXtHpu5BDJMTHwc 447+amgNT9AnS6aSvefNmfdDAEDvHWR41k//WvNZtc77h0hAMqYTsmfckNm2o6KTKzKVXC BfUSwmltsTP+1TaI/C8RJXbMXP9Vykc= 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-82-nE0_eEn2Ox-JFPOu8HTqmw-1; Fri, 29 Nov 2019 14:59:37 -0500 Received: by mail-pj1-f72.google.com with SMTP id o34so5887881pjb.15 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=H/Nj5IKc1RXqkbioUW9VXN20mlSquz++UP5VPSD8AIFlivtLybJKoLqOV90b68yy/l 02AafW56r7FgkkSOaKquXNckAS/6SrUjb50K6Fc9Z+UZCVDIptQ/wRXn1e+Zs10drHk4 4iyL+sYPrZxApneRRJkTYS1wOP+Axi12X++270ikpQMQWyEIdIloSgcFJDDQ2a0Bytnz ammHo4q3sz8TJdUdHbG8NcZ+whwrsJosJ/BeaJ5SHBQC3ccpo2m7KhZC49MnpG62x1MU EUN5YMiqS4pZM9Yv4FaQvBiuaEG8B6SyngSJHH6RXa+Gp5+55Q/vmQVZ0QsHfL/HydaI 6PiA== X-Gm-Message-State: APjAAAUjBjRtWTy+0oUnCAYakj6EyoqFzqpCJLauej7N3YXs2ql2VHIr EA1phwYhVMPErLwmA2YYwK/zM/WDlM+k1gGA6kSNJrvBHV+8vVlhluy83284YuPGJ+wjCAHdMod leoEOhHoDk9uaMEDXjtEr1IXN3g== X-Received: by 2002:a63:6f4c:: with SMTP id k73mr15574221pgc.374.1575057575600; Fri, 29 Nov 2019 11:59:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxxfC5l5m0YoqdbJOwab9vDMWknIRaUJM6sjnSau+oJsA046vHWiBYg3wYv5hDxMjiI/P8T+w== 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 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: nE0_eEn2Ox-JFPOu8HTqmw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 , Ard Biesheuvel , linux-doc@vger.kernel.org, Will Deacon , bhsharma@redhat.com, x86@kernel.org, kexec@lists.infradead.org, Dave Anderson , Paul Mackerras , Kazuhito Hagio , Boris Petkov , Catalin Marinas , James Morse , Thomas Gleixner , bhupesh.linux@gmail.com, linuxppc-dev@lists.ozlabs.org, Ingo Molnar , linux-arm-kernel@lists.infradead.org, Steve Capper 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: [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