Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4276191ybc; Tue, 26 Nov 2019 06:38:56 -0800 (PST) X-Google-Smtp-Source: APXvYqx5Z/+SvyXG3WCdSIGP2zhpqQ85yzphjLhwf93K/fwTqUCu1vZ4T7n5yPjxvBSdN4BJRzTT X-Received: by 2002:a05:6402:22c9:: with SMTP id dm9mr2139394edb.282.1574779136175; Tue, 26 Nov 2019 06:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574779136; cv=none; d=google.com; s=arc-20160816; b=bzsyivixANKlhMTMCh7CE4tyrF2ZvnxchlEnDc76uNUbEP+Nr0o0aB0pfMmT+EW4av psosvDNoX/rHDiRKRlpfJN6Ti1EMA168AqqIq7hFiLuAV6iqrUJZl/vRXk0BazjbQab+ KXJOZ2oDYScb+OsAVCFUI4fjLbwD1/YNSO1UhE48RbWm4eEUhCaFyRanXLNuu1m8aqa9 jEezu4hSOEwZizDMqG0md0ZMBgx6gGKtrdaT6frgDoXZm9H+ORsUAqmoA6XSO1UdtO96 cxNc0+dp+g3MwGtocDcw1KH/SyOU0Qd7MoYshvAjbPyDtzYoVSKLftKMFcn0kgnTuDAQ 94Zg== 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:autocrypt:from:references:cc:to:subject; bh=sSWmTglZGYc4ExyYwCvdS+ViHBD305yRz3/saXzdsLs=; b=S8A+fiFM8eN6OI9B7J3cxY/XIpWZzxJkDs6v/kmCYFtsw9WWu/Au00n5BfxKEPf5rD /AyLjCoY/J958z7cGpiwI1Y+yeyhRUiOXihqx1CzduPESybORiCinCRRyzp0laUZ7cQJ VAPm7EGvIhyotRBtP6Bo3Eb3s1tpCECSrCscDW8cDHOwF+61TlB9QXsnIivyNHJGsyje KLfjZ9Y692oyNLXgZDKyxcE8Li95nzzYHawJKbF1KAsTITtb/THSd988kviSMG1M3/3N CcA+5l8HX4YAzZQ9QjfCN0baY+mcCTMgZC4L7LdsMByzileI4iw5wEq8zU1SoJdxxthj feFA== 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 dd5si6948675ejb.179.2019.11.26.06.38.32; Tue, 26 Nov 2019 06:38:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727966AbfKZO0y (ORCPT + 99 others); Tue, 26 Nov 2019 09:26:54 -0500 Received: from mx2.suse.de ([195.135.220.15]:35390 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727016AbfKZO0x (ORCPT ); Tue, 26 Nov 2019 09:26:53 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7F061ABC4; Tue, 26 Nov 2019 14:26:50 +0000 (UTC) Subject: Re: [PATCH 0/2] arm64: Introduce boot parameter to disable TLB flush instruction within the same inner shareable domain To: Will Deacon , "qi.fuli@fujitsu.com" Cc: "tokamoto@jp.fujitsu.com" , Jon Masters , Jonathan Corbet , "peterz@infradead.org" , Catalin Marinas , "linux-doc@vger.kernel.org" , Will Deacon , "linux-kernel@vger.kernel.org" , "maeda.naoaki@fujitsu.com" , "misono.tomohiro@fujitsu.com" , Itaru Kitayama , "linux-arm-kernel@lists.infradead.org" , "indou.takao@fujitsu.com" , Robert Richter References: <20190617143255.10462-1-indou.takao@jp.fujitsu.com> <93009dbd-b31c-7364-86d2-21f0fac36676@jp.fujitsu.com> <20191101172851.GC3983@willie-the-truck> From: Matthias Brugger Autocrypt: addr=mbrugger@suse.com; prefer-encrypt=mutual; keydata= mQINBFP1zgUBEAC21D6hk7//0kOmsUrE3eZ55kjc9DmFPKIz6l4NggqwQjBNRHIMh04BbCMY fL3eT7ZsYV5nur7zctmJ+vbszoOASXUpfq8M+S5hU2w7sBaVk5rpH9yW8CUWz2+ZpQXPJcFa OhLZuSKB1F5JcvLbETRjNzNU7B3TdS2+zkgQQdEyt7Ij2HXGLJ2w+yG2GuR9/iyCJRf10Okq gTh//XESJZ8S6KlOWbLXRE+yfkKDXQx2Jr1XuVvM3zPqH5FMg8reRVFsQ+vI0b+OlyekT/Xe 0Hwvqkev95GG6x7yseJwI+2ydDH6M5O7fPKFW5mzAdDE2g/K9B4e2tYK6/rA7Fq4cqiAw1+u EgO44+eFgv082xtBez5WNkGn18vtw0LW3ESmKh19u6kEGoi0WZwslCNaGFrS4M7OH+aOJeqK fx5dIv2CEbxc6xnHY7dwkcHikTA4QdbdFeUSuj4YhIZ+0QlDVtS1QEXyvZbZky7ur9rHkZvP ZqlUsLJ2nOqsmahMTIQ8Mgx9SLEShWqD4kOF4zNfPJsgEMB49KbS2o9jxbGB+JKupjNddfxZ HlH1KF8QwCMZEYaTNogrVazuEJzx6JdRpR3sFda/0x5qjTadwIW6Cl9tkqe2h391dOGX1eOA 1ntn9O/39KqSrWNGvm+1raHK+Ev1yPtn0Wxn+0oy1tl67TxUjQARAQABtCRNYXR0aGlhcyBC cnVnZ2VyIDxtYnJ1Z2dlckBzdXNlLmNvbT6JAjgEEwECACIFAlV6iM0CGwMGCwkIBwMCBhUI AgkKCwQWAgMBAh4BAheAAAoJENkUC7JWEwLx6isQAIMGBgJnFWovDS7ClZtjz1LgoY8skcMU ghUZY4Z/rwwPqmMPbY8KYDdOFA+kMTE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jHtWT9Ot3BQgmApLxACvwvD1a69jaFKov28SP HxUCQ9Y1Y/Ct Message-ID: Date: Tue, 26 Nov 2019 15:26:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191101172851.GC3983@willie-the-truck> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/11/2019 18:28, Will Deacon wrote: > Hi, > > [please note that my email address has changed and the old one doesn't work > any more] > > On Fri, Nov 01, 2019 at 09:56:05AM +0000, qi.fuli@fujitsu.com wrote: >> First of all thanks for the comments for the patch. >> >> I'm still struggling with this problem to find out the solution. >> As a result of an investigation on this problem, after all, I think it >> is necessary to improve TLB flush mechanism of the kernel to fix this >> problem completely. >> >> So, I'd like to restart a discussion. At first, I summarize this problem >> to recall what was the problem and then I want to discuss how to fix it. >> >> Summary of the problem: >> A few months ago I proposed patches to solve a performance problem due >> to TLB flush.[1] >> >> A problem is that TLB flush on a core affects all other cores even if >> all other cores do not need actual flush, and it causes performance >> degradation. >> >> In this thread, I explained that: >> * I found a performance problem which is caused by TLBI-is instruction. >> * The problem occurs like this: >> 1) On a core, OS tries to flush TLB using TLBI-is instruction >> 2) TLBI-is instruction causes a broadcast to all other cores, and >> each core received hard-wired signal >> 3) Each core check if there are TLB entries which have the specified >> ASID/VA > > For those following along at home, my understanding is that this "check" > effectively stalls the pipeline as though it is being performed in software. > > Some questions: > > Does this mean a malicious virtual machine can effectively DoS the system? > What about a malicious application calling mprotect()? > > Do all broadcast TLBI instructions cause this expensive check, or are > some significantly slower than others? > >> 4) This check causes performance degradation >> * We ran FWQ[2] and detected OS jitter due to this problem, this noise >> is serious for HPC usage. >> >> The noise means here a difference between maximum time and minimum time >> which the same work takes. >> >> How to fix: >> I think the cause is TLB flush by TLBI-is because the instruction >> affects cores that are not related to its flush. > > Does broadcast I-cache maintenance cause the same problem? > >> So the previous patch I posted is >> * Use mm_cpumask in mm_struct to find appropriate CPUs for TLB flush >> * Exec TLBI instead of TLBI-is only to CPUs specified by mm_cpumask >> (This is the same behavior as arm32 and x86) >> >> And after the discussion about this patch, I got the following comments. >> 1) This patch switches the behavior (original flush by TLBI-is and new >> flush by TLBI) by boot parameter, this implementation is not acceptable >> due to bad maintainability. >> 2) Even if this patch fixes this problem, it may cause another >> performance problem. >> >> I'd like to start over the implementation by considering these points. >> For the second comment above, I will run a benchmark test to analyze the >> impact on performance. >> Please let me know if there are other points I should take into >> consideration. > > I think it's worth bearing in mind that I have little sympathy for the > problem that you are seeing. As far as I can tell, you've done the > following: > > 1. You designed a CPU micro-architecture that stalls whenever it receives > a TLB invalidation request. > > 2. You integrated said CPU design into a system where broadcast TLB > invalidation is not filtered and therefore stalls every CPU every > time that /any/ TLB invalidation is broadcast. > > 3. You deployed a mixture of Linux and jitter-sensitive software on > this system, and now you're failing to meet your performance > requirements. > > Have I got that right? > > If so, given that your CPU design isn't widely available, nobody else > appears to have made this mistake and jitter hasn't been reported as an > issue for any other systems, it's very unlikely that we're going to make > invasive upstream kernel changes to support you. I'm sorry, but all I can > suggest is that you check that your micro-architecture and performance > requirements are aligned with the design of Linux *before* building another > machine like this in future. > I just wanted to note that the cover letter states that they have also seen this on Thunderx1 and Thunderx2. Not sure about other machines, like the Huawei TaiShan 200 series. What I want to say, it seems not to be something that only affects Fujitsu but also other vendors. So maybe we should consider adding an erratum like the one for the repeated TLBI on Qualcomm SoCs. Regards, Matthias > I hate to be blunt, but I also don't want to waste your time. > > Thanks, > > Will > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >