Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp656186rwr; Fri, 5 May 2023 03:04:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Vx26t4TQba5BhQUsnze0LYsFv8zJrnnE4O40S+RvQET3F23taic3aSNp8bk5pT7jdMWYD X-Received: by 2002:a17:90b:3a8e:b0:247:6ead:d0ed with SMTP id om14-20020a17090b3a8e00b002476eadd0edmr932218pjb.28.1683281077103; Fri, 05 May 2023 03:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683281077; cv=none; d=google.com; s=arc-20160816; b=EJeIgSWpAsyrmCKYWTpPeUg3cWvL+QZJxgZ3JlrLpRpAnWDwfsfR8o0z3AOJT1czAx /YsYDXcq6AOHnBwcxKA2PpXG8pUCtquYibeJ1L1KLBtkhG+HeAXUChdlr5VoIhKqKbJq kPU4acOUxfJ6inA6ozqJrRHcg2Hes2kUq4AeHutJCYCVsoS1cZDB+XaeI1tG/jehWXRZ y/s6I4LCLJq2tIuWiFUymWHtkFoG6NkAsBAndtC8ohbuh14KSodKSdQokW2la+0ST9LY l0sKac/AWA67JusEEks+W57PJEi6TpqJ79fD9zadCmPdGnFdJP3ouYxFEUgL+jHLgY+r QVyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vm+Mx1O/33em24isLrPoWSjqhWN3P6cMGh6S3cQOeBs=; b=HaDpY52NucCkbLL3yK/Rt4iFnJjaC1uTItYwxhx9/mpUVwGJe8NWLIQNfs4OzV7XyA lwh2WpL/1GR3QwvW+N/JZWF+8NvPCH3iwaozdiaYcF108QurobMXXc9GlU96E3Jh3ajD IVXyH1kf1IQ1e36ST8MbAVHgQdWrv3P/X8siVdG23IZX3VM4fDv9d4z/DhK4BJDZc5Np gK/2PedQXL3dMyZkK+WZhJxACBAtjh657hhkb7RoaMyfQZ4v4L0hEWVPj/GisKuRLm2u eoVW5mLSyiIwip/pt2DwHc0z2x4fQcFoNF7FiZ1lFAzpLoUol9JMCzONt82UBNWztZqb pTLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=K5dNnmWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a17090a4d4700b0024e067e6bcdsi5869158pjh.101.2023.05.05.03.04.05; Fri, 05 May 2023 03:04:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=K5dNnmWZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231875AbjEEJtc (ORCPT + 99 others); Fri, 5 May 2023 05:49:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbjEEJt0 (ORCPT ); Fri, 5 May 2023 05:49:26 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8420919D4A for ; Fri, 5 May 2023 02:49:01 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1ab032d9266so14167255ad.0 for ; Fri, 05 May 2023 02:49:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1683280141; x=1685872141; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vm+Mx1O/33em24isLrPoWSjqhWN3P6cMGh6S3cQOeBs=; b=K5dNnmWZhIQMO7t0l+k5rLsSEpT3489zwAXuyncph4IYDcGCRFS7SwvP9jMZ4PW36U SCyOT0O7vkkL/y2HxA667m57oR9sqPgwyckHmW77kL/CpFPucQ6NyNi53R6QtUdkTVBO 8+EGT4bDnngBge2dXcANe3cTx9jjjZmlclIcG4F5KzKBtuaYxpvJQL/lEUiC6Khigyzt X//nJHJWxpjlTY4sdyXbI8q8E1wxfWEfacGfkPIOsivV5JTEuu+Zk78lvOUiEjb/dyT2 qj1qn1fvfKXyFZUWngDFkiXoLzZf1Nt4ge6SNkMnE7eAq53LgbwyT09PyHmswEcSosLB iRew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683280141; x=1685872141; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vm+Mx1O/33em24isLrPoWSjqhWN3P6cMGh6S3cQOeBs=; b=IR8R3sXs0Dx6Osot2zsLwt1jHpsqB0eAf2cpRIF/UzyTz5cWdmxsxyu+K+UXl4qutQ 7Kvtio5a2keYpDofsuhTHLtHy1rItBFwdHpjvzF7qxfBQ7X3yTiKs7/P1yIb0pfAdYNm oU0DVe43lAdhEsu71j7IIbF20s5VLDdLF+ZB5SOXOzMm2NjapTfnzDjhHuFSHN2kjMHQ Kn+I0dZY/18bBM3L2AlQ4gF0KgkZ+gIYyRty1TemGoortWbClqBPZ3FStiTf1HynH5hu TyuRqnUhyujBiE6P7YHXoc4/c/+TXlcGBLcMbsSLxVqapGGwq1ub552VlnEXdc7PmdHY jBjw== X-Gm-Message-State: AC+VfDzDBMLBdNA3p5PjiW+tlK9gIap+sk59XoR8ehAN9seq5F7Qw9rt UTDWuBYgYHfbl5DItFphHJBZtQ== X-Received: by 2002:a17:902:ceca:b0:1ab:19f6:ef00 with SMTP id d10-20020a170902ceca00b001ab19f6ef00mr1068084plg.3.1683280140992; Fri, 05 May 2023 02:49:00 -0700 (PDT) Received: from [10.2.117.253] ([61.213.176.8]) by smtp.gmail.com with ESMTPSA id b2-20020a170903228200b001aaffe15f39sm1312598plh.30.2023.05.05.02.48.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 05 May 2023 02:49:00 -0700 (PDT) Message-ID: <369d1be2-d418-1bfb-bfc2-b25e4e542d76@bytedance.com> Date: Fri, 5 May 2023 17:48:55 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [QUESTION FOR ARM64 TLB] performance issue and implementation difference of TLB flush Content-Language: en-US To: Mark Rutland , Gang Li Cc: Will Deacon , Tomasz Nowicki , Laura Abbott , Catalin Marinas , Ard Biesheuvel , Anshuman Khandual , Kefeng Wang , Feiyang Chen , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <2eb026b8-9e13-2b60-9e14-06417b142ac9@bytedance.com> From: Gang Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series accidentally lost CC. Now I forward the lost emails to the mailing list. On 2023/4/28 17:27, Mark Rutland wrote: > > > Hi, > > Just to check -- did you mean to drop the other Ccs? It would be good to keep > this discussion on-list if possible. > > On Fri, Apr 28, 2023 at 01:49:46PM +0800, Gang Li wrote: >> On 2023/4/27 15:30, Mark Rutland wrote: >>> On Thu, Apr 27, 2023 at 11:26:50AM +0800, Gang Li wrote: >>>> 1. I am curious to know the reason behind the design choice of flushing >>>> the TLB on all cores for ARM64's clear_fixmap, while AMD64 only flushes >>>> the TLB on a single core. Are there any TLB design details that make a >>>> difference here? >>> >>> I don't know why arm64 only clears this on a single CPU. >> >> Sorry, I'm a bit confused. >> >> Did you mean you don't know why *amd64* only clears this on a single >> CPU? > > Yes, sorry; I meant to say "amd64" rather than "arm64" here. > >> Looks like I should ask amd64 guy ???? > > ???? > >>> On arm64 we *must* invalidate the TLB on all CPUs as the kernel page tables are >>> shared by all CPUs, and the architectural Break-Before-Make rules in require >>> the TLB to be invalidated between two valid (but distinct) entries. >> >> ghes_unmap is protected by a spin_lock, so only one core can access this >> mem area at a time. I understand that there will be no TLB for >> this memory area on other cores. >> >> Is it because arm64 has speculative execution? Even if the core does not >> hold the spin_lock, the TLB will still cache the critical section? > > The architecture allows a CPU to allocate TLB entries at any time for any > reason, for any valid translation table entries reachable from the root in > TTBR{0,1}_ELx. That can be due to speculation, prefetching, and/or other > reasons. > > Due to that, it doesn't matter whether or not a CPU explicitly accesses a > memory location -- TLB entries can be allocated regardless. Consequently, the > spinlock doesn't make any difference. > > Thanks, > Mark. >