Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp669986rdb; Sun, 28 Jan 2024 04:04:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU+xht7zE9KE6Uww7wACeZkFBbBuB/D79WDIk2dtgEL/F+xsrZqp6jooOoX9zbAERrEl+2 X-Received: by 2002:a92:c5c9:0:b0:363:7ea6:577f with SMTP id s9-20020a92c5c9000000b003637ea6577fmr645465ilt.24.1706443459007; Sun, 28 Jan 2024 04:04:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706443458; cv=pass; d=google.com; s=arc-20160816; b=MYHHBIyk1cmgdw2YBclQ0oIltT3PT4NyT5v2d8sLAcXwZYKATifEhA6NuOsgeHVj1p VJdkwyKAdZQe7BYAszJIQB/JhvGkg+JMVnG+vbPJDqoSEIBxyG6JxxCh8drpo5s9Nqhk oQcJziZK3q+1VnnPGNz6dTNDvnwMCZyAMCsLy197NNU0n5KPbA0hhEwE9Bp6k+pO5pS4 sB3dJfPVLdYE+yRZD4QFUy8pZm9YM5AmfAryMqz1WiEEpV8/VzfKkAv7o4wXcsV801qs za2fNcVjd1ngfTny29MLHIfkat6E1yt9ciXnb54IgyQOyJSGzmg0jheHMrvl++bZ7FsN njnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=HxcAjPK0N066N6P8kFzyYPkzX8zdfJo2IeOhtls9JxI=; fh=kWqvTYOvb0sWDuUtPjdOhvCUUJ90NC0NfcSnIUXGM5I=; b=OEbGQfssAK9HZhCgWOPHMxHkuBkr1kjeXG4N0A1ML+AscS+crZOFxmtCtTeSPvl4+g ULYxcbGbItVIlqlQe42kqy4QTMx01oXGMN0i6nWCcPDb4HF5e3RGTc+TkYSRs71zNZ9x kfpUcnmS9JYlr2AaDbm7pU8lYMo4qdLFwfJAU923ajQZ+xZT+Da+DkW1cuyDe0N/ZyAn Wn9Atnb4Y1OfaeWv4Uwt1r9X4sI0py8tERnZemuPCBtC09/u8XrpB0cfaaoldakSk1b5 yvUMgPEeSXPVIK2FOxYvex93O8PMzW0vUtlCesPnNjoNUqe8q4pE5KhwnIlK138FNbPr jvMA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=vPPifL+Z; 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-41608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41608-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f28-20020a63381c000000b005ce08c4bff5si4030175pga.760.2024.01.28.04.04.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 04:04:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=vPPifL+Z; 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-41608-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41608-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 412A428264F for ; Sun, 28 Jan 2024 12:04:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7265A208DF; Sun, 28 Jan 2024 12:04:13 +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="vPPifL+Z" Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 928F1200DB for ; Sun, 28 Jan 2024 12:04:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706443452; cv=none; b=DaggzDMNkLT0AraG3+T9sZjXhfKwxoRHuZ8A4kufENLecfSPWoxg8sGjXJBhn5dgS2AxTb+y9NOZc6L+0jDn5H/c1EVcwl4qBLVjU5eLke7enh39fT410Q1cgMhqnyAamgcZLPoO4mdNVCjMeMP/zuoSEJXifpz7XO5vB4NPQOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706443452; c=relaxed/simple; bh=VzbpvU0e9JzomL+t0EfKfndh1+wTmCO5Ucl/AxnJG3c=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=s9u9RQGg/ZDo9GjYvVkSO3symqBPWDWcSC1qbTueAi9aQMmLuHg0OrcVn4vHXISOjKkDO16oIvyOqv+f7HSuD1nqOshtdKOd5lfg/vXrlSzw+lDRFNW1DzeDH/68tKLtcTZVW5KIwHpGOzcPsUjQzufbK05sjdD8paLCwLvvMh8= 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=vPPifL+Z; arc=none smtp.client-ip=209.85.128.45 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-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40e7065b7bdso31119995e9.3 for ; Sun, 28 Jan 2024 04:04:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706443448; x=1707048248; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=HxcAjPK0N066N6P8kFzyYPkzX8zdfJo2IeOhtls9JxI=; b=vPPifL+ZE0VnjQmk0/32mFDkxFYKVKSSsiwVCkjTYKnHq1HKo7SZ5DrjSy2/4GAJmA z/vxC0TPfNyadqZlpWQCgbtO8UZzK1n4FJ5KGlKHOFLoj4OyuEULt614HiX880SlejW7 mwP7gjQMesUhvMio0uovydAFOBv1U2/EAs5MEnKV/9yTVokBiApC36VrzIxNjB2T4VZE BhKBIJOVDdewpljAYXef9buWAffFPcO5XxndYon3+iFSsxboImOLNkRlcR6kWzaXD2iY YmMxwm2ZjAuhltu8YmVSmgwT+Sw1ijVrugZUCtJhOEu9XuBka+mLwrVsQcGr1W1zfPRC aQcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706443448; x=1707048248; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HxcAjPK0N066N6P8kFzyYPkzX8zdfJo2IeOhtls9JxI=; b=ZIZsodKs80i5ayrFbE1Eq6v1bI6iLHOz8hUiJw+iZ4S5eZLBuH7BWcywJGpj9iPnfM RCC8ay5OMKIxVUEuiqCe7XfMRSDXzprx+pHPn69wUQKoKP477IVcG9gRV74JQgSwhr1V izCRY2FrFu9bA1EaJLv7e4cFgc30m5Yf1GOS3BNttHb44vNTXnBwx2unfk8DbHmLSPvu TlM7C9IJZPTeQV1SDc3077a7NHfF7vHcBTbG2xMqYPAweHQuil8m6Ao4xHGkTV7Y+Kv/ XhqsOypFJgO6IqDfMxcPCjeyCMD6i8Y5zaF5cStgIDjt5dCcz3fhnAH2c8AdLPf+IuY4 7naw== X-Gm-Message-State: AOJu0YwS2yzMlM+NXE+2DT9Ddo0UycJYqhOv70B6NPATuaaqEmtL8vfg lbT+kIYDUo8J8dd0DRZlHkbWUf5RqVrAokaiQMNiF1QW6phK7AGN2Q3j9l3248k= X-Received: by 2002:a05:600c:34c4:b0:40e:ee82:18 with SMTP id d4-20020a05600c34c400b0040eee820018mr1937031wmq.14.1706443447739; Sun, 28 Jan 2024 04:04:07 -0800 (PST) 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 m16-20020a05600c4f5000b0040eee561e4dsm3859911wmq.41.2024.01.28.04.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 04:04:07 -0800 (PST) From: Alexandre Ghiti To: Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Samuel Holland , Andrew Jones , Alexandre Ghiti , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH -fixes] riscv: Flush the tlb when a page directory is freed Date: Sun, 28 Jan 2024 13:04:05 +0100 Message-Id: <20240128120405.25876-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The riscv privileged specification mandates to flush the TLB whenever a page directory is modified, so add that to tlb_flush(). Fixes: c5e9b2c2ae82 ("riscv: Improve tlb_flush()") Signed-off-by: Alexandre Ghiti --- arch/riscv/include/asm/tlb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/tlb.h b/arch/riscv/include/asm/tlb.h index 1eb5682b2af6..50b63b5c15bd 100644 --- a/arch/riscv/include/asm/tlb.h +++ b/arch/riscv/include/asm/tlb.h @@ -16,7 +16,7 @@ static void tlb_flush(struct mmu_gather *tlb); static inline void tlb_flush(struct mmu_gather *tlb) { #ifdef CONFIG_MMU - if (tlb->fullmm || tlb->need_flush_all) + if (tlb->fullmm || tlb->need_flush_all || tlb->freed_tables) flush_tlb_mm(tlb->mm); else flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end, -- 2.39.2