From patchwork Fri Nov 29 19:28:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 11267569 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C6041139A for ; Fri, 29 Nov 2019 19:29:50 +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 8F2F3207FC for ; Fri, 29 Nov 2019 19:29:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JBNWZzrT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="F3EzRYho" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F2F3207FC 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+patchwork-linux-arm=patchwork.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=XzYiSrSj95drSkyIVn/2gc7bePp28Ua00H9oYNFQH/I=; b=JBNWZzrTRFCsAgAKOI4e9Kv5YB kZJaFS3+hC88XFnXkDsfBWgQbnPSHOV1taYi9y5PdNQ0mdRv9mD1mPwalFsmBy+dKMtjA+8N29H1e zAlwAeVm6NsPQJLH2G/4h5dldcjO+2qVMSDveCzxmoSqbClScXIK0HOvA8+5+Zv7sOg4IlKN6HzM8 XdKosArPxdUrKa7IRvwhcYuZyRJuiZjZ9hfJZQp6ZHPR8J9yc0B2yrzoUOO+5xiwS8C6lejHaV7I2 8txjMEy6huByqipzoWqFiF/FaVdaU5Z6ITj1khN/lzUNsl0+k+9qcl0uSo2aKu8hDFhB25ccifsQY 3w7wM3FA==; 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 1ialxY-00063a-UO; Fri, 29 Nov 2019 19:29:44 +0000 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120] helo=us-smtp-1.mimecast.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ialxB-0005ib-GW for linux-arm-kernel@lists.infradead.org; Fri, 29 Nov 2019 19:29:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575055760; 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=F3EzRYho3tue3ytPHQ9V/n5N86/BydLD3TnAQz9su7XLr2v+tetwFsu5qL8zL26ok4xhA9 7l1NR2Ddrazhfwfifj+DSok9/Gd3Htd36h/HPC4U82Kzl/mq/xLKrnAusnRw4Qo8FZ01o4 ZYyn+3VO9g15s/9ajjA/M4AIvpxYtGo= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-317-rq3xmlX_MZev-PzhsYP6HQ-1; Fri, 29 Nov 2019 14:29:18 -0500 Received: by mail-pj1-f71.google.com with SMTP id k93so11294835pjh.5 for ; Fri, 29 Nov 2019 11:29:18 -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=RaSQ2l5aZ2LGmp60C9zln/F0jW57AhKaQZmDrCQE3M5MuqGPHTjj4zLdjC+6nuK4j1 qTYL33ZcEn6f6FejI+TWWDxx+p+kkP2s7UduXkqoY//jUoUkOkZj4kX62NNE0xFEal4i nvEShqRU48wD5mulIJ9sBKuS3LWRCJYDMQKT/Dnj5YVnMQoihf4Q1UJpmymNI2wQdZJD Kh4a8dR2CG4ZmynxJZ4e8JxHUycchdeccFnIHTuIg3khVdXPIqOBKPVQWTB3tXSaNkeZ KWA1ZXpJeosaFN2EComLgbx/uMfJE73O4ZxaikU1oXni2gHXskuFDz762gaAoIWJWr20 iztA== X-Gm-Message-State: APjAAAUsEPH71aPPu2BDE4taGO06Divl0tsfLDeMdPcPCk+PVymu41kV YpLPhtpfbrV1ZmnDtlK9Xn6B9lIIP/1QGRU0USmU+J6wM9m1PcB6WhKovDBQEZjSuR0nktsbvgw oKIslKI1kL8idcvTWjiY9XSlr6HlzjtlIkq0= X-Received: by 2002:a62:e811:: with SMTP id c17mr59017424pfi.136.1575055755725; Fri, 29 Nov 2019 11:29:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxmbfojhLeBaMJ+LMS9xhgE2Ea/t4NGJd82NYLWuOeIYvKi0ET6gSLJo8cMWL7LovPsMdHq4A== X-Received: by 2002:a62:e811:: with SMTP id c17mr59017393pfi.136.1575055755409; Fri, 29 Nov 2019 11:29:15 -0800 (PST) Received: from localhost ([122.177.85.74]) by smtp.gmail.com with ESMTPSA id p5sm871469pgs.28.2019.11.29.11.29.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Nov 2019 11:29:14 -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 00:58:42 +0530 Message-Id: <1575055726-23464-2-git-send-email-bhsharma@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1575055726-23464-1-git-send-email-bhsharma@redhat.com> References: <1575055726-23464-1-git-send-email-bhsharma@redhat.com> X-MC-Unique: rq3xmlX_MZev-PzhsYP6HQ-1 X-Mimecast-Spam-Score: 0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191129_112921_654264_25DA7712 X-CRM114-Status: GOOD ( 16.92 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [207.211.31.120 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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 , Ard Biesheuvel , Benjamin Herrenschmidt , 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 , Michael Ellerman , 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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: [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: 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) 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);