From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 EC9FC2FBE0F for ; Thu, 4 Dec 2025 13:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764854190; cv=none; b=IQ9wm+BasL2xTzZZn6rSMj45t89rKNO4v/Z5MBKOtvVzMk1soQ0AqctUlWb7sJek8VuPkclErW/ARaoj6L0VnEHQ8OBSSPJ6yU0gJEVVIiia+TKSSJgSCpNEQQZlHh/xEwKySZbqAOMnr7fEzugdLmFnKEzP74iqrxHCkcJWF/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764854190; c=relaxed/simple; bh=UE95cY+CBs+B9+howGD8WrXSCCt5/PQoGVFTeHtMCBU=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=KvonJ4tpoinWZJlz+xGlpGLhBNzf3ciYMtBe4AEWf/ZKuSCquINGSiWdQUBR5mEPdAKfvQ/C3k3BoHWFq4+s4bIoJl1TDw0Ud/KRgdq7G0Obj3qNnPSjFG2SJbYX018LWVPyszY9pPX3vTSDuKkMxgTKtpjNSz5ire7mWIG2x1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=azA4OgXC; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="azA4OgXC" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-3436b2dbfb9so111381a91.0 for ; Thu, 04 Dec 2025 05:16:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1764854188; x=1765458988; darn=vger.kernel.org; h=in-reply-to:references:from:to:cc:subject:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NG0EewGU/m3seu0dnYeXl0q+SbDSXR6KqjikfXMh8A4=; b=azA4OgXCNbhjKs/bF0DYhOa5ddUVKfjcKKZSj8yVO17T3q/IVjRFz9qj7ZpAuXg2za Bpfl9eF2ptakvreDUJPyMe5Ta8jTqwD88YbqZ9FWEI8F7Ga/qpaOc4p0cCEzkOzDMOQG A0MItxvCX0czArfBgczPQnXAhxcBKUCC5zYK1AipKRDNyj/VBi+5qd1zPngeRXqFqB/7 CKh2G4Z7pwkJYDz2pn1dhDMPTj4eD3E1ey5pjCW4Ir1UI3NtGTF1VaLnIU0UzaQB4iKY gXlSkSNT+N5P5CJeJI0gkIaBI84y8GmyP0MdW/KpkTrcp5oYoWk+yoLTUAd+4BsmNYf7 cqEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764854188; x=1765458988; h=in-reply-to:references:from:to:cc:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NG0EewGU/m3seu0dnYeXl0q+SbDSXR6KqjikfXMh8A4=; b=Zjfz73T2iRh8KAh9w5DkTy6KxSop7UsflJhQfq0Lqs3tI+yY8Kk5Xyw8VnSk28N/ls luwp1DhwJfZoWfl/eqYnOWnRHDz3QbniLKSvj6lfpNNFXqGCODNwOGtJe5KumpOmKtfl 6/e1jPmKUnRdCmB8YPT+8w/G9dJet7/nHXHnLBzQ7cL5c2Cw5fSO5OMvVe1hQ/DQSQPH PIgO1db5K4MPKjcVGASpbdsM04ISkzcYuPS4SqZG9B+HfwQq10g4CLldeAGpMNmfYXaK Y3g/XTOxwjY2XL8ir45MAVy6M9X9yu0joICq3ahn+kynD1ro6qwOqRnryUj9WPjxMUMM YlcA== X-Forwarded-Encrypted: i=1; AJvYcCXUCxq9qSxyADVIDv+zV7byonYSF1G9Zpq2WHryieUVD+ZxVKI6tSrj1GZ6XYrtz+gPXzQG2sBTxcxiMRc=@vger.kernel.org X-Gm-Message-State: AOJu0YzzFXhzE1Cvdnsxpn4ns/OPp9tE/nd+pD4saUeQgU1l8ENQfSYh TMbxJ9i22WcyvULiivzgpuadn9ghXnhJiRIU3llH9UxIr6iUfnFEKHkRSiYo94iu7ew= X-Gm-Gg: ASbGncvjbgmbE78bXFWxrV5pFCpSx0/NPc+BtVCSmV8g0RyAuOo2vT5DToBvnvo4zgP riY9pEMw5rdpaVGBwrgccpucJXQtBx2rQ+0gr88MW7phWgEOPuMmQVODiz0R4PNgrgUx67sZFa6 g7Q/mYgkX6jFhYVgMWzxljlrV2qtJlY+N36W0HkbMoBhgGMaNl5MmqQV8SSBXvpOMtLNPQ6ct+L vF5S9TXu+JWGTUw84RJk3kKOAGwKmfaaeMgL92rYOSTW3sYxJxHaDBHCKHSFB6kzb616GXR2q+3 iWPJr76tss11KJplJabP0gMRrH1Z0g7cibMoN3H9GxAsvl996ZQu3d714AO2nLlhI71i6PnzG0F 4hWPl+THHdnOkQc4fqZgUgkaTkxV7l4du0nQYjT8Kd/wadc0v+gmM8FQ3iMNm/6obEXkSyaNaeg 9kk/aycUfX3LSvEhcVtnh64bg= X-Google-Smtp-Source: AGHT+IFrB7/13g+70t+q6Tfh05eJRWVooKVrov8IamBiYIRpay1PS4xRXZ4UfhLRB6v8AGDznuHK1g== X-Received: by 2002:a17:90b:1c0a:b0:340:be2e:9884 with SMTP id 98e67ed59e1d1-34921072ea4mr3001865a91.1.1764854188145; Thu, 04 Dec 2025 05:16:28 -0800 (PST) Received: from localhost ([1.232.169.190]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-3494f38a27asm1890893a91.4.2025.12.04.05.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Dec 2025 05:16:27 -0800 (PST) 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 Date: Thu, 04 Dec 2025 22:16:24 +0900 Message-Id: Subject: Re: [External] Re: [PATCH v3 5/8] riscv: smp: use NMI for CPU stop Cc: , , , , , , , , , , , , , , , , , , , , , , , , , "linux-riscv" To: "yunhui cui" From: =?utf-8?q?Radim_Kr=C4=8Dm=C3=A1=C5=99?= References: <20251127125305.89961-1-cuiyunhui@bytedance.com> <20251127125305.89961-6-cuiyunhui@bytedance.com> In-Reply-To: 2025-12-04T13:28:45+08:00, yunhui cui : > Hi Radim, > > On Thu, Dec 4, 2025 at 12:07=E2=80=AFPM Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >> >> 2025-11-27T20:53:02+08:00, Yunhui Cui : >> > Use NMI instead of IPI for CPU stop if RISC-V SSE NMI is supported. >> > >> > Signed-off-by: Yunhui Cui >> > --- >> > diff --git a/drivers/firmware/riscv/riscv_sse_nmi.c b/drivers/firmware= /riscv/riscv_sse_nmi.c >> > @@ -58,6 +58,7 @@ static int local_nmi_handler(u32 evt, void *arg, str= uct pt_regs *regs) >> > type =3D atomic_read(this_cpu_ptr(&local_nmi)); >> > >> > NMI_HANDLE(LOCAL_NMI_CRASH, cpu_crash_stop, cpu, regs); >> > + NMI_HANDLE(LOCAL_NMI_STOP, cpu_stop); >> >> Please document the intended preemption design for all SSE events, >> because it will be a nightmare if we forget some assumptions in the >> coming years. (That includes the relative priorities of RAS/PMU/...) > > Actually, LOCAL_NMI_CRASH, LOCAL_NMI_STOP, LOCAL_NMI_BACKTRACE, > LOCAL_NMI_KGDB, ... are all implemented via the single SSE event > SBI_SSE_EVENT_LOCAL_SOFTWARE_INJECTED. Per the SSE design, no > preemption will occur among CRASH, STOP, BACKTRACE, and KGDB events. That is how it is. I don't understand why it must be like that. For example: PMU_OVERFLOW has lower event_id than SOFTWARE_INJECTED, so it will currently interrupt NMI_CRASH as they both have priority 0, although NMI_CRASH probably shouldn't be masked by anything, and should preempt everything. NMI_BACKTRACE, on the other hand, probably shouldn't have that high priority as there seem more important events (e.g. RAS and NMI_CRASH). The issues can be avoided by event priorities, masking, or deemed as non-issue, but I think it would be beneficial to provide some reasoning behind the design, as the choices don't seem obvious to me. Thanks.