From patchwork Wed Jan 31 15:59:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13539570 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A74BC47258 for ; Wed, 31 Jan 2024 16:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC1166B0089; Wed, 31 Jan 2024 11:00:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E492D6B008A; Wed, 31 Jan 2024 11:00:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC3186B008C; Wed, 31 Jan 2024 11:00:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B4E8D6B0089 for ; Wed, 31 Jan 2024 11:00:41 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7868C1C161A for ; Wed, 31 Jan 2024 16:00:41 +0000 (UTC) X-FDA: 81740069082.21.D10DD37 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by imf01.hostedemail.com (Postfix) with ESMTP id 3B7794000F for ; Wed, 31 Jan 2024 16:00:35 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="q/J4dHh7"; spf=pass (imf01.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706716836; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=l+Qkjn6hBpgJiZ+fG8bZMEzxCOTIiddvh/UVG/MhUw0=; b=vvnrP0Z60OFky0SrAiOcJR0+PIsnpREMIg0SQaxOnMM209d6UdTpeZyhf4iPWQRudqW6VV HcEy5rIA1iFR16POCiwHJXhxnzBvZU9RCV/lW8JnacNh073/hS6fwUi3Fe5GKGgfHqq3ZJ 8xsB1DygQn0h8vUcno0/k4w//FBIV+A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706716836; a=rsa-sha256; cv=none; b=xfmZKB0PpAf0h0V6QYiOXrJMAxLrHOdWp7MYOAWa5nn0EQ6ulfOUUwnIhFHI4XHX1x6xDX oMzgeCcbhyJNF0il6TtMAN5qWIlX+X5SL9Lm99ROkqqbH3r3y+dYy5ZoWEUlYeWo5piFbF k9t/9BRydOQd0T44UW/szYHKUhGRn80= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="q/J4dHh7"; spf=pass (imf01.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-33aed096cb3so2655729f8f.1 for ; Wed, 31 Jan 2024 08:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706716834; x=1707321634; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=l+Qkjn6hBpgJiZ+fG8bZMEzxCOTIiddvh/UVG/MhUw0=; b=q/J4dHh79GwuIS+Y8qBeZXBSeGUjz2ci0MRlAFJd2LZwqYVoQIeP4N9Dg7w3znfD12 ijTG44RbPKanfadFwxMpcPlWK7eEkmiNgfCeNx/5IiyFURhp7D1zVuHFfL72JLXShmjm /tynElGa7uMZahMD8O5IF48EIYCLAJfSXfHgYxGYUwf1EnmLIMVYehwJ7kX3f1SKxmc+ dOHOLofyBCKTklZqHBHU0MhD2zQkGN4OJoUzIssYhsxfnP9SZ97VWhNmpyytEtUNnL36 EqiPBOo5ZFfsKwEtljVQhQ+OfvnB/FjUkR5q+pjiE7IXIMzkaFQLnNMNzKL+NYgg1Tj3 TjSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706716834; x=1707321634; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=l+Qkjn6hBpgJiZ+fG8bZMEzxCOTIiddvh/UVG/MhUw0=; b=UjTQd6oaQ/4iQS9Q0+klAKeY/HLISTLeT9bLSSp8A9FCreV5z6z3V5vD2TBFdTw0NW AzZV0/cdssvTBq5NYKwiIYIBp4+hZ/HCdHtHxakmW6aysz5/Ldpc2PYICWj31UKkgL2b BSVpOyiEkX30JgSmxNOhmDLU/JdG+4g4E12ivSPAAo+I2mDm990K3nmwET2zbqEMFIH3 sQqZA2CG2iM0Ja/mZ+PtMp9vctkzRgbtkj14xktIPD6TlBgU+H2ykN291IHFEGKea4kb dt6cJpaHTosxoxQUUqi6G3W3htacISWo7vEit+k2zsWxdI1+8tJmV6irQqiz2pIP9rY8 l1WQ== X-Gm-Message-State: AOJu0Yx1edkfc2jNVlC+XiXW/o2vpyM2d3+EqguBssBUoR0NoVYs6LT9 RWD31asw0jRsbBGI4NZ0yasMElcOkkglFJgMnX0yH2zlBN7vTO+Puk5SA8EMj3Y= X-Google-Smtp-Source: AGHT+IFOSxR0VWlTtt7aglVFKjETqM8YWHF0sImDLgGpk3Msu3yazxT2zwUbsrkmDtaiclYuoSVVQQ== X-Received: by 2002:a5d:5917:0:b0:33b:d2b:58f3 with SMTP id v23-20020a5d5917000000b0033b0d2b58f3mr558876wrd.19.1706716834000; Wed, 31 Jan 2024 08:00:34 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUn1b13ZNRzCy283eTAlYXQTLMwRwVlajpW6U17NkyZK4wk2yBhhQ7T7nAGYIIbO3fJ1ARDkhMYCymd0vjQMM0mrJ0m/2m5lqBZyglATKjW6Zzxk/B6IJxznkuZmxZ1TJ3cH/Jp7BwBza6guGnEdasuQE0GewfiE3ubxHmLjvIs78DGDJSzfU/27VEF5pveogS4Vow/bhAbdFMdW/IYDGaAnF3nYumVGAKKCQ9nOgSKC2eBOC9xOLx9JnZoKZ9Ho2yCI5z7MSseFIDdPa/XkBHE54iCbRdQndKCDPy8bxiyotgwxiZcx3+SuuiPofERe0MckS2S/6E/kyrL0HaRaM6pU0woqZankCuKbNH8VnYSPLkzkZXNl1AoJEPO2fnXvrc8+TnmO3oeiqwbluhwV/1QlsQj8h5rpppgqTJEQ3xcqtL5sWlt6z665n7oC4bUikHUEWzai7vZXm1fcPUkYFOER3XwNdulkf/usUZHT/OjBrDM0lxJa6CFYX9RdHrjmrlArydX8NPIXD5OMrv4c+E2pFpdAAT5fFO4s3946JLh8K6iNGoyV/fVL/yo3WohQ0Ry8fKH1EPmF4vZRA5gJKtC5ux/QZPWhUJlSKGm0HRLl5zV1RXt+xleNrI19UU+2m9Tgg+hmovoV0hevg== Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id v8-20020a5d59c8000000b0033af2a91b47sm7494000wry.70.2024.01.31.08.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:00:33 -0800 (PST) From: Alexandre Ghiti To: 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 Cc: Alexandre Ghiti Subject: [PATCH RFC/RFT v2 1/4] riscv: Add ISA extension parsing for Svvptc Date: Wed, 31 Jan 2024 16:59:26 +0100 Message-Id: <20240131155929.169961-2-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131155929.169961-1-alexghiti@rivosinc.com> References: <20240131155929.169961-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3B7794000F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: ttc4ub7k6nec6dpfac9gxosnzxcs8au4 X-HE-Tag: 1706716835-6298 X-HE-Meta: U2FsdGVkX1/RHxfYG8CDuKxRsCay0wsJ9xx8PHIuii5YbuVZRAJhGnhFpFQQNNdo6JGvQOczetTRd6NJSm4KgswMHN6nyYPhizhVikPc/iDU5RldPT+SqFqRtgjURLium1+HhLRNhdZVnfl4Too50/NrZMPXn3SuPWIJ1g34gkz7AWQIR53BJgK/S01Dg1uuJT7PtFmK7GXfwzCNZcMzUML99wch3l5mTlaFjtGImjq/W7YU9Ino9abhmfzXr+M01z4RYYL56nleZ+0qHshcCPEC2mmHw3JezsXwq3tBv71i8i8atQQibsX8N+v3fpYCq0PYyyVF+0Nw+DabrF8Uaf/JlkvHbbO967dDLXdmHW2A2gK5tgG/fVO2NhDZJExknAJzZX4ievW+FgQxnHrPYzA5fyGtRHGyYCVV7nLjIYYQRRC4chZYnpcjJ88XXCahTcbsW4BfoxZmYO91qN/S7Ezjmsivg7qdOWT0b7mhPJ9LEEkgckTqQBbt8/8nalZUU9x09pdTV8JujTbZoJjkMA7Wh1DoV+74ufflgA2PFoKQA3vd9bd9Qcy9cTq5gTUVsLU1jf1rmYyJa5nT67qxyvnaYWmzUb+dyi8OL4jc/LYksHt7T9xbd7xu/pjlrhMgsYDm9M89TURznT0qHLJQrl+1MoZESKeAxHrhRjfmqDFNuvrqVP5DXTeau5L7hGQ1C/HJs47wJVF3XwuJrSi21ZB7n5NgH6RNyal7EqY4EFk4fwQlDr93lJBiAyfUHtm7u7VVUP2tlJVAl9DXwQX5N1mYOcWF7VwP3wvdGI2hoRu4Id+2rx0O5PSCUqBpvpfj+iT109wTpPtyoeO1QlDISIfMzpt7WGmngv+5eE8dTTfAypiTJYWufY3eAKVb1NqmBbDyVC97ZzqKbhSOveu8RAtjr7iF1nVisUAYLEwLm3dzfMLDM27416xhHq7Rg0vF3prgzgSJpnE23FtnG3r yIuTfK5Z iGW4x9KeWsNvhlAjAViCoWFHdAiWICW77+UNxiPUW15dfpxd5dAokvKkGyHIlDdXgS7ECrCiZlbFMcZ2AraTeC3L9cG/cO0HHQo5ykQ/VBgG+//uopWRXZCaarY79JEyx/U5CAjdq+Axr/fbLa3UP3CCzVu+/5q0H/yXm7UVGqYc4LMwrNdzPHOPtakHZiNmKOwwEqo4Wt1OD/BEo94hquaY/12sdHw2J4aijsPOCy2gPHQdME9nVIUa9C0pkbymIZCVuTrYTEWfH37wUW8UrN+2/qh8TOM+Sd34kUVL08KYbLuqUfxLXoKlMbFyq1P43V+lSHDdsTF6uoZCe8UeB6+Qi3c/PgFJXoV+Rh4a6iq9AtwvjYTbg5vPXrwv5m4l7K7urK5b4q7FE5T9ug3503MdcvHNYGod4+4W5+Hndb7DumdblgMAqXfTuq6O+xZNKXHey X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add support to parse the Svvptc string in the riscv,isa string. Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/kernel/cpufeature.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/riscv/include/asm/hwcap.h b/arch/riscv/include/asm/hwcap.h index 5340f818746b..2e15192135fb 100644 --- a/arch/riscv/include/asm/hwcap.h +++ b/arch/riscv/include/asm/hwcap.h @@ -80,6 +80,7 @@ #define RISCV_ISA_EXT_ZFA 71 #define RISCV_ISA_EXT_ZTSO 72 #define RISCV_ISA_EXT_ZACAS 73 +#define RISCV_ISA_EXT_SVVPTC 74 #define RISCV_ISA_EXT_MAX 128 #define RISCV_ISA_EXT_INVALID U32_MAX diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index 89920f84d0a3..4a8f14bfa0f2 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -307,6 +307,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { __RISCV_ISA_EXT_DATA(svinval, RISCV_ISA_EXT_SVINVAL), __RISCV_ISA_EXT_DATA(svnapot, RISCV_ISA_EXT_SVNAPOT), __RISCV_ISA_EXT_DATA(svpbmt, RISCV_ISA_EXT_SVPBMT), + __RISCV_ISA_EXT_DATA(svvptc, RISCV_ISA_EXT_SVVPTC), }; const size_t riscv_isa_ext_count = ARRAY_SIZE(riscv_isa_ext); From patchwork Wed Jan 31 15:59:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13539571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDC70C47258 for ; Wed, 31 Jan 2024 16:01:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E4C66B0083; Wed, 31 Jan 2024 11:01:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 76C336B008C; Wed, 31 Jan 2024 11:01:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BEEA6B0092; Wed, 31 Jan 2024 11:01:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4558E6B0083 for ; Wed, 31 Jan 2024 11:01:39 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0BAF5C081C for ; Wed, 31 Jan 2024 16:01:39 +0000 (UTC) X-FDA: 81740071518.09.7C78D0F Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by imf16.hostedemail.com (Postfix) with ESMTP id 0F6FF180014 for ; Wed, 31 Jan 2024 16:01:36 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=oa3kN8O7; spf=pass (imf16.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706716897; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=I7GGjOTfTMBIIqyaAo6ALuSMS6zgfYAZi7fWs6gtAQ0=; b=il2mBucYsHXzSoMBr0kXjOg8BxqyaomTMg9SO2Nn36vS8ZPx1Y6YakgNlaYwOGDP2MHwiR LdTykPECqRQDsx9I4apERCEBEUm00+xvkBA8NNaEA1wKCgOa68/gTKFOQm0iQHAqnriedP wRWvH2RseKJgJk389Di8u8ZaUS0Svsc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706716897; a=rsa-sha256; cv=none; b=QprmzF/vGWQjYSiL2mzU6EEi0bN6LNBJFt+/faPucUFGGw6qC8pZujsHjjwLd5RpAAxY/z ZdIUr6bc2/KMtyTRNN07daumcNSjFRNSfcjHKQ41mi9vT+BMPgSbP8qUEKz9KUzwKCswYQ CYdSWzD5JWPpIr89LrFlifUKfD4m99U= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=oa3kN8O7; spf=pass (imf16.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.128.42 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40fafced20aso13642515e9.0 for ; Wed, 31 Jan 2024 08:01:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706716895; x=1707321695; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I7GGjOTfTMBIIqyaAo6ALuSMS6zgfYAZi7fWs6gtAQ0=; b=oa3kN8O7e5TzTQkXCnvn3EgmKswSVVJdLsIRSypT0XFlFk/T0cLCG/PX2F+nRY2cWY t66I4LrEi2i8rVPUusbKzNEvyjHSDj4kCMiPgEU8NRsa1xGSp13bQ7oDlG4tUNb7/lOZ h0lll7pt+i9zV6wxxAV98FLXX0ZwL230n0kvGEzQnlDX2sNKnigxwPE69OJOIZNRGQb/ zSVoFlqkdjCjOquryo1wHR5oq8nbBE6wTvUWIaffIhu05Ka6shnoQP/q5JnfIx742BXN 1Z4dpU1/6J5YK74nx8638w30nlZBhO2ntRFGRQW2OgvNrnHfx5VA/qqnhVvaJc7q2VR9 lliw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706716895; x=1707321695; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I7GGjOTfTMBIIqyaAo6ALuSMS6zgfYAZi7fWs6gtAQ0=; b=IL3A40o3SYp1UkWL8V29lJwI5ZcQ3wlMOqbEyXAqtEBD1LLuS3fqE/IF+YSZAsR/dr 4Sh5UUf6BCNDuHamWbONaEyefGMNFtiJ0saCXYcxaaTqWtJY2JZuLYOLS26jmdOt/5Ch OScHnpTuS2lHMDySSXUby3HeGpZ/fD5TwQxlrfmG/X2vpS+jLOLDS+bpaaGPkiSRl6CI EvRiYvGjGIrAFIv8HfMRsoJgtP+kLA5gLc9uJzYE4PHRJAB/3pcR4sfeN6tVcJPZcAKO kBlv7qc0eH39jWuEBafQnx3mypyh09/cNyNIWhcjr+5gVN8poKNYJcns9mn4O7iH63PF KcRQ== X-Gm-Message-State: AOJu0YxYRAlM8ulO+pZRVkwSJOdiK3+ep2hgUdBeA9urqGsCAmiHSSlS 87eU1IR6Wfa+FRO5KTQhXtU+EuPTiFPV0bgAb1RoujhFbnZOohsex8MT79TDc7Y= X-Google-Smtp-Source: AGHT+IF78D/rn/QqKCF1O6AsFwlI/Sm4elG4q8phM412N9lSIrsSbe1rAE7TOm+63SArxDbMqaKiww== X-Received: by 2002:adf:e292:0:b0:33a:d2d4:959 with SMTP id v18-20020adfe292000000b0033ad2d40959mr1290673wri.11.1706716895453; Wed, 31 Jan 2024 08:01:35 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUMmlfGb5QJrtWjQ3hwdRXHqr6tBQk0FIxMX0uA5P+4YYcbUZ8kMED0+5zSvPxp9Se7FDafq1n/DY934cDYAzBUsuJC61YJexveBQSJLg7aTm75drBWzhDXDpPnE0l7gnKGYL+NZ08V3zM9OcyZg18MIDPvkaVKY3n553LA+zl3U+PBNVZSqQ4OJFYlAd+XQCVFsqmjAvgAu94sEw9sEJBxzDIGrAwSiwP+rLI1AOEFoHCQko0EZIEwQuqgCuHpX6cP/EEYYWnOvDzGKbvNABXq1TpX3vYsnWd8cF2ONfdDW14WDtXiy37WLvtJt38NeCjgTKUFonqMDLWTEEk037t8rkyOgpIafa1COSx7MktRFXJuHq14e0rmtyCCAh2qsI+eJWk8yrEnwRA062YhoPJHPcwhqxqj4YGj8RGlqwf7fyXJbj6WVuGvHK7yb1D/+NGovyndWxjJOD2rhLLW/XWaX+s9UrHLCyvZef4E7hM2FoJhLzSFkuJKEvG/jCTxRNoVuv8MXActoVinBxYpoKfqtvQbEYibDAr9IFUTB7YggocoqH5QJHoXjU3mTpGGZyZnZP5qvj2lgg1N6C6BHU/XSetdZiGav2/UV2L5p7b7QF4caHnszz4xB08lDGxMWBuhhqpKVsqMtaPPUA== Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id c17-20020a5d5291000000b0033ae4ba8ca0sm11407009wrv.82.2024.01.31.08.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:01:34 -0800 (PST) From: Alexandre Ghiti To: 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 Cc: Alexandre Ghiti Subject: [PATCH RFC/RFT v2 2/4] dt-bindings: riscv: Add Svvptc ISA extension description Date: Wed, 31 Jan 2024 16:59:27 +0100 Message-Id: <20240131155929.169961-3-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131155929.169961-1-alexghiti@rivosinc.com> References: <20240131155929.169961-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0F6FF180014 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: y3t3qfq6g6kgbt4338oyqbxm8qqiu6b6 X-HE-Tag: 1706716896-700156 X-HE-Meta: U2FsdGVkX19vRJz4mh2EWmpoah+ZrExA/3jfvgZOoWoM8pFEivGvWqG15Xy8HqZBw5HFacBVLXcNUazwnbMyT6QW02MPUt+4lgIz8yoPTuvN6TpyV/oTI3o7Cx8ffqxYs1RYZ4MdGjozLFIgysEGIJcWv1OyK2T9ef8JeLO8Z5TZ4K/WFzXuVmHNlZC9aM+D4yy3IUO32sxVwkxrwHL7eXYXtDMZtML3SOtFGc4rW3j0kOHAMmM86XTpcWMg2ZhP0UB64vnTgADtFNagD/ul7QJqQWcPUw6PzvZJEebkwaUejDvF6ByuXr8gf1+lYwI+Yg6d5HpPwnam1GZh6ZwU5QgmDMioMV09han/Bz7gHp7NcG2lkhloLNaw4jM+qqevV2h9MhBGAdZuP7OIQ+qlqC29mWR8zArB35LHK653AkZLqKEFGo0WlcYKUd6Ngxg7WWXRuVI8HtIf3T2Vp60NA59e5jCTuWvwmUe26iIAz88e8eciBQtZMQL5Lfq+A57CK2KdQDVzX+v+KxfPOo5hyIRZAdWiorZ2hKokYKZH061M/Zq0Tr4IiKCXEhPvPE4k9/vgetbfYdod7ekqTjCEfc0qBQclenfGn4a6NPo7ZpeBDL9Q9L5hA8NTt1l+wGHhXgPTH++mfNmkK1CxnFOAeQqlbuS0tTWDQVdnQEgIlT39HTVJkLTTidV+YnJeWNI8mpABrztZj2cq3ZPipGzTf+ZnlYqsFhBjuK4DkyzoYAL7J4K4bj27clGkGXbySlZtn78aV8IiqLjuuWLHTe/2aopWyYyZm8poeH/CxaiNUy6u4xWCkvbrqt1C+o6k/6ReV1LmO00FS/GEooCf8e7/OISERz7E8d7ZyW8i5wfaVPevlm0NUAbb3UOWGH4eqbCbTcM7UAezg361tn+AYxZhqdyQZcIvvqNe+m9SsBmXDoB6zRBPv7ooIy1ZoOSiuGJdUuprSPP+MYwnNuEfWD4 4cb5iGXs x+gzHGUGOJ5j+bvCpwgxHj7QfcrLohkJQHHpFOT3uV7DOQvonAw4KJt79Ip9LJMaGBgmLQkGoSSypCJhxukvaPq95h03N0b/iMmEzp9/b8kHURVRZpsLkIDUOXUfNHTGWV8TfExVlBnaPQC5ISfTgLRNPDqzDUPgY+07LF7cDuwF8HJ/yGkulN/dxeTAu+EXrXBOWtMI5rrcOnsqDPlf4SJ0+sPgepKCBKteiqWOjkoHzQgeqLunKQV+N5pFqqDvCdVthGRy1LIIHsbm1P1AO2Vk1DFpt433BwNFK5xiqO4L+ODtRqqTMC390Lk4wphdD0+XW9ssv+hOdmpAlos7Zt/miCM/QHI3erMe/Wk0VErEpEo3E1j7tPzE+O3VAO+xhT8P1ntq2YvPIE4xwqJ6saS1nD5z7oWuJj28wqMbnNFrj33WFDQDcerjx06Mm7E/LTgPS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add description for the Svvptc ISA extension which was ratified recently. Signed-off-by: Alexandre Ghiti --- Documentation/devicetree/bindings/riscv/extensions.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/riscv/extensions.yaml b/Documentation/devicetree/bindings/riscv/extensions.yaml index 63d81dc895e5..59bf14d2c1eb 100644 --- a/Documentation/devicetree/bindings/riscv/extensions.yaml +++ b/Documentation/devicetree/bindings/riscv/extensions.yaml @@ -171,6 +171,13 @@ properties: memory types as ratified in the 20191213 version of the privileged ISA specification. + - const: svvptc + description: + The standard Svvptc supervisor-level extension for + address-translation cache behaviour with respect to invalid entries + as ratified in the XXXXXXXX version of the privileged ISA + specification. + - const: zacas description: | The Zacas extension for Atomic Compare-and-Swap (CAS) instructions From patchwork Wed Jan 31 15:59:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13539572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38A85C47DB3 for ; Wed, 31 Jan 2024 16:02:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C28408D0002; Wed, 31 Jan 2024 11:02:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD8A08D0001; Wed, 31 Jan 2024 11:02:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2BCD8D0002; Wed, 31 Jan 2024 11:02:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 910928D0001 for ; Wed, 31 Jan 2024 11:02:42 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9A27880D7D for ; Wed, 31 Jan 2024 16:02:41 +0000 (UTC) X-FDA: 81740074122.20.B362633 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by imf05.hostedemail.com (Postfix) with ESMTP id 3C572100024 for ; Wed, 31 Jan 2024 16:02:38 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=mijrQcL0; spf=pass (imf05.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706716959; a=rsa-sha256; cv=none; b=oQXTxVVJTV59Qnykw2XYEPYaSaJnQZQWZTYN1TiFGs9ICWSb5CCWuoqPb/xlUXJaGu5paz tBViogAd7qqhSKynTGVk1ALPBE2v7o9Oquqhu7ayDb9FcMGNvLJsSpSrImr51H8d9pR6jn o8yW5q2Rhg+Ys8QSrCH90b/6gWudXt0= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=mijrQcL0; spf=pass (imf05.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706716959; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=roEDJI/JlVTVXh0TwtWic11MC5sMgNCSBaun+agzxOw=; b=DKCUbvDC6qJGdj3fe6jZ+LAR/sjyrnYkhg6ZqiI2Nz4lXifrRcGFqt7qxWryA2Xk3lWBQQ 69VmTZ7kgWWpePFOv6kqQCoLEmigQVoTw8MI3cbTmS2glbaBIM8kwPq4+t3X8Sgms82ZKq xdkzGNLmVLQ55Hjm2NinqCmP60nZOSo= Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a30e445602cso238115366b.0 for ; Wed, 31 Jan 2024 08:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706716957; x=1707321757; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=roEDJI/JlVTVXh0TwtWic11MC5sMgNCSBaun+agzxOw=; b=mijrQcL0lyKxl9qgRZWXDuKwp/5KgTQOdhco+DPekhfe2DzOy7aUByC/wZnaKgps8x bKecdQlhY5ZpaMToZhfnEbiWYc2rE0fjQuGRFHbLJqwCgOItCR8eW73UfkcXyemzGLyB za4lyPjkQdl9ixTXNJjhVFIgZJbuGLm4QtFHxKXFuyRrpx7f2NIXh5mze+X6DPkWaQeH OJpCGEVqRIMSZx05/LiZeMAf/+SOl8NvlvCJT6o0bmLYN81KLHBx7vgTn4q/RBgRKNvO SaLwB63lddVVdud6MT3c0+mQ8KlrSvHN6ouuUwgnXhSggs3KwD7afjTJ2tVHKMhW1Z+j ws8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706716957; x=1707321757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=roEDJI/JlVTVXh0TwtWic11MC5sMgNCSBaun+agzxOw=; b=c0Jd2bNUNFpqbEmQSmfm2cyYnWAHEx/jCFDnp8BmlOW05GO5k2foggfTfGOAUD+otl I+7f25aiwChkY8cBKEN7cTySzSMHPy2QLijO3un9za7FO6iE9wScq6XIRey9JB4WdrUm iGairVTHZh2VNlfjzzCTaSA9pPxJitykh14GD8LNim1Urs2udPRPC2pT8pqMg3uwltav bzXFWOCn4g3cc5Uhjh2gCjt+/XOHjZjU8xuEf0Cf1NbyMJZj8dpVcdhSucYFuXI8XnGk krbR7Y1pR7sreKBWoUkgm1JrP6sIJj/h+2mqqnC3X9aWM8tJHs97rlYtKbVzTdfL8fvH KdvA== X-Gm-Message-State: AOJu0YwzZiDRjecDYeZKcUEW12cVDwmCTsSBUUYLIpcacpTERwnKiULx Pe3Mpz95T8hi2dETOR3G8pmwaNGE401QB0KS9IrTMe/KsmZhWPAAGet3US2hCvI= X-Google-Smtp-Source: AGHT+IGv2jgdsIvvr3em1Asod7wMzF0cwySX89l1VDTNJRgzTu/LSzdp9sUvQ6blXvUGsP80SoaKkg== X-Received: by 2002:a17:907:a642:b0:a33:8fed:b9d5 with SMTP id vu2-20020a170907a64200b00a338fedb9d5mr4201411ejc.3.1706716957070; Wed, 31 Jan 2024 08:02:37 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXfm71N3T9h/F/CiQJuplDKsyuZZyOxCnpmTyjV18wHTQsMSdQnNkDDdJ4IMI8MOZMMdnUoibCHWjlKo3QMlFwAcKN2+h/dhl9NOsGzXN1JsWeY0jSAXt6kygdx5jmO3bK8iZoFHuM2PCTSYsG7ZfsOCsijcVgRagvcQVE7W3iHU8yMR10JnIGM7RSSzqhflRVpTacDW+JT62844/5FGpifmIx9ZrJrM32TGTe40Mjtw8mBvhFaS6bJSQuAKlFrcU4DEPoIWsMIUm9fjVLrTF8RvqX/J91AqrinE9UD4tO4ISOhc5MQDo4RKGEVsopkso7aPjriJ0cD9+Fss4m7V8IDYYZMnwGS9GvlGIDV9Lpae7a5DoYsVx56yheDZ7eUUC3WsLxo3l24ZoumYteEnZZiZMbL+5fvvxzGV7neS1WG53zX6tmFIdvnLEkuWqR6qDg47MOvifLiRGbtfsAarzJgey4UMkS9f6zlL5NDt6UJmERiwr0V+mC8T+2+z3IXDIyygRYyz24aCKxBXWJVx+XxUH3fJWDXb0YlsqC+SlGK4xdQccCUJyTO8t+9ksDUDrwdR5XNwyKgcWRZY7NyfNHedMNeXUVCCVKsxJI5vH9PqtlKzjTXdPyWbekeU+53OewZjRnfybXkDRYbEg== Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id vh8-20020a170907d38800b00a3040040011sm180335ejc.45.2024.01.31.08.02.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:02:36 -0800 (PST) From: Alexandre Ghiti To: 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 Cc: Alexandre Ghiti Subject: [PATCH RFC/RFT v2 3/4] riscv: Stop emitting preventive sfence.vma for new vmalloc mappings Date: Wed, 31 Jan 2024 16:59:28 +0100 Message-Id: <20240131155929.169961-4-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131155929.169961-1-alexghiti@rivosinc.com> References: <20240131155929.169961-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 3C572100024 X-Stat-Signature: 9zhofx38h5mdfstkmq4xnnw3ngtfc8ij X-Rspam-User: X-HE-Tag: 1706716958-757951 X-HE-Meta: U2FsdGVkX19qfE3AMDEnOkCNec2XlpNpcW4f/ahOSevURr95sdZtvTRy9yx5C8l84l0Hqp4jsMhJu+iB9EPDyOEVE6QHMHw3wuLpQxTNFlzaNgFEb/HObm2WLP28w/iIEO7rQRXfm9lDHKXaeJeIRsxm+wk0HgAKXo8B3721CP0rnFWQ6ZM9gj/gEPlmINKRrnk79J8bMD0tS9WOLSRbBFHDjZIC7TX8Yb7H0qUzFvwihRpCzCf48Ys/PRbGA+VqZcTZoEg7ZcROFld42cP4RuWY7rSQQyhwc2jB0bLhbwBkUJXI+F63OvVDPuVJJKmIgLkNFSDJZXZfbsQTUtK35+3Trimn1meWkT0G69g+1LqEIyBb5YAGcuhUj6wvYVIdyCJvXFWK8BiFuPc8B7pGmfflZtb2ZGp99AN5CWRoLUap2lkE8rO6wlqlP9CoiPfVFxgQUb267u1xgf4vWSqhmQPAYfCKfo8BZ9GjUdPz633HpdmY7XukTHQ7G0z1C7a87fpc6OegCTaneC7L/oZEiKPhIV413Tbt8xf1cQdCdR9OyJfFn8vqSjCo5ca0PC7bz0bcfSDoiY3Fv1ZxgzCRzTV3Mm7ZiCvGxL8oD4Ql69vMMLGI6sY1SDbjaQJNvuCGDxtd4hSJh6G9BBGlBZjlWXhJDK2OujfPXdiL4f62lGWvAgQqHX9liDx3Woez+nexnRsxcSCdcfa9bEqONKNAFDOlxxCzPLkRDA9VJe5gdwBmB2C4CJLLC60c3Ld7CYj9yeJck8Qp7jR8ttDH3HZHSpkZL6X+bla8UFXZN2a8hLA9MFFlK+2kHbUNzgJ5oUIZyRAsOEsAVbi6wXxiUvOzx1JP+SuKXMbKNucVOHTI3msmNmbzq8d4t/dS4M63/KWTvW/YIrO8rw3xvP7YOalUeTWz6PC1IHl0KKmRJnUUvo1av6wMB5w1Dhd1E5sFq0lkEnawqzG6Y5eJVGAoSqu rCWx32mW /XDx2IZRbgDr7qUCTw2CX1dUhEGhV7g4c4+S79OnEbJ+2Gyh1tV6ODNU4Uoxge+GYtGqjdBBiTOqGMKK2JrhxCReU4Z2rpMgtag65SF4kw3GRc0IYbXofqlZ0x7rjsP8Ths2y/gSe2dpqwd2WqPpPP3YOa6I2vzei+NpEMKGAfpJ9Z/CIX2JBqjIWUsPbtPhHxSR55AmPHbBdiaApDtiK2IqqAPvutFKXvHUaN06UNaESAKonq4e3JmF7GylKzHwpGXaKGqv1fllgw2pBd6wZfIqae5Z2jn1JE4ZXB/7CeFeY235jkjm4HvjD5vtTx32W5u3NclgdZzl9IjwQhEg9NW1S5k2Kid7UH1c90YfYLTOOFuRMkepl6+ZpkF636iVmsURg6ruiRFeL3xCqDtZ9fxQ69zBG2Eyq/eGwTH0t9+Or+jNNCOqRRzYf7hQdYDTTXuDGa90cVIcYglmCsSG4d49DHLbvsaZbnkuV1Azc9hicfVEU/lZBfjMf41Lrt7WOpGtHSMvKZhRfwtJieWNM4Q1tvlKK8s19mXaNXpg0C+kUijPA0XcqzbZgxLKjWQYkargVOHDJk2oH4UY3Ibo85wDEPbqdq+rEKzZZna2YhLhRwxFsNPHblEWYYQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: In 6.5, we removed the vmalloc fault path because that can't work (see [1] [2]). Then in order to make sure that new page table entries were seen by the page table walker, we had to preventively emit a sfence.vma on all harts [3] but this solution is very costly since it relies on IPI. And even there, we could end up in a loop of vmalloc faults if a vmalloc allocation is done in the IPI path (for example if it is traced, see [4]), which could result in a kernel stack overflow. Those preventive sfence.vma needed to be emitted because: - if the uarch caches invalid entries, the new mapping may not be observed by the page table walker and an invalidation may be needed. - if the uarch does not cache invalid entries, a reordered access could "miss" the new mapping and traps: in that case, we would actually only need to retry the access, no sfence.vma is required. So this patch removes those preventive sfence.vma and actually handles the possible (and unlikely) exceptions. And since the kernel stacks mappings lie in the vmalloc area, this handling must be done very early when the trap is taken, at the very beginning of handle_exception: this also rules out the vmalloc allocations in the fault path. Link: https://lore.kernel.org/linux-riscv/20230531093817.665799-1-bjorn@kernel.org/ [1] Link: https://lore.kernel.org/linux-riscv/20230801090927.2018653-1-dylan@andestech.com [2] Link: https://lore.kernel.org/linux-riscv/20230725132246.817726-1-alexghiti@rivosinc.com/ [3] Link: https://lore.kernel.org/lkml/20200508144043.13893-1-joro@8bytes.org/ [4] Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/cacheflush.h | 18 +++++- arch/riscv/include/asm/thread_info.h | 5 ++ arch/riscv/kernel/asm-offsets.c | 5 ++ arch/riscv/kernel/entry.S | 84 ++++++++++++++++++++++++++++ arch/riscv/mm/init.c | 2 + 5 files changed, 113 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h index a129dac4521d..b0d631701757 100644 --- a/arch/riscv/include/asm/cacheflush.h +++ b/arch/riscv/include/asm/cacheflush.h @@ -37,7 +37,23 @@ static inline void flush_dcache_page(struct page *page) flush_icache_mm(vma->vm_mm, 0) #ifdef CONFIG_64BIT -#define flush_cache_vmap(start, end) flush_tlb_kernel_range(start, end) +extern u64 new_vmalloc[NR_CPUS / sizeof(u64) + 1]; +extern char _end[]; +#define flush_cache_vmap flush_cache_vmap +static inline void flush_cache_vmap(unsigned long start, unsigned long end) +{ + if (is_vmalloc_or_module_addr((void *)start)) { + int i; + + /* + * We don't care if concurrently a cpu resets this value since + * the only place this can happen is in handle_exception() where + * an sfence.vma is emitted. + */ + for (i = 0; i < ARRAY_SIZE(new_vmalloc); ++i) + new_vmalloc[i] = -1ULL; + } +} #define flush_cache_vmap_early(start, end) local_flush_tlb_kernel_range(start, end) #endif diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h index 5d473343634b..32631acdcdd4 100644 --- a/arch/riscv/include/asm/thread_info.h +++ b/arch/riscv/include/asm/thread_info.h @@ -60,6 +60,11 @@ struct thread_info { void *scs_base; void *scs_sp; #endif + /* + * Used in handle_exception() to save a0, a1 and a2 before knowing if we + * can access the kernel stack. + */ + unsigned long a0, a1, a2; }; #ifdef CONFIG_SHADOW_CALL_STACK diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c index a03129f40c46..939ddc0e3c6e 100644 --- a/arch/riscv/kernel/asm-offsets.c +++ b/arch/riscv/kernel/asm-offsets.c @@ -35,6 +35,8 @@ void asm_offsets(void) OFFSET(TASK_THREAD_S9, task_struct, thread.s[9]); OFFSET(TASK_THREAD_S10, task_struct, thread.s[10]); OFFSET(TASK_THREAD_S11, task_struct, thread.s[11]); + + OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); @@ -42,6 +44,9 @@ void asm_offsets(void) #ifdef CONFIG_SHADOW_CALL_STACK OFFSET(TASK_TI_SCS_SP, task_struct, thread_info.scs_sp); #endif + OFFSET(TASK_TI_A0, task_struct, thread_info.a0); + OFFSET(TASK_TI_A1, task_struct, thread_info.a1); + OFFSET(TASK_TI_A2, task_struct, thread_info.a2); OFFSET(TASK_TI_CPU_NUM, task_struct, thread_info.cpu); OFFSET(TASK_THREAD_F0, task_struct, thread.fstate.f[0]); diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index 9d1a305d5508..c1ffaeaba7aa 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S @@ -19,6 +19,78 @@ .section .irqentry.text, "ax" +.macro new_vmalloc_check + REG_S a0, TASK_TI_A0(tp) + REG_S a1, TASK_TI_A1(tp) + REG_S a2, TASK_TI_A2(tp) + + csrr a0, CSR_CAUSE + /* Exclude IRQs */ + blt a0, zero, _new_vmalloc_restore_context + /* Only check new_vmalloc if we are in page/protection fault */ + li a1, EXC_LOAD_PAGE_FAULT + beq a0, a1, _new_vmalloc_kernel_address + li a1, EXC_STORE_PAGE_FAULT + beq a0, a1, _new_vmalloc_kernel_address + li a1, EXC_INST_PAGE_FAULT + bne a0, a1, _new_vmalloc_restore_context + +_new_vmalloc_kernel_address: + /* Is it a kernel address? */ + csrr a0, CSR_TVAL + bge a0, zero, _new_vmalloc_restore_context + + /* Check if a new vmalloc mapping appeared that could explain the trap */ + + /* + * Computes: + * a0 = &new_vmalloc[BIT_WORD(cpu)] + * a1 = BIT_MASK(cpu) + */ + REG_L a2, TASK_TI_CPU(tp) + /* + * Compute the new_vmalloc element position: + * (cpu / 64) * 8 = (cpu >> 6) << 3 + */ + srli a1, a2, 6 + slli a1, a1, 3 + la a0, new_vmalloc + add a0, a0, a1 + /* + * Compute the bit position in the new_vmalloc element: + * bit_pos = cpu % 64 = cpu - (cpu / 64) * 64 = cpu - (cpu >> 6) << 6 + * = cpu - ((cpu >> 6) << 3) << 3 + */ + slli a1, a1, 3 + sub a1, a2, a1 + /* Compute the "get mask": 1 << bit_pos */ + li a2, 1 + sll a1, a2, a1 + + /* Check the value of new_vmalloc for this cpu */ + REG_L a2, 0(a0) + and a2, a2, a1 + beq a2, zero, _new_vmalloc_restore_context + + /* Atomically reset the current cpu bit in new_vmalloc */ + amoxor.w a0, a1, (a0) + + /* Only emit a sfence.vma if the uarch caches invalid entries */ + ALTERNATIVE("sfence.vma", "nop", 0, RISCV_ISA_EXT_SVVPTC, 1) + + REG_L a0, TASK_TI_A0(tp) + REG_L a1, TASK_TI_A1(tp) + REG_L a2, TASK_TI_A2(tp) + csrw CSR_SCRATCH, x0 + sret + +_new_vmalloc_restore_context: + REG_L a0, TASK_TI_A0(tp) + REG_L a1, TASK_TI_A1(tp) + REG_L a2, TASK_TI_A2(tp) +.endm + + SYM_CODE_START(handle_exception) /* * If coming from userspace, preserve the user thread pointer and load @@ -30,6 +102,18 @@ SYM_CODE_START(handle_exception) .Lrestore_kernel_tpsp: csrr tp, CSR_SCRATCH + + /* + * The RISC-V kernel does not eagerly emit a sfence.vma after each + * new vmalloc mapping, which may result in exceptions: + * - if the uarch caches invalid entries, the new mapping would not be + * observed by the page table walker and an invalidation is needed. + * - if the uarch does not cache invalid entries, a reordered access + * could "miss" the new mapping and traps: in that case, we only need + * to retry the access, no sfence.vma is required. + */ + new_vmalloc_check + REG_S sp, TASK_TI_KERNEL_SP(tp) #ifdef CONFIG_VMAP_STACK diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index eafc4c2200f2..54c9fdeda11e 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -36,6 +36,8 @@ #include "../kernel/head.h" +u64 new_vmalloc[NR_CPUS / sizeof(u64) + 1]; + struct kernel_mapping kernel_map __ro_after_init; EXPORT_SYMBOL(kernel_map); #ifdef CONFIG_XIP_KERNEL From patchwork Wed Jan 31 15:59:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 13539573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1FC5C47DB3 for ; Wed, 31 Jan 2024 16:03:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87FC48D0003; Wed, 31 Jan 2024 11:03:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 82F588D0001; Wed, 31 Jan 2024 11:03:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D0B38D0003; Wed, 31 Jan 2024 11:03:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5B0A18D0001 for ; Wed, 31 Jan 2024 11:03:42 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 25067140D6C for ; Wed, 31 Jan 2024 16:03:42 +0000 (UTC) X-FDA: 81740076684.06.B94B19C Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by imf25.hostedemail.com (Postfix) with ESMTP id C53F5A0003 for ; Wed, 31 Jan 2024 16:03:39 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=ASOQtlhq; dmarc=none; spf=pass (imf25.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706717019; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2G7N9HKTptzFvdsSy7a/wMEV20988NdsE2TTuou7VW4=; b=h1KONVrH4zuEhXMiB5Pk1bVI11I5Zyvp1MqSm74E8xiLXeORMWQpcYqF5yHTxVP2luOCOi n8zlpZ7Z8mAhI57xhfdVksWg/AeU+k4PoaYorkT9IiVrDJBSPKpFG0cKgjpvpB4avqhuRS rDoBegj4odqIfPQPuylN7AsEG7YK9Nw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=ASOQtlhq; dmarc=none; spf=pass (imf25.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706717019; a=rsa-sha256; cv=none; b=xaCrezZxQzXmwo4da9VeBn4ipD6ObN56wlAc/JGH/N5kU4rG8r3leQ/whzaE1OXUXFySZB eGK3fn+zpUG9Svc8ID1jV0Txe/StyEiXtbuKcDxtT0Z7XbO5RFxlhdSdp4NQJZZ6+pn5G2 vbA8TaHrol+EV+j+OAQVAM8TpnrmjNk= Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-33929364bdaso3555030f8f.2 for ; Wed, 31 Jan 2024 08:03:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706717018; x=1707321818; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2G7N9HKTptzFvdsSy7a/wMEV20988NdsE2TTuou7VW4=; b=ASOQtlhq78MgahqqlLLYbXJiNOfrc5yZNkYVUv7cWY+GHsM4p+TDFIQziy3wEN9yqK IrU7Vs1BbXPpVnFavZJqGHdx1VmhS7cN5xK/kNWtAflhWzo3Xh/8niqhjNdQy7zdc2ks zfi1ckKfrb4lwSWSFKxde8Yg0AuftV6PbknmkgjDhUHSTTgz/7eBFk/r/dU3oiYeMj4j FvjuWJRYfXoPNCmMqxFJx6hJF4BNGHc7lzk8VRBmxZzW6x2Qvp5TmWyDt8nMfbXt3Kxj Ct83WanCGyt+nxMvyPc5f6m7EexnLkMzqBUzR6T2iOXaC4Z+8PefMvUq+UpYn+LONhSk nK2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706717018; x=1707321818; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2G7N9HKTptzFvdsSy7a/wMEV20988NdsE2TTuou7VW4=; b=DjcAfcWUF7pUOUWGX9ghUv3e3Ohrgc5yvkDlbLlOg2vwp3qqCL1gnAWTBxRxEotKUX /XXAsghAnFikAVpfygx/vBIVfSUEBHUl+P389tUS20p3LpXg7b9xbA8+3INUploKztJ7 a7YdGXeRHE8NUNvhyXlCFmlYAewM1yVOr+p1qIjUqig5NCGetJVIVSM3eQbg9fbPW8m8 2oCfTZ8v2dl30Kty+jp12yausxd0wWDOdEFKQEi6jevO1GCeeUkeuFEfEVJogHDewVUK ERPU8aPH6l5SeuhvahrtFqowTB7fjYe6bKF6nrvtLQUOEM4kz5R73giV0U78ZpWFZGMA yzww== X-Gm-Message-State: AOJu0YznbtriXOuxmgmdnx1Hg1mYoq/CAfueyXPlgYg6NNDi3Ekoj7r5 1xP9PbZISAFHTi9nKUxizYYpm/ncWe8591EBdCiMxmbG65RtxOlyX3IMT2/uzLo= X-Google-Smtp-Source: AGHT+IFv4RsKrg6kAntnJ/YCtPGAW1U1YNeeMXiuO/lnsK9Rn1OpwCBxYmcNw94F8PYwyQot8cihag== X-Received: by 2002:a5d:4448:0:b0:33a:e6cf:f564 with SMTP id x8-20020a5d4448000000b0033ae6cff564mr1365333wrr.28.1706717018193; Wed, 31 Jan 2024 08:03:38 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVg1J2yUOavmT1BH4y5nxg3fStQ3N4AW690uC+KVjknvwF1ll2sBXJWTCViTvOYReZkrcvAcX1OMeyRFhnXqudjaBZl/gg5Slh2qMDSCgRbs+MYgkxfwyGouM0xHRs0tgxJCpxbNgoQm1h/C/3NBDpOmt8gVIsv7E96n1TY5vhD8PUSLr9R0dCCkfWeCCPx063FNEcg1j2K+XyPJxLVqJsMLPBwMAa2yiLVZ3yCyGFm+j7Fzm78VPLhSet9sBLkuF7EhUO0JSNmhAm08ItvQD/eyizM4UaWgLJ5IfIEvoIxGnSv1g+/L7u5k1OSXo4eUZCK3WtIs5nc2sntY+iTJ0XM7Sw1HGmFv+717YWEYjUgFkTaZDBVXQ8szzSSQSMga7N2cvCO6sZEEmIdJ3WrbxjU7MsY+3d8+XL7ukOMZvPAA8ULHgKtMBLME0qs6pvJjiy+Ahi0q6IN7XN+z8czcuyGvvHVD505pmNGMbMOVBEgXzcDvj6KG+dXMI7+j2KsumizhlmmeCeIGlGoXRxI8cSqcGpx+z3xdHoptsF2bc/C5MXJ+q72d+EHk9Pq97YjxLi0+gDc1EX/D+NmdurxTc5o3aAmGs8bweDvIDgr9lY+Cqq7S0y8tugvFuJReOmvvT386mI9I7qqIrf8NA== Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id bu16-20020a056000079000b0033b0797cc14sm1358024wrb.51.2024.01.31.08.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 08:03:37 -0800 (PST) From: Alexandre Ghiti To: 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 Cc: Alexandre Ghiti Subject: [PATCH RFC/RFT v2 4/4] riscv: Stop emitting preventive sfence.vma for new userspace mappings with Svvptc Date: Wed, 31 Jan 2024 16:59:29 +0100 Message-Id: <20240131155929.169961-5-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240131155929.169961-1-alexghiti@rivosinc.com> References: <20240131155929.169961-1-alexghiti@rivosinc.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C53F5A0003 X-Stat-Signature: h5qsisqm8bhp8dqr3dt189acoo57io15 X-HE-Tag: 1706717019-56161 X-HE-Meta: U2FsdGVkX19vq+D38tcw3K4pvFbhE8A0/pEPs5fRAWjOri9ww3EYaOHczdggfHl1ieftPC7c49hH1oPQkI0Er2YyZMS00J7ccjBO8x9j16Y4y7X/ABkXu1RJD+5pxSe6QkrdsSZP1RHyTYlCSAnGwh3YTp+hRn51S48sojXa/FtfV9enhOmLPxyOqQezjzP07rVEJeKyMNzk1F8fdfrOYP+SqEcmdJ45liFdLYNy25x35I7bKe+3L/xD7p3IieK4f+YE+hPWGNYKtHLeSZNsewvO0Pg0w/MWwxmNB0q9dr05OFbrnEDe9T3c7lqpNT96Q3FpI3WznBfsqOACaOUep1BIPOJRiV277p8VMcngBq4aVn2mswJBOdKkQvCG4Vny7G08zJXyEoLhvoI8wN1QAHKrf8HHMHt6VIsF7ziyz/xYzYN43zlj04hPyMDEZuDa7RD6yu0nIvGyGTLGBXZLd13G36AYjyoS0mnxRsAMV/Jkd/Y/WyJb95IpKTaiXvJUagZMYl8zXIIblcKXRJal/uRHBICceHajtbsmI2RJt3Nc4R1dQjyOlbrABcyPUSxc6mWXkiQGUbGduHschifo2fAPFJVxviL1x88BLW+T32diDW592OV344pVhsoL9yCMbB4Oet/pRPcsW2/GrQkQkQfW0sbinDxl/Mk6a3yOYSV3Twx/TAbQQ9N3AQdnegdPDiXXj1dfWIRBMfsxikHIPOVQGLm77mYGPe4lVAlQzLofGYChbLh4yvUTKeqO6wtB4Sc2ge28E+h6mT+UQQUqXDKD07xUgT7HsVdpHrw2+NB8gxqXi4eL8Asll9RfIvsayiCVw8Z/rdCcQrhhmi+w3EkyTd5iRPgB/UUAKk1mcvCqLUw9siQNieLtbQHNuCqEt8bc/mIr1FAgTWmi2bNYlOAkXnODZ0rWsVM/psrrAkc/wrWm6xFcQPOmaobXg8pNTmrEddp40j6h3oO7vu/ xr35wPI8 Yn7p0DXbNK7zzBQGOJw0UvElazbK4/i0s9WrGnn8h1wffaJE9WTLQcnjxvxl2E2py2arCGU9Tl25gySg1gbJsKzHS6UN1mElqxoBfGDu7gt9xPj4tqbWTbjCQV8aalD8HzFuMpHhTkVZlnS9Ujjfc+QmhfavcWVBxBkO9tBDYOBkGFylEMsNYLDzdThjbTl8/1Sckx+eCKUuN/HmvHaLitAQai0IaIrdjoks0GiXj+DLoheay/oLn3VEVgCYF4Z4FhZnIlcm9/aVZTxAe//FuTjMfgL4EnejyfQMeTXep1y40xivQEa056hkqdin5X0XLo8QO2pfF0LiPTHdA1j2yLcSVofhZ5IuSLUuNIshMb3uiS84o8VaBewoP5fgprSsksVKihyjmLKJ1wG8QFpE5zRRKurZqXiS1sPkXIwZskjMo+Tm9acgUTLO/mCjLS/p1avId X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The preventive sfence.vma were emitted because new mappings must be made 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. 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 (!) Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/pgtable.h | 16 +++++++++++++++- arch/riscv/mm/pgtable.c | 13 +++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 0c94260b5d0c..50986e4c4601 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -473,6 +473,9 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma, unsigned long address, pte_t *ptep, unsigned int nr) { + asm_volatile_goto(ALTERNATIVE("nop", "j %l[svvptc]", 0, RISCV_ISA_EXT_SVVPTC, 1) + : : : : svvptc); + /* * The kernel assumes that TLBs don't cache invalid entries, but * in RISC-V, SFENCE.VMA specifies an ordering constraint, not a @@ -482,12 +485,23 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf, */ while (nr--) local_flush_tlb_page(address + nr * PAGE_SIZE); + +svvptc: + /* + * Svvptc guarantees that xRET act as a fence, so when the uarch does + * not cache invalid entries, we don't have to do anything. + */ + ; } #define update_mmu_cache(vma, addr, ptep) \ update_mmu_cache_range(NULL, vma, addr, ptep, 1) #define __HAVE_ARCH_UPDATE_MMU_TLB -#define update_mmu_tlb update_mmu_cache +static inline void update_mmu_tlb(struct vm_area_struct *vma, + unsigned long address, pte_t *ptep) +{ + flush_tlb_range(vma, address, address + PAGE_SIZE); +} static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, unsigned long address, pmd_t *pmdp) diff --git a/arch/riscv/mm/pgtable.c b/arch/riscv/mm/pgtable.c index ef887efcb679..99ed389e4c8a 100644 --- a/arch/riscv/mm/pgtable.c +++ b/arch/riscv/mm/pgtable.c @@ -9,6 +9,9 @@ int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address, pte_t *ptep, pte_t entry, int dirty) { + asm_volatile_goto(ALTERNATIVE("nop", "j %l[svvptc]", 0, RISCV_ISA_EXT_SVVPTC, 1) + : : : : svvptc); + if (!pte_same(ptep_get(ptep), entry)) __set_pte_at(ptep, entry); /* @@ -16,6 +19,16 @@ int ptep_set_access_flags(struct vm_area_struct *vma, * the case that the PTE changed and the spurious fault case. */ return true; + +svvptc: + if (!pte_same(ptep_get(ptep), entry)) { + __set_pte_at(ptep, entry); + /* Here only not svadu is impacted */ + flush_tlb_page(vma, address); + return true; + } + + return false; } int ptep_test_and_clear_young(struct vm_area_struct *vma,