Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6232806ybx; Mon, 11 Nov 2019 06:06:05 -0800 (PST) X-Google-Smtp-Source: APXvYqxk6e3s0BWeYwIqYHH0DuhaF/H9HdwORjLYESkiuhJRrbVzRjldhcz0RypiF3Va1l2UeO8i X-Received: by 2002:a17:906:6b94:: with SMTP id l20mr22187176ejr.238.1573481165781; Mon, 11 Nov 2019 06:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573481165; cv=none; d=google.com; s=arc-20160816; b=iPAkZqd/NtgX1Nl39HNQZKWJFOCf52dKx29nmqZGjhdr9Ugly+Sflef9Grv6s4gdtV Yayi13XLHx7CA+ITJZ3uss3GjbbBMj+rV10WrKmbbU7U5L35oYHO9n/mTH8ydovbYdRo wFD9bKiv78r2U8dWDMB0smqDJbO/YNE3nJlgYveJ3SIImSo1aCnrm7hAsxyQ8IxzC0cD Stxkh3nlecM3KJd4N+aCJHCuMjJZ2xDHCj1LSx+oS025ZAzSB6pyGnsgkKT6SymNPFkZ xuEvjcPfjt1ZanqUYwa1QQn2Dg1Aec+ftxMyrfyzMV6GFjidqpal/tAdQ3R7zvqB94x3 vBrA== 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=hLJO+i0yYsreBdNtMewpjEJ2yIsPjGig9g0mBnXIuT4=; b=bnm5V6rghqFW16WhIawu7Y73xBiU3svPQkFEDoI1h/obBhmHihouLe5fWX87WVdd2G 4c6b1CgxYgUl5cb8qomBFET1/CqEyMvy1c06qX4UnEDBYb2QIo/xd+LbdMZVR1d/A8We pCHC3aBiTOppH05D5JtqDCiWqVPNgltHJXs3jQQCw/jXRNwyX/6YxrakxFSBbJua9Ut8 XL2y4tkKcSNJSRLZ6wZRb/YwCfgegbiRvsUk60e1QV+IPFwWiOwxS/9r/cUJv/VixZQN KHVr4hO6dRDf1ysCjZJfx1dciFQsW4zQi2LD8huidjbXgDM/319/YjaLnO9Ib74lfsO1 CGyQ== 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 gw9si9618623ejb.284.2019.11.11.06.05.40; Mon, 11 Nov 2019 06:06:05 -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 S1726994AbfKKOE3 (ORCPT + 99 others); Mon, 11 Nov 2019 09:04:29 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:53233 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbfKKOE2 (ORCPT ); Mon, 11 Nov 2019 09:04:28 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1iUAIr-0002cs-UW; Mon, 11 Nov 2019 15:04:25 +0100 To: Zhenyu Ye 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: Mon, 11 Nov 2019 15:13:46 +0109 From: Marc Zyngier Cc: Will Deacon , , , , , , , In-Reply-To: <5DC96660.8040505@huawei.com> 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: 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 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 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: >>> ARMv8.4-TLBI provides TLBI invalidation instruction that apply to a >>> range of input addresses. This patch adds support for this feature. >>> This is the second version of the patch. >>> >>> I traced the __flush_tlb_range() for a minute and get some >>> statistical >>> data as below: >>> >>> PAGENUM COUNT >>> 1 34944 >>> 2 5683 >>> 3 1343 >>> 4 7857 >>> 5 838 >>> 9 339 >>> 16 933 >>> 19 427 >>> 20 5821 >>> 23 279 >>> 41 338 >>> 141 279 >>> 512 428 >>> 1668 120 >>> 2038 100 >>> >>> Those data are based on kernel-5.4.0, where PAGENUM = end - start, >>> COUNT >>> shows number of calls to the __flush_tlb_range() in a minute. There >>> only >>> shows the data which COUNT >= 100. The kernel is started normally, >>> and >>> transparent hugepage is opened. As we can see, though most user >>> TLBI >>> ranges were 1 pages long, the num of long-range can not be ignored. >>> >>> The new feature of TLB range can improve lots of performance >>> compared to >>> the current implementation. As an example, flush 512 ranges needs >>> only 1 >>> instruction as opposed to 512 instructions using current >>> implementation. >>> >>> And for a new hardware feature, support is better than not. >>> >>> Signed-off-by: Zhenyu Ye >>> --- >>> ChangeLog v1 -> v2: >>> - Change the main implementation of this feature. >>> - Add some comments. >> >> 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. M. -- Jazz is not dead. It just smells funny...