Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp911235rdb; Fri, 2 Feb 2024 07:42:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeyncusVVdSb6PNDX9htCuhY65Vd9ROP2bpMhfy3VfZveFCPz2V55RSCXwcam4VtNYEds6 X-Received: by 2002:a05:620a:4d04:b0:784:8c6:69c9 with SMTP id wa4-20020a05620a4d0400b0078408c669c9mr2646586qkn.73.1706888562900; Fri, 02 Feb 2024 07:42:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706888562; cv=pass; d=google.com; s=arc-20160816; b=gbDhATNqYnm34cjhup+OTf32j1VVl8sUBcbwPvEf3z/Jvvoc5U9wzBmpnaklyM/hid C9IAiM1N3GhpbKaNf176LXQw4U98R+xcIAgrmld8Cno8fE54pHvpIhntw+p/mBX8TPr3 3v7cx3dZig/FYWAunUZF8OJQPQOmKz1PH+R1HGMXmOaMuuPM9wBz+790TuTUaJcv8AOG w1PiFIYGeMdzl1rRt60Hko2/kibCK/3r3SODqgCIDSO3PtyJIQcHjx/1YuOTUVfJn/Dp VbX4fE2/28BQ5C5Gik3xo4w/kT0rapZFIVzvgywJyUom8ia10p1ww5VlZBX9/QDVBAF8 jBzA== 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=kogXmKbjRAlSmOtOOnfMNwgduTqXGjDmhtreItP19dw=; fh=3JKDZgwg3tSBMBLgUOV467u9KFuYuz1pUaFmcQivW3Q=; b=v5G7qp1McdrYtHkRDOjy5ht4jLrOgEIH6wvp3NedDK9yhA/FKn/mQ769SbT7Nnzas7 0ELPM6h/To5XGy685aKyF8sDFGvAfzMCmc+6MTJqqTe6YZ7O4vSFUPGI58BxraZxx5RD 3NN4TQ7BTpWz6do7UnuR25H3UKWTkVCDQx3fpLcB49WHilkn1rnXuHWS7IDp+ZZyJCsw YASHEFYsEfqatWQP7SxBHMXvFfursf0Ftz+dNh7KDpbN5JiU/OsGj9mz07o0K/0a8Qxk YouMYiswgJbzRslitnvPrANUryMebWUjl6j2INqYKxXDQzqozl/DwKat3yS8ZwFIgZ/E d5dA==; 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=ZbKRPYqX; 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-50040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50040-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVRycsPLvaFuz6bZr9TQJfW44S99bXCXaNHJ09Zifjn5Wls/PQ0PBDRk6p+V9+QSUwvV2NO9jZdxH6APWLmSK6d+qqRNN6k3GW654839Q== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x11-20020a05620a448b00b00783f53a5507si2436347qkp.741.2024.02.02.07.42.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:42:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=ZbKRPYqX; 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-50040-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50040-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A3CB31C23A9F for ; Fri, 2 Feb 2024 15:42:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12B07146915; Fri, 2 Feb 2024 15:42:25 +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="ZbKRPYqX" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.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 461534779F for ; Fri, 2 Feb 2024 15:42:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706888544; cv=none; b=bbBinToJ/2u1CetwAWPyZGXyesZGe6m08aHqzhJM+1X+rUZlAKcjlwNNmjga6YpzxPlgNWcSDr7Dam/xfWxAYCFUo+Jui3fTYD29lyK9BK7Qt6QAxeoYrZegWMwOBOG6+r9Y/R+p17d8q+AR9uScj/zjHS+hbvL5YDlaSUZqY+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706888544; c=relaxed/simple; bh=OiGaU8y/o6fbWR5avhxnnOCplVwis+BAgwhvIPqbVFQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Csb1dBs4wVX/AtDG1tk6u89jkuddl7fs0hAPzF9vNloDCm7P+dU5aOQlccIpBdUnYkhBpR+7PO4jiYW3kRAbBnD0PP1uhIK6LFthfzbbtcJ4bDVUIt9eE/07sAzHRws2SO8oD/OI9Lq7Le+q4QGXqzPw+glFABjqJ2wuBZXUpHA= 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=ZbKRPYqX; arc=none smtp.client-ip=209.85.218.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-ej1-f47.google.com with SMTP id a640c23a62f3a-a271a28aeb4so331195166b.2 for ; Fri, 02 Feb 2024 07:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706888540; x=1707493340; 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=kogXmKbjRAlSmOtOOnfMNwgduTqXGjDmhtreItP19dw=; b=ZbKRPYqXhs8YmPNPsVlwSfGLAZDCZHigQ/DbLGx/FyTW210IuLn6oMGYNt6HA/Q1eM 9h/OqtdDXPKjPJ1lMxqCWMel/I7jsC31bxRwPvjs93jXGhNrJIjkHXI//jQ980s9rQeX MtyPx/MNAIGpEjO6sBxDlQ/kBMhaosd2fnfenhXPcTiFAa8aoRjfiFXfzehISRKD88Hp 2LQWrAwZ/IDjJR1nJPNjiAzsQFVClKV+bexyU8FhGS/MWWiyGqwP+D9uwZrZdITG11UZ 79zlWSp0rG3kMmV77rS1K2jmNCikR8yRoz776PpCoX0xGxk+9gJzcDANGbSvxFVJwR7b FUsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888540; x=1707493340; 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=kogXmKbjRAlSmOtOOnfMNwgduTqXGjDmhtreItP19dw=; b=oSueLKkE0F4hW7EhT0cIYcwyHes6yid2DDGviMuP2ZYR3Ev3Xta6utqUOD7GzZ10IE NZIB0GCndPCYl0fAzFOCF3hxjWJmp93WO/EuYl7rnrcyK0tKhsbh3bS08pbEOiTu8qng cX0BCIsSHPkQeCh27fVYkWFlrCe3SaSLGO7iwBZlR3LIgsltuzfKoDJJMHxzz8z0g2cI +Giob871CqlDKB11jiEziJHtK/sfS/MS4gtKuAp+MgIXAocOV4VEhH5WTkAOKjlChoRk myjXn+KXtLLCCOncZ6vKb2d1vX/CCars08jelE3N562bCY2aj3zWUBqw2WARLtG0d41u xOXw== X-Gm-Message-State: AOJu0YxCTSQJz0ropBc6tKj20nRYYw45OeA6SXhGP79VzP2fsIcIZp4i ssOF+CUbbGvrlkRk+kMHVh2lAhC2NDhM3e387s376ujtrTj/Egh7zHHUoVkHfiVtAfye2INRrkT lY8b+2tBMEf3vg3mhOMet0v1+L0033AWWHI+92A== X-Received: by 2002:a17:906:538f:b0:a31:8ca6:dbb0 with SMTP id g15-20020a170906538f00b00a318ca6dbb0mr1676412ejo.16.1706888540289; Fri, 02 Feb 2024 07:42:20 -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 16:42:09 +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 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 mad= e > > 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 property= . > Similarly for other archs. What was rationale behind this Svvptc change? Actually, the ARC has just changed its mind and removed this new 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 xRET= : > Perhaps integrate the above counts w/ the perf gains in the cover letter? Yes, I'll copy that to the cover letter. Thanks for your interest! Alex > > Andrea