Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4452959img; Tue, 26 Mar 2019 09:39:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXXpBHxJ5aPr09DBXiuIZ/8i8uworHFbe+OC5y1fslYoZYe0KUhDqVFetAPFlDtRtaH51x X-Received: by 2002:a17:902:e912:: with SMTP id cs18mr32339678plb.130.1553618391237; Tue, 26 Mar 2019 09:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553618391; cv=none; d=google.com; s=arc-20160816; b=qQDt1pmiiHAqZ9AXqdchhEYwWfiJo4evCST4r0w0JMz3nTsy5ZaqUPBrmWaQjZihTb wfHP5NBMMFVkHUy7D240SDFQX9cEDA4eshvBexhGMr6Ts67hwi48Va7bIQzYmYygQugH GQUwP1T9GOvwFoFrYNyCrivvQpm7z3dl0JVvkDGBG8LkPNiro16rc/3kcRJ+Qr6IBiqB hD89MWqsIRWKck8JEv7bg+DWg7Mdo1L/QqsJ+nGph65tybTdfTTAlTO8D2VpQdBqBNRL HbIE7M8nPlp8HtjlNzRRA/BwhG/hXX7gtiEozcGQ4DiHW7nVCOzZjuRy9ZCMGGRX5x9z V2Bw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=T7RF5N4DZ2NvDY+/KSUXRtrnha8wUQrVLOHIp9is/ks=; b=MUtvBOmQykdcT4+Y1Qbpvxacf/Y+F2D/BbRADRhZiLKySbEBaywmVY8j0JLMF5deqf 23cLr3Rus7YhdfD0ozGMEz4FQq8u5V6AYwZiHIzF297Isv+nxvzJQVrWVCC/B8sJQ0eG cC4sXCuuuJWvZT/bW1LdhLuLGWFgGEN82nMxjnB9IL6Twvy19YkS1MYEu+l+C0XwW8mZ +Eq0HTU8OHWzy/0sNa9H93VJFPFdwfseto2VXQ2wB0hUI7IeWjupCDKLq0GLnQOFL2Jt vWwox+D0bu+vDoUU9z9ce+BZjFVhTIF2IfRFfj4bMobD/YoEUW71HVxN/IiuoWd0Zfly VKIQ== 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 y8si58590pll.313.2019.03.26.09.39.35; Tue, 26 Mar 2019 09:39:51 -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 S1731795AbfCZQhE (ORCPT + 99 others); Tue, 26 Mar 2019 12:37:04 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40408 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728314AbfCZQhD (ORCPT ); Tue, 26 Mar 2019 12:37:03 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8451D1596; Tue, 26 Mar 2019 09:37:03 -0700 (PDT) Received: from [10.1.196.105] (eglon.cambridge.arm.com [10.1.196.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3F6A23F614; Tue, 26 Mar 2019 09:37:01 -0700 (PDT) Subject: Re: [PATCH v3 1/3] arm64, vmcoreinfo : Append 'PTRS_PER_PGD' to vmcoreinfo To: Bhupesh Sharma Cc: linux-kernel@vger.kernel.org, bhupesh.linux@gmail.com, Mark Rutland , Will Deacon , Dave Anderson , Kazuhito Hagio , kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Steve Capper References: <1553058574-18606-1-git-send-email-bhsharma@redhat.com> <1553058574-18606-2-git-send-email-bhsharma@redhat.com> From: James Morse Message-ID: <2757805b-61cb-8f4a-1917-0c57012f09df@arm.com> Date: Tue, 26 Mar 2019 16:36:59 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <1553058574-18606-2-git-send-email-bhsharma@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bhupesh, On 20/03/2019 05:09, Bhupesh Sharma wrote: > With ARMv8.2-LVA architecture extension availability, arm64 hardware > which supports this extension can support a virtual address-space upto > 52-bits. > > Since at the moment we enable the support of this extension in kernel > via CONFIG flags, e.g. > - User-space 52-bit LVA via CONFIG_ARM64_USER_VA_BITS_52 > > so, there is no clear mechanism in the user-space right now to > determine these CONFIG flag values and hence determine the maximum > virtual address space supported by the underlying kernel. > > User-space tools like 'makedumpfile' therefore are broken currently > as they have no proper method to calculate the 'PTRS_PER_PGD' value > which is required to perform a page table walk to determine the > physical address of a corresponding virtual address found in > kcore/vmcoreinfo. > > If one appends 'PTRS_PER_PGD' number to vmcoreinfo for arm64, > it can be used in user-space to determine the maximum virtual address > supported by underlying kernel. I don't think this really solves the problem, it feels fragile. I can see how vmcoreinfo tells you VA_BITS==48, PAGE_SIZE==64K and PTRS_PER_PGD=1024. You can use this to work out that the top level page table size isn't consistent with a 48bit VA, so 52bit VA must be in use... But wasn't your problem walking the kernel page tables? In particular the offset that we apply because the tables were based on a 48bit VA shifted up in swapper_pg_dir. Where does the TTBR1_EL1 offset come from with this property? I assume makedumpfile hard-codes it when it sees 52bit is in use ... somewhere. We haven't solved the problem! Today __cpu_setup() sets T0SZ and T1SZ differently for 52bit VA, but in the future it could set them the same, or different the other-way-round. Will makedumpfile using this value keep working once T1SZ is 52bit VA too? In this case there would be no ttbr offset. If you need another vmcoreinfo flag once that happens, we've done something wrong here. (Not to mention what happens if the TTBR1_EL1 uses 52bit va, but TTBR0_EL1 doesn't) > Suggested-by: Steve Capper (CC: +Steve) Thanks, James