Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp333115ybc; Tue, 19 Nov 2019 02:05:25 -0800 (PST) X-Google-Smtp-Source: APXvYqwHm7c/IiEMb1YDrrrWHMrOg5sCJFtsEi8FBngS2cYo5pYUgYKKQ2isC8GHz2eEuRnh6GEe X-Received: by 2002:a17:906:1cd8:: with SMTP id i24mr33753115ejh.149.1574157925829; Tue, 19 Nov 2019 02:05:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574157925; cv=none; d=google.com; s=arc-20160816; b=JEdUhNu/yLOxBXWSp7suuJIczV9mIeYP24lTNYfLuWQwe+7PyXs1pv0rh+WqudYNll 0Zokdy/8I9o+SSlSoT6WNWm8d+lv6uiqGx/EW26I7Z3xNamND9qgNj3hYo/WhEZ8Syna IDxFn7cauN0uSakaFGU9SUBWjDfwBirjpU0Zq7dU86ooAMe9QEPSzEF1pQgy0HUySXVT 5q9t2BjNr5042+2bmRfObHey5nobA/+mAM1jgjNe3RZamOwXOvWeUV1PbJ11fqfhQDDR p75GMkCOmTyUGw7xH61/eLDPXauQl/UqV9rK1rGYUSNdyu1QiMEOFdSHS9nXd9LtsTtS 6YVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to; bh=ABBetGt3T84LKHawzFb+xaKIum9b38xvb3zs89epCKg=; b=JwRrG7HCmQ0tZcGkja5tqlbjlKO+O2hcnDVf1KGA3of8KWvbRSDxZtFP9x/Yv3XIS3 xN1/yQd1AIddq1VanPODdm4S4cpHI6BE9WkwCuK3XdX1vz+BToAplU79cWt8W3+aVwMa f0soJ8fPk6vQM9DmJlTwrf5gWZ3A9TKVI6m+ap0qxNg4vblGA/XlCwioon1RxZdGzW5A lxpMRF4+dXGZiFZ6eaY71Ys3D0BBSoApKKxNtgLJfUsMalSPAFrmyVnySq07nXuCLOFb 3GM7xsUShVECrnfRL1NQfXtkM/LZJu6i5pfLDs83iUm7m1KA3oLJiVpRQBXc8Lx3fkf4 kqIg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h18si13216670ejc.16.2019.11.19.02.05.00; Tue, 19 Nov 2019 02:05:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbfKSKDg (ORCPT + 99 others); Tue, 19 Nov 2019 05:03:36 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:37915 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbfKSKDg (ORCPT ); Tue, 19 Nov 2019 05:03:36 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1iX0MA-0001a9-8z; Tue, 19 Nov 2019 11:03:34 +0100 To: Hanjun Guo Subject: Re: [RFC PATCH v2] arm64: cpufeatures: add support for tlbi range instructions X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 19 Nov 2019 10:03:34 +0000 From: Marc Zyngier Cc: Zhenyu Ye , Will Deacon , , , , , , , , , Linuxarm , Shaokun Zhang , wanghuiqiang In-Reply-To: References: <5DC960EB.9050503@huawei.com> <20191111132716.GA9394@willie-the-truck> <5DC96660.8040505@huawei.com> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: guohanjun@huawei.com, yezhenyu2@huawei.com, will@kernel.org, catalin.marinas@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, tangnianyao@huawei.com, xiexiangyou@huawei.com, linux-kernel@vger.kernel.org, arm@kernel.org, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com, zhangshaokun@hisilicon.com, wanghuiqiang@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hanjun, On 2019-11-19 01:13, Hanjun Guo wrote: > +Cc linux-arm-kernel mailing list and Shaokun. > > Hi Marc, > > On 2019/11/11 22:04, Marc Zyngier wrote: >> On 2019-11-11 14:56, Zhenyu Ye wrote: >>> On 2019/11/11 21:27, Will Deacon wrote: >>>> On Mon, Nov 11, 2019 at 09:23:55PM +0800, Zhenyu Ye wrote: > [...] >>>> >>>> How does this address my concerns here: >>>> >>>> >>>> >>>> https://lore.kernel.org/linux-arm-kernel/20191031131649.GB27196@willie-the-truck/ >>>> >>>> ? >>>> >>>> Will >>> >>> I think your concern is more about the hardware level, and we can >>> do >>> nothing about >>> this at all. The interconnect/DVM implementation is not exposed to >>> software layer >>> (and no need), and may should be constrained at hardware level. >> >> You're missing the point here: the instruction may be implemented >> and perfectly working at the CPU level, and yet not carried over >> the interconnect. In this situation, other CPUs may not observe >> the DVM messages instructing them of such invalidation, and you'll >> end >> up with memory corruption. >> >> So, in the absence of an architectural guarantee that range >> invalidation >> is supported and observed by all the DVM agents in the system, there >> must >> be a firmware description for it on which the kernel can rely. > > I'm thinking of how to add a firmware description for it, how about > this: > > Adding a system level flag to indicate the supporting of TIBi by > range, > which means adding a binding name for example "tlbi-by-range" at > system > level in the dts file, or a tlbi by range flag in ACPI FADT table, > then > we use the ID register per-cpu and the system level flag as > > if (cpus_have_const_cap(ARM64_HAS_TLBI_BY_RANGE) && > system_level_tlbi_by_range) > flush_tlb_by_range() > else > flush_tlb_range() > > And this seems work for heterogeneous system (olny parts of the CPU > support > TLBi by range) as well, correct me if anything wrong. It could work, but it needs to come with the strongest guarantees that all the DVM agents in the system understand this type of invalidation, specially as we move into the SVM territory. It may also need to cope with non-compliant agents being hot-plugged, or at least discovered late. I also wonder if the ARMv8.4-TTL extension (which I have patches for in the nested virt series) requires the same kind of treatment (after all, it has an implicit range based on the base granule size and level). In any way, this requires careful specification, and I don't think we can improvise this on the ML... ;-) Thanks, M. -- Jazz is not dead. It just smells funny...