Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1110105rdb; Fri, 2 Feb 2024 14:09:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IETb+Dyz5y3l9R3TbS0jyXhwcoJFqblQOccjGEyb12rNptBLRpV22tjufa95xNQnrxWiPKE X-Received: by 2002:a17:902:ecce:b0:1d9:58a1:7e0f with SMTP id a14-20020a170902ecce00b001d958a17e0fmr3974544plh.36.1706911792530; Fri, 02 Feb 2024 14:09:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706911792; cv=pass; d=google.com; s=arc-20160816; b=E0yhj9/gH27UErS/roAOoY87pLTkGVdhZYFJk0kuP8UVhT7W1SJ8fP6y6HpngJLZg1 y1pKIeWBGtuqpG0CRiJ28JLFbhKoEv7TIjSATGZh6SJYmdy+YfSNrCTEsZS+PnkH8jvf 80PCIRlU6uxTtyNY2JurZMFOHrad4SRZa73hT9mDJag03jU2D2L7AajxwaCkR/KeFty/ dsLkD7LxSUFhJ/0sU8mYs7xcoIC+xq8lXNIMt9+uQ7801Z33ZdQc29AcIBWB5jXZgzDn +hkbkOmh0BbJpNlomTJ1JgFQtvm/HQnGrJ4DOdDdT9xDVFEmE6MbY9LUpw8N3M8/Ui6A XSdA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=88hcq8XgkrpsBeyZheiHmTOtZGbbdlYCkf6URsqgIp4=; fh=Y3mLu445z44ZlouXLi5ykA0NfRS6uzD8vyx92Am7HfQ=; b=xAeBTAnLfvIDD9jl5k1V0yxuZ9TsClmWpE9RKZrKWHpbEY9sEbJKQio4VGnFUEo0e7 zso0a4ViL6VdvtMbZr19hcSE2+nzyD8NgG5BXEBe0JSpSr5rmR5xMgniZAvxZ1DAoLQj KdFsYwJEByFbIObsXbcUMsJ4m9MdCd8peVpcrzcQObSyR/hRj7HYD59UB2N+2nScvKGK 4Q9ezZwWgWo03zBSCGmO6Kx8O5WpEMV67jk10FkhbPcvXJ3WqIkvu9bDy8ml7zXOV8In L/rskxaHfx+O+gzSDgIZYKx9+5mJ6a5Ooos35+C+rTjgdGBlselMunPUZYEw9AMKei5K fchg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=HqcJnJXt; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-50648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50648-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVvdRzOZvW9GTrcC5+xgNNjXT+rykwsLZAcSut6RNH5O85fxZ2d2LIRPGrG42y5XQJsaj/v8JSgCJ2+87Jr4sRIjhvPQZEc6tmHeSZQCg== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x17-20020a170902ec9100b001d989c0b997si238537plg.515.2024.02.02.14.09.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 14:09:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=HqcJnJXt; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-50648-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50648-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9B035283653 for ; Fri, 2 Feb 2024 22:09:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 637268595E; Fri, 2 Feb 2024 22:06:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="HqcJnJXt" Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAE1785942 for ; Fri, 2 Feb 2024 22:05:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706911559; cv=none; b=rj9LVt6x6xQkcI6Vb+tENhcK+0JgouCurR/OdsJ9Ts+EtPJi9TJFAcnbDKrc/BXenAtbrKI66c8G427CMsjTQRyeC7Trjso6RSnsoOYYWdNHAIrAGZfl6UlDfzoO7LFJpce717/KDfvgQ+R3U3UdNA8jlALQt2NbBvS/Jc3Djz8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706911559; c=relaxed/simple; bh=vzxGVJZTyLyW5M5KJyCurL3KBonx/0+YslgCT13JXjA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=q4PLUMyeFG7fLkXBRTT8BKzAShtAF8pcSWeXWjHJFDR2gnJhI367ICbl5JB+j7ve7ZTMBNe1xUQb9tNTGpeW7wPGWZNbDrygIcQ/9DGgYx5cIl1hwPGDo0rOgitJgbW4MkE5m5q+eFQwsnhf7m0XJ2Sh2Df1ri4rGGrBU5B6A5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=HqcJnJXt; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-55fc7f63639so2999126a12.1 for ; Fri, 02 Feb 2024 14:05:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706911555; x=1707516355; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=88hcq8XgkrpsBeyZheiHmTOtZGbbdlYCkf6URsqgIp4=; b=HqcJnJXtG2m2Ius+OiWv5UL5wvnQRKc2wKtyGBscvipEv/S1GPAYMoOC3zzcwu7suq 49eHVzS+58Y5d5OteUJ811C9buJqT+Je7tO0b1HNGzKubnu2S2XWem7rMXXSdTvA2hy/ sRkoP33pMGZqoQ09wJRmMNX24D8SCzvuz87xzBbI5gOfJq2bd/FOBsnTTwJREEIP/xWn xp/8YMamQpoWS39JAt8NSIxE83l0DkBX1l1GtDyA/vknMQ0i9JLzshGDBFhwNMYp9Jus gm5hByu87TQpLjXs+HcjSVwYCAEN/+UT9VvJDX6cTd6QFrOSNokTp2QMMejoeWNYQ6zi YQxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706911555; x=1707516355; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=88hcq8XgkrpsBeyZheiHmTOtZGbbdlYCkf6URsqgIp4=; b=d/b4mxkALVPot1rv0mz3F2NlaNsMFEBUyBlqxaTaBYYHeV7ZexxF+nT+o3h/BAOkQr 5R2AAlMU+1PRauJycqJjmsqHClIW+4t6XlY5Psu7lrhGNqMMSzoFtYlwSxW+7GVD5Bzd NXVsZ6Wm+sD/Y62IBdzLxna3Dr8sXV5qks19n0ZyIO65yutEiLinYHOXrYSd+O5S7wk+ tYAmYLBVmmHxZjmvvkxgN726YhgfvpyfQBNM9fsR5Ohb2p9NUZLr1zcMDSChDq0rObfj 84EM3QFMBgXNsGBuk5GoL/QC1zx6cxjUqpgCbIBBOK9ps+kGg92qN/pWn9/2C2QNz68l 95TQ== X-Gm-Message-State: AOJu0YxKAZ7tINWTzY3zuuHu6AvN5pDJeTGECXs+04iRNs4i4JpN6mXt ZxX8iSbUYN5cVAoFtj06ftiFO0i334E6W8wELRmXVmqoYGDybz2aHbSKLBsFJsyn/xPvcU+Ga7T dQXcYVw+7sL4TSF8A95TTbgKPByVpcxGt/o5WdQ== X-Received: by 2002:a17:906:2455:b0:a2e:94a0:93b4 with SMTP id a21-20020a170906245500b00a2e94a093b4mr4841883ejb.61.1706911555736; Fri, 02 Feb 2024 14:05:55 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240131155929.169961-1-alexghiti@rivosinc.com> <20240131155929.169961-5-alexghiti@rivosinc.com> In-Reply-To: From: Alexandre Ghiti Date: Fri, 2 Feb 2024 23:05:44 +0100 Message-ID: Subject: Re: [PATCH RFC/RFT v2 4/4] riscv: Stop emitting preventive sfence.vma for new userspace mappings with Svvptc To: Andrea Parri Cc: Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Morton , Ved Shanbhogue , Matt Evans , Dylan Jhong , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 2, 2024 at 4:42=E2=80=AFPM Alexandre Ghiti wrote: > > Hi Andrea, > > On Thu, Feb 1, 2024 at 4:03=E2=80=AFPM Andrea Parri wrote: > > > > On Wed, Jan 31, 2024 at 04:59:29PM +0100, Alexandre Ghiti wrote: > > > The preventive sfence.vma were emitted because new mappings must be m= ade > > > visible to the page table walker but Svvptc guarantees that xRET act = as > > > a fence, so no need to sfence.vma for the uarchs that implement this > > > extension. > > > > AFAIU, your first submission shows that you don't need that xRET proper= ty. > > Similarly for other archs. What was rationale behind this Svvptc chang= e? > > Actually, the ARC has just changed its mind and removed this new The wording was incorrect here, the ARC did not state anything, the author of Svvptc proposed an amended version of the spec that removes this behaviour and that's under discussion. > behaviour from the Svvptc extension, so we will take some gratuitous > page faults (but that should be outliners), which makes riscv similar > to x86 and arm64. > > > > > > > > This allows to drastically reduce the number of sfence.vma emitted: > > > > > > * Ubuntu boot to login: > > > Before: ~630k sfence.vma > > > After: ~200k sfence.vma > > > > > > * ltp - mmapstress01 > > > Before: ~45k > > > After: ~6.3k > > > > > > * lmbench - lat_pagefault > > > Before: ~665k > > > After: 832 (!) > > > > > > * lmbench - lat_mmap > > > Before: ~546k > > > After: 718 (!) > > > > This Svvptc seems to move/add the "burden" of the synchronization to xR= ET: > > Perhaps integrate the above counts w/ the perf gains in the cover lette= r? > > Yes, I'll copy that to the cover letter. > > Thanks for your interest! > > Alex > > > > > Andrea