Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1153930ybz; Wed, 29 Apr 2020 16:06:09 -0700 (PDT) X-Google-Smtp-Source: APiQypKmMdiidmrjZGe3Cv5zoc5GDcdV22p+42Esx8F0D5kwXeYnoCagBeNO7PulMgAdZsD/4U0/ X-Received: by 2002:a50:e68e:: with SMTP id z14mr265334edm.307.1588201569355; Wed, 29 Apr 2020 16:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588201569; cv=none; d=google.com; s=arc-20160816; b=I5iipqsNkKaPv8ZLnr0Tl+po8lPhD3uGbPjfEbWR9WgWkHlveF7DGi4ryltHtZYwvw B5MusprU5Pw8T2ywgN72G2QvCwSn7wVFY8A4ZkDH6wH7BYcstO9ZxXVoBo+0hLlCAMr/ btJE6tVtZ6EBdOJq2EBjPkP+P5/Uad/ahCffItJKeFyeCIPxkF3rnjSnIc5jCYGRXEyH TEMqADvpGwnbFISxlWiMr2aH4i6fgbC8fuKNk8yN5Ysh0GMtKz4em0ak395qdehZEioE 3sVGw653fkWzkLKfJuiKEu2OOx8QdI1/VQ5KQx7iuZIGpYUOCaTleaZDSuz7ioOVEetR Uu5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=pTsAs2CDlbVr46p0BUoXzORZ7PJqz3PIVNdyQM5hvA4=; b=UAytoG8qyvHtUSiFep0kqTVijOtBq8QJx0gwVUjPOYtxDSnbcSPy7cPmCmU1EQ79UI sznKP4w6CLw4WKjBiNap3tTxdE5OKvLZAeSyywVRhTM9YdO8nkiX0Prr+m7fI+L1ShmX aiddfYzRtiRPnOaYoXFQi0MUylFClxq7BhJwSQZ6d8tOEo+DVaI1NRhoI2fJQTyzMe1x oNTlUhtE17a9PHFqTSczEyUyoPIYJxgigX/sijrfaYd6xH/S7wQyzdkoM8AlccWLwiFk Rtk6/tCyU6InsiI1e93IvKdEsaNoUfq1yqcNaTgTLpyvfZIgt5q/oY7UVMpUoWh/z/9I mrUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=CdmBNX7N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i20si4598617edx.314.2020.04.29.16.05.45; Wed, 29 Apr 2020 16:06:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=CdmBNX7N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727824AbgD2XEI (ORCPT + 99 others); Wed, 29 Apr 2020 19:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727790AbgD2XEH (ORCPT ); Wed, 29 Apr 2020 19:04:07 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 831F4C03C1AE for ; Wed, 29 Apr 2020 16:04:07 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id d17so1780903pgo.0 for ; Wed, 29 Apr 2020 16:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=pTsAs2CDlbVr46p0BUoXzORZ7PJqz3PIVNdyQM5hvA4=; b=CdmBNX7N3jvCxhnclyKjAisrCfjyJw95MD3shTrp1r6CmwGIN7H1/Pe2hnfly4p4PO 0fzH1jsEO3VwWjfzTAlMTeXo1sP8SzpQEvZpEEAk7t/sUBLMMCH1yx3D/tl4Xy4G5z72 AC7iaQy3XJAbuU0T+mYFO3vRkqx4GL0oQiEQw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=pTsAs2CDlbVr46p0BUoXzORZ7PJqz3PIVNdyQM5hvA4=; b=sP+YNBcNtAd08P3keXoUYjqvmemOXKSQKMuAAwb11Arnbe4+FPjnBAyBOztYAjRhq6 jY6g+Al+Do3RjyMz9SYb2bxdczh46a6gDasnLAxZxAYdumnhlE9HQe2cabbDxd+nsYQr FAe5xyXYI7UGgjV7mZpR8XmhFg0XyklUkEqy8kUle3p4ejwf8lsijOhtEn9j+38JIhVl jA34CG03ahFWRO9w6UQvlIKSHV0LaWNX2CY9FasiqM5+EO/bifql/aYyeXt508bgyjMp 4SSatPqLfATjA/VCmbbcThy8Joa6wHOwoDLEigzaIJTaQGjVUZfh4lsVAgYuM2g1GCs0 ZTaw== X-Gm-Message-State: AGi0Puadd18BDLqMTz18UytP7HokPEwcOMK3LPkUQZMJ/B+oe/pfdcgT tJ9W1oWmmF2LrMFkytshEp+teQ== X-Received: by 2002:aa7:8042:: with SMTP id y2mr504718pfm.94.1588201446938; Wed, 29 Apr 2020 16:04:06 -0700 (PDT) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id l37sm255572pje.12.2020.04.29.16.04.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Apr 2020 16:04:06 -0700 (PDT) Subject: Re: Re: [RESEND PATCH v5 2/5] arm64/crash_core: Export TCR_EL1.T1SZ in vmcoreinfo To: Bhupesh Sharma , Amit Kachhap Cc: Mark Rutland , x86@kernel.org, Will Deacon , Linux Doc Mailing List , Catalin Marinas , Ard Biesheuvel , kexec mailing list , Linux Kernel Mailing List , Kazuhito Hagio , James Morse , Dave Anderson , bhupesh linux , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel , Steve Capper , Ray Jui , Bharat Gooty References: <1575057559-25496-1-git-send-email-bhsharma@redhat.com> <1575057559-25496-3-git-send-email-bhsharma@redhat.com> <63d6e63c-7218-d2dd-8767-4464be83603f@arm.com> <351975548.1986001.1578682810951.JavaMail.zimbra@redhat.com> <04287d60-e99e-631b-c134-d6dc39e6a193@redhat.com> <974f3601-25f8-f4e6-43a8-ff4275e9c174@arm.com> From: Scott Branden Message-ID: Date: Wed, 29 Apr 2020 16:04:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bhupesh, On 2020-02-23 10:25 p.m., Bhupesh Sharma wrote: > Hi Amit, > > On Fri, Feb 21, 2020 at 2:36 PM Amit Kachhap wrote: >> Hi Bhupesh, >> >> On 1/13/20 5:44 PM, Bhupesh Sharma wrote: >>> Hi James, >>> >>> On 01/11/2020 12:30 AM, Dave Anderson wrote: >>>> ----- Original Message ----- >>>>> Hi Bhupesh, >>>>> >>>>> On 25/12/2019 19:01, Bhupesh Sharma wrote: >>>>>> On 12/12/2019 04:02 PM, James Morse wrote: >>>>>>> On 29/11/2019 19:59, Bhupesh Sharma wrote: >>>>>>>> vabits_actual variable on arm64 indicates the actual VA space size, >>>>>>>> and allows a single binary to support both 48-bit and 52-bit VA >>>>>>>> spaces. >>>>>>>> >>>>>>>> If the ARMv8.2-LVA optional feature is present, and we are running >>>>>>>> with a 64KB page size; then it is possible to use 52-bits of address >>>>>>>> space for both userspace and kernel addresses. However, any kernel >>>>>>>> binary that supports 52-bit must also be able to fall back to 48-bit >>>>>>>> at early boot time if the hardware feature is not present. >>>>>>>> >>>>>>>> Since TCR_EL1.T1SZ indicates the size offset of the memory region >>>>>>>> addressed by TTBR1_EL1 (and hence can be used for determining the >>>>>>>> vabits_actual value) it makes more sense to export the same in >>>>>>>> vmcoreinfo rather than vabits_actual variable, as the name of the >>>>>>>> variable can change in future kernel versions, but the architectural >>>>>>>> constructs like TCR_EL1.T1SZ can be used better to indicate intended >>>>>>>> specific fields to user-space. >>>>>>>> >>>>>>>> User-space utilities like makedumpfile and crash-utility, need to >>>>>>>> read/write this value from/to vmcoreinfo >>>>>>> (write?) >>>>>> Yes, also write so that the vmcoreinfo from an (crashing) arm64 >>>>>> system can >>>>>> be used for >>>>>> analysis of the root-cause of panic/crash on say an x86_64 host using >>>>>> utilities like >>>>>> crash-utility/gdb. >>>>> I read this as as "User-space [...] needs to write to vmcoreinfo". >>> That's correct. But for writing to vmcore dump in the kdump kernel, we >>> need to read the symbols from the vmcoreinfo in the primary kernel. >>> >>>>>>>> for determining if a virtual address lies in the linear map range. >>>>>>> I think this is a fragile example. The debugger shouldn't need to know >>>>>>> this. >>>>>> Well that the current user-space utility design, so I am not sure we >>>>>> can >>>>>> tweak that too much. >>>>>> >>>>>>>> The user-space computation for determining whether an address lies in >>>>>>>> the linear map range is the same as we have in kernel-space: >>>>>>>> >>>>>>>> #define __is_lm_address(addr) (!(((u64)addr) & >>>>>>>> BIT(vabits_actual - >>>>>>>> 1))) >>>>>>> This was changed with 14c127c957c1 ("arm64: mm: Flip kernel VA >>>>>>> space"). If >>>>>>> user-space >>>>>>> tools rely on 'knowing' the kernel memory layout, they must have to >>>>>>> constantly be fixed >>>>>>> and updated. This is a poor argument for adding this to something that >>>>>>> ends up as ABI. >>>>>> See above. The user-space has to rely on some ABI/guaranteed >>>>>> hardware-symbols which can be >>>>>> used for 'determining' the kernel memory layout. >>>>> I disagree. Everything and anything in the kernel will change. The >>>>> ABI rules apply to >>>>> stuff exposed via syscalls and kernel filesystems. It does not apply >>>>> to kernel internals, >>>>> like the memory layout we used yesterday. 14c127c957c1 is a case in >>>>> point. >>>>> >>>>> A debugger trying to rely on this sort of thing would have to play >>>>> catchup whenever it >>>>> changes. >>>> Exactly. That's the whole point. >>>> >>>> The crash utility and makedumpfile are not in the same league as other >>>> user-space tools. >>>> They have always had to "play catchup" precisely because they depend >>>> upon kernel internals, >>>> which constantly change. >>> I agree with you and DaveA here. Software user-space debuggers are >>> dependent on kernel internals (which can change from time-to-time) and >>> will have to play catch-up (which has been the case since the very start). >>> >>> Unfortunately we don't have any clear ABI for software debugging tools - >>> may be something to look for in future. >>> >>> A case in point is gdb/kgdb, which still needs to run with KASLR >>> turned-off (nokaslr) for debugging, as it confuses gdb which resolve >>> kernel symbol address from symbol table of vmlinux. But we can >>> work-around the same in makedumpfile/crash by reading the 'kaslr_offset' >>> value. And I have several users telling me now they cannot use gdb on >>> KASLR enabled kernel to debug panics, but can makedumpfile + crash >>> combination to achieve the same. >>> >>> So, we should be looking to fix these utilities which are broken since >>> the 52-bit changes for arm64. Accordingly, I will try to send the v6 >>> soon while incorporating the comments posted on the v5. >> Any update on the next v6 version. Since this patch series is fixing the >> current broken kdump so need this series to add some more fields in >> vmcoreinfo for Pointer Authentication work. > Sorry for the delay. I was caught up in some other urgent arm64 > user-space issues. > I am preparing the v6 now and hopefully will be able to post it out > for review later today. Did v6 get sent out? > > Thanks, > Bhupesh > > Regards, Scott