From nobody Wed Dec 24 08:24:29 2025 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 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: 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-Google-Smtp-Source: AGHT+IGp9QOplulvd/Y9t4bqyDTHP2SEbLG4SLRuZKPDPzRKkEqnxw5vDg9O8Y6f+J4FCQikbsMYxA== 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: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Charlie Jenkins Reviewed-by: Samuel Holland Tested-by: Samuel Holland --- 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, --=20 2.39.2