Message ID | 20240229232211.161961-2-samuel.holland@sifive.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-87672-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp740393dyb; Thu, 29 Feb 2024 15:22:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVTo0R8nGqbO+zDRlvlrAEWBdHX/fpiDXw6MOV+JOcBOGp6uNb90LWf9MH0hIUl9Mi2QAuPdn3SydxOapuwXbFbfG5sBQ== X-Google-Smtp-Source: AGHT+IHVOf9BfbK2UUeWeDzxMHxt0DBas6xkugeRNVLQ9fgHhF6bWJMNr7DlB0BGkbY1GK3czRGa X-Received: by 2002:a17:906:578c:b0:a44:1d7d:fb57 with SMTP id k12-20020a170906578c00b00a441d7dfb57mr77634ejq.54.1709248975121; Thu, 29 Feb 2024 15:22:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709248975; cv=pass; d=google.com; s=arc-20160816; b=VgkG3b3PTeB/hC1/MOckY2f2w45MOAKGShDJOA0dQKrYUmwAGwr7N6rVgsfLu1DX+s zvC+8RbfAuUcq0z2TjmYgSRLFYEi2u37fXdVAipMuBrQ1LeVsAMQbhghjTY4kjFrhhgq SHPC1GMdGtGUDl51BVQHNfycFyr3LxAs4wkx7Q7SSMw0bT9ecoLGJbPF+YyPuZcnbv05 H+no644FEvuF/5Oh4wG1xGWvYRfpdxqBxkpEarupSzt9BzRDlh67Y2as5JCEckjzprkW hwbVWS7rESEDOmrSLTTz86dk1Uvq3r8clcKmnuPljILKjTU/63CZ2J03zgkAdV1PxiiZ P28g== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=O37VWqG4iCvkiZDgqVtP8oElF9rd1vMtEBQWx77Nmx0=; fh=kVMl8kfpA36Ro/3P2bM4CdBKxR/FbbKq3UwoDY1wFDQ=; b=JS6Lx3p/NJZrfNQ66BhGc8V7MccRXxsazNH5MxT7Pc2lW79jtD1Nz9KK5gRjTa3aQO aSB1oBBp4LASgQXnRCVLSTZC4vBeVGHGKeZIC+2SwuBP0MyrDmOLw4jtgPC0Z/IgcSa1 TkF3/opW1Vg4NjjOHSBDWFmRDWeTlYrOZMeaZg0OoI4J65rf38pu4TuPUsErFfetr5wm jV8gdpjfIO9bbADQb7HwcKueLyC6znVqthP5n/gCOAQI7VbMtINA3G+mKak/znZPBP50 W4xC+9uEvn5AwPZdUsNFyDtxMPM3ARn1tuhXHp/em0T0C9EzGp9hZ6GP0xifq6qo6p8n tA8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=gmTxm6T0; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-87672-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87672-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g8-20020a170906198800b00a442a09a6c5si939910ejd.629.2024.02.29.15.22.54 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 15:22:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87672-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=gmTxm6T0; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-87672-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87672-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id B0F631F21828 for <ouuuleilei@gmail.com>; Thu, 29 Feb 2024 23:22:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 653CE13E7DF; Thu, 29 Feb 2024 23:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="gmTxm6T0" Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 E56096D52F for <linux-kernel@vger.kernel.org>; Thu, 29 Feb 2024 23:22:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709248936; cv=none; b=oYPlq4hwaJliz6rXS/nVyOpKDMrq1shS77rVv47Z1BJPwMTQkOb15p5RPhEkNr+ECPOILJCiOCVHBtIc2c48EqvyLcGodAlg/DvjibBhOGdP285KVdUfxH9/ZE5I05wbu3lGUB1tekjF/BwAnAxlmeP2RogHFnG24ez1S/j2Y0Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709248936; c=relaxed/simple; bh=KWtoavmsQ9Zyjmm584UX//N/CxD8kDI7cE1TWuh589Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pB+GrbU7Z/ANJ2XHjcS/wplP/vefrBl8g+umekIhXshnhAYEobHraveMFs7YDFM05u5Wxl/ww6DoWdXXpnjqS0fSHC1bYddI/ucLxlDojeyJK2Hr9k/v1JYxwdAxtqODd9dyQXQWrlq9rO2frxcM39JdYnsARqz/OGBLEpB77nc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=gmTxm6T0; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6e5896846f2so1080168b3a.2 for <linux-kernel@vger.kernel.org>; Thu, 29 Feb 2024 15:22:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1709248934; x=1709853734; darn=vger.kernel.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=O37VWqG4iCvkiZDgqVtP8oElF9rd1vMtEBQWx77Nmx0=; b=gmTxm6T0avUpX9VJ7qCwLt1Rfkqoxx8cFMtmIMvsDRBBrKpf0SbuHte/6vrcxvgbE9 W6okPqhJfltLijsznF+BcrEfSMXPXPDFSulZeKD5MD2VaUefw4qWCuyjvQqD4/atesfq 98lhyxshteYBc2moJwwnBYpXZngNGPecE1AyivgB/XFeAlb/+XssbU4kBeajC2GxKNlS nOXf1GDd7b/1bdWQHJfuKcw5+dUYE4Y88G1Mz6VlNW+LOhh+jrHY4BdUCQnFMZGYBjHK uTlhnTvKOSnD+Trg8ZRa+FkTyhvGMTknAmhPoCriPfL3H0LH0HjUqCK0u3E5jEdhC5iG TS6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709248934; x=1709853734; 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=O37VWqG4iCvkiZDgqVtP8oElF9rd1vMtEBQWx77Nmx0=; b=BRkEcEDuFubf6GxAqSckhMV7WrI2peULZr6yMPRyiWeS9BEjwDnug9G0MXfl5hT/2T uwnRRKvrPEHvEMgCJ1QMh3VcsHFvMcLD+DBaORtWr5wlfCvUonh1/csLIkoj1YPmKIT/ Scqm0UNPWv/greuiayFbwhlS8f7cfXEkw0zy99aG483iHiUqbzLiXgwpIMajN2vyn/sa qfGS/cwa0EpClcCfhwVlrcfwSfi5ayhruOk6yBnIfgulxoF8AT1dPghAcMuG53/emH8L 5BkRqM2Dc+PPeVKE73WFmI2fTQuUgQuhOL04GXcLahZ/MMq6RkXVfIFkHGbGtzvr77fk g94Q== X-Gm-Message-State: AOJu0YyQFxl32DCFu67chu4ojaIrBvIe/08J7dcEA8O5aNMSWaa81Xz+ NhDwl4TZFIC0UrvNT0HB46oltwoz/ZuJCjGohLOYpjW4ytU0fj3xDNqhSRyhCuo= X-Received: by 2002:a05:6a00:2d1c:b0:6e3:fa52:2f26 with SMTP id fa28-20020a056a002d1c00b006e3fa522f26mr168419pfb.8.1709248934208; Thu, 29 Feb 2024 15:22:14 -0800 (PST) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id c6-20020aa78806000000b006e55aa75d6csm1779719pfo.122.2024.02.29.15.22.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 15:22:13 -0800 (PST) From: Samuel Holland <samuel.holland@sifive.com> To: Palmer Dabbelt <palmer@dabbelt.com>, linux-riscv@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti <alexghiti@rivosinc.com>, Jisheng Zhang <jszhang@kernel.org>, Yunhui Cui <cuiyunhui@bytedance.com>, Samuel Holland <samuel.holland@sifive.com> Subject: [PATCH v5 01/13] riscv: Flush the instruction cache during SMP bringup Date: Thu, 29 Feb 2024 15:21:42 -0800 Message-ID: <20240229232211.161961-2-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.1 In-Reply-To: <20240229232211.161961-1-samuel.holland@sifive.com> References: <20240229232211.161961-1-samuel.holland@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792277453570350977 X-GMAIL-MSGID: 1792277453570350977 |
Series |
riscv: ASID-related and UP-related TLB flush enhancements
|
|
Commit Message
Samuel Holland
Feb. 29, 2024, 11:21 p.m. UTC
Instruction cache flush IPIs are sent only to CPUs in cpu_online_mask, so they will not target a CPU until it calls set_cpu_online() earlier in smp_callin(). As a result, if instruction memory is modified between the CPU coming out of reset and that point, then its instruction cache may contain stale data. Therefore, the instruction cache must be flushed after the set_cpu_online() synchronization point. Fixes: 08f051eda33b ("RISC-V: Flush I$ when making a dirty page executable") Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Samuel Holland <samuel.holland@sifive.com> --- (no changes since v4) Changes in v4: - New patch for v4 arch/riscv/kernel/smpboot.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index cfbe4b840d42..e1b612f37dd9 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -26,7 +26,7 @@ #include <linux/sched/task_stack.h> #include <linux/sched/mm.h> -#include <asm/cpufeature.h> +#include <asm/cacheflush.h> #include <asm/cpu_ops.h> #include <asm/irq.h> #include <asm/mmu_context.h> @@ -238,9 +238,10 @@ asmlinkage __visible void smp_callin(void) riscv_user_isa_enable(); /* - * Remote TLB flushes are ignored while the CPU is offline, so emit - * a local TLB flush right now just in case. + * Remote cache and TLB flushes are ignored while the CPU is offline, + * so flush them both right now just in case. */ + local_flush_icache_all(); local_flush_tlb_all(); complete(&cpu_running); /*