From patchwork Sun Jan 28 12:04:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Ghiti X-Patchwork-Id: 193126 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp12513dyb; Sun, 28 Jan 2024 04:04:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8A8Ruza0jpne4BJ0vHVjvYqkkVFDljMVJO9aZqs6SDFT07iyoZ4rC91gf7ELPiarWHXuz X-Received: by 2002:a05:6808:191d:b0:3bd:bc6c:645c with SMTP id bf29-20020a056808191d00b003bdbc6c645cmr4913542oib.24.1706443465264; Sun, 28 Jan 2024 04:04:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706443465; cv=pass; d=google.com; s=arc-20160816; b=Y2cgAKk+HbsPIYOFX2FBiVMNx07HjaWl74JU9Jxhkq3NrQWLdKE1ck2JuI/2YRZW6Z XghcT5Gx1y9Kl0MrqVm+sz67KaDbI00AvpmAWFMQUbgrwr2SJv8UlVE0OxvX4BCQ+UkP znpF8MyzIPwZ1P4U01l2E39CEWmZ8Crz926Nr2eraWGF+pTgOwwh9qC7M/j3Zt23Sbya ynRIbZ05yfJR76N3CAN8hIum9LDWPpinHSrqYj2XJKWKQqbhOxGexK7vv1rwSTTidVEe OIzNJmdBiwyYBLFz8l21tTotonnJ+vv5kPPZgerU2p8Xj7rWIikAuQn64gfP6QE+cmJ8 sAoQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41608-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u32-20020a056a0009a000b006ddc78331easi4077709pfg.401.2024.01.28.04.04.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 04:04:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41608-ouuuleilei=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=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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41608-ouuuleilei=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 EAD7528296F for ; Sun, 28 Jan 2024 12:04:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A655224F5; Sun, 28 Jan 2024 12:04:15 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789335663119575777 X-GMAIL-MSGID: 1789335663119575777 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,