Received: by 10.223.164.202 with SMTP id h10csp649127wrb; Fri, 17 Nov 2017 06:32:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMY55yLSUk+ETryf7Tdr0/KeRuHqV/IqIH11mEerZj1AjGJbbxNia2dXkrILTMxCg/VqYNGU X-Received: by 10.99.64.3 with SMTP id n3mr5307713pga.357.1510929153827; Fri, 17 Nov 2017 06:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510929153; cv=none; d=google.com; s=arc-20160816; b=JmsrQvVEqxpcSxXwfG0nX30KsNvQ1JFsJzZ7PH2EJMIJYT0T6ViSbn488E9mZhXkRY xN/pc2HdPOZK+8wWz0rmuM1LSbotR10xIxP/cYIejf8HQIRl54OCRtPkqNJhl2RvMjmm xCQPEsSwJlEoIvEJ3z9VN1DdV6iYSwE689kFmqKlN2p+fC2EYoSZ5wbQmBsuhnzVpp4f rL/N6N3jk9ZvXWEvzQre/mWZiVDjrUz/jY/xv4gFZyqkVE8Xscg70f9OMeI2iBd+6kun qMV+IfGXDy1SAQ9ArcSRmsiK6oZERvF+QHhyEtZj/TSxb8WZFZbkkQibvkMnSNX65f54 d3xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=gy7D0bIoCn4SGCN2kyQfepmFS3T3iqntfOxKjbIMz88=; b=ixFQE71kQZrMojL+NvVrcHcsomUJeWxyM5al8jaUJB+oWim6/vzJOU2qrG1SEUrBd8 JX/UfhAnaRIy4NGFCRiDdVznosm9gW7FytokozuObrP7amuzapQ/SWeSywpHVHd339/N toou0zeW2/1CvOSf6GIuKdLg9evVQPzxhOsged6zGaiQD+CfFLrZ1Ac8863H73rncBXZ SBPeSMi4IXMW0PVXsji1wLwF5lvm0djmMz+yV3T/7m2AmPaJ1tbn3WFL6s/KCgu7/xrV cNK6ghQjHQOgfdWPY57Ge9QeVZ25rZbvFdPQNoPn8OpvN5a6K1AzcOEAFVTZws45DVFm 0d1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z7RBDluS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k191si2842263pgc.723.2017.11.17.06.32.16; Fri, 17 Nov 2017 06:32:33 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=Z7RBDluS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934246AbdKQHf6 (ORCPT + 91 others); Fri, 17 Nov 2017 02:35:58 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35109 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933906AbdKQHfu (ORCPT ); Fri, 17 Nov 2017 02:35:50 -0500 Received: by mail-wm0-f42.google.com with SMTP id y80so4530386wmd.0 for ; Thu, 16 Nov 2017 23:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gy7D0bIoCn4SGCN2kyQfepmFS3T3iqntfOxKjbIMz88=; b=Z7RBDluSqcYhjQ/7KGIV/mTKMSYut4WGhfAse2/+84Zn/KgsGtiE4zdceuGOVsM5i9 O9PtygHJaLV2Wt3qpXSA4J936PxGf4cAsGSJJzudEbtr37PQv4LNAxsnx0PlsfLw6PMZ gBTHTrBYp8zECxfuSdTT3wkuN2L2slv6e+F9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gy7D0bIoCn4SGCN2kyQfepmFS3T3iqntfOxKjbIMz88=; b=MrPebsxXQEYlbg1oqpb93qGs6IhWV8vmOJX8JZwVxtZlJ28xj5FLt9tSL/+Uojv3dz sw01HkPIM5ASnhi0nAVwutWJZBrAmmMNzwD5v36pCp8zOz56Ff1eRquRmAkAHjLREKAA jBXsjAGQMLYhxo0RNURuBJ0URwQmjBx9rPAvVGN00WKkk0ejcT2WYE3JLzakSkCuxSj/ MTsYQbuQy9EI2xVqGlPryXAPlWQIHRk9kDnOYyjA+P1DkmGNXkloASq749nHWsD/SIx/ 5xZpjOknVc4W1ckooa8A8urkKeaWi73zK28HSMPlhhnitLadhXcfklqtvsBIDH6cQ2dQ tZJw== X-Gm-Message-State: AJaThX6PgRP0EOlfWD7/c9tpDjE2bpSSkSCxJPazLAytiWPa5ZJbiNf/ gsMJca2MLe00hAArVDUnqIoYeg== X-Received: by 10.28.118.4 with SMTP id r4mr3638788wmc.71.1510904149422; Thu, 16 Nov 2017 23:35:49 -0800 (PST) Received: from localhost (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id k185sm2216557wma.28.2017.11.16.23.35.47 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 16 Nov 2017 23:35:48 -0800 (PST) Date: Fri, 17 Nov 2017 08:35:56 +0100 From: Christoffer Dall To: "Liuwenliang (Abbott Liu)" Cc: Marc Zyngier , "linux@armlinux.org.uk" , "aryabinin@virtuozzo.com" , "afzal.mohd.ma@gmail.com" , "f.fainelli@gmail.com" , "labbott@redhat.com" , "kirill.shutemov@linux.intel.com" , "mhocko@suse.com" , "catalin.marinas@arm.com" , "akpm@linux-foundation.org" , "mawilcox@microsoft.com" , "tglx@linutronix.de" , "thgarnie@google.com" , "keescook@chromium.org" , "arnd@arndb.de" , "vladimir.murzin@arm.com" , "tixy@linaro.org" , "ard.biesheuvel@linaro.org" , "robin.murphy@arm.com" , "mingo@kernel.org" , "grygorii.strashko@linaro.org" , "glider@google.com" , "dvyukov@google.com" , "opendmb@gmail.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kasan-dev@googlegroups.com" , "linux-mm@kvack.org" , Jiazhenghua , Dailei , Zengweilin , Heshaoliang Subject: Re: [PATCH 01/11] Initialize the mapping of KASan shadow memory Message-ID: <20171117073556.GB28855@cbox> References: <8e959f69-a578-793b-6c32-18b5b0cd08c2@arm.com> <87a7znsubp.fsf@on-the-bus.cambridge.arm.com> <87po8ir1kg.fsf@on-the-bus.cambridge.arm.com> <87375eqobb.fsf@on-the-bus.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 17, 2017 at 07:18:45AM +0000, Liuwenliang (Abbott Liu) wrote: > On 16/11/17 22:41 Marc Zyngier [mailto:marc.zyngier@arm.com] wrote: > >No, it doesn't. It cannot work, because Cortex-A9 predates the invention > >of the 64bit accessor. I suspect that you are testing stuff in QEMU, > >which is giving you a SW model that always supports LPAE. I suggest you > >test this code on *real* HW, and not only on QEMU. > > I am sorry. My test is fault. I only defined TTBR0 as __ACCESS_CP15_64, > but I don't use the definition TTBR0 as __ACCESS_CP15_64. > > Now I use the definition TTBR0 as __ACCESS_CP15_64 on CPU supporting > LPAE(vexpress_a9) What does a "CPU supporting LPAE(vexpress_a9) mean? As Marc pointed out, a Cortex-A9 doesn't support LPAE. If you configure your kernel with LPAE it's not going to work on a Cortex-A9. > I find it doesn't work and report undefined instruction error > when execute "mrrc" instruction. > > So, you are right that 64bit accessor of TTBR0 cannot work on LPAE. > It's the other way around. It doesn't work WITHOUT LPAE, it only works WITH LPAE. The ARM ARM explains this quite clearly: "Accessing TTBR0 To access TTBR0 in an implementation that does not include the Large Physical Address Extension, or bits[31:0] of TTBR0 in an implementation that includes the Large Physical Address Extension, software reads or writes the CP15 registers with set to 0, set to c2, set to c0, and set to 0. For example: MRC p15, 0, , c2, c0, 0 ; Read 32-bit TTBR0 into Rt MCR p15, 0, , c2, c0, 0 ; Write Rt to 32-bit TTBR0 In an implementation that includes the Large Physical Address Extension, to access all 64 bits of TTBR0, software performs a 64-bit read or write of the CP15 registers with set to c2 and set to 0. For example: MRRC p15, 0, , , c2 ; Read 64-bit TTBR0 into Rt (low word) and Rt2 (high word) MCRR p15, 0, , , c2 ; Write Rt (low word) and Rt2 (high word) to 64-bit TTBR0 In these MRRC and MCRR instructions, Rt holds the least-significant word of TTBR0, and Rt2 holds the most-significant word." That is, if your processor (like the Cortex-A9) does NOT support LPAE, all you have is the 32-bit accessors (MRC and MCR). If your processor does support LPAE (like a Cortex-A15 for example), then you have both the 32-bit accessors (MRC and MCR) and the 64-bit accessors (MRRC, MCRR), and using the 32-bit accessor will simply access the lower 32-bits of the 64-bit register. Hope this helps, -Christoffer From 1584323254476972699@xxx Fri Nov 17 14:19:56 +0000 2017 X-GM-THRID: 1580949494507619640 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread