From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f49.google.com (mail-dl1-f49.google.com [74.125.82.49]) (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 6DCDD3A451B for ; Fri, 8 May 2026 09:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778232689; cv=none; b=Hjk0IVrd1QwPBW9j/dTulkFrBvjBqfiDyc04T/hw9Bqomjv6gVm2TFCwj4+C/uy333tLSNnC3z7lEcuAUFkkElYo+1dPrSIp9d/wYrKdi5dmdAvP60bj21E9qf7U0ZGcQ5oxHx5uwWNVfzxt8XRM8nrx6wQs+pM1GZQEoyenoSM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778232689; c=relaxed/simple; bh=Mnv7DpO9+oYPGvgz11ygXzOtsg1VjNX6w1Z503dFEw0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=EEm9AmC9z9IwwnT6EtJPFk0uchig43eHv5P6FmSUEDH9n4SCihqmIOHbpPNd8tMHZZ3KY9CsEckbhnUw9kGKVGkzXx7z7r9JBkrpJcXAD5djdgGxl/FpuEDb3qzWJfSm5wReW3QSNjKJC8drzi1lecxoWQVb8BR6gLbjPfaq/KE= 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=RXzLAsUS; arc=none smtp.client-ip=74.125.82.49 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="RXzLAsUS" Received: by mail-dl1-f49.google.com with SMTP id a92af1059eb24-12c1a170a50so2522519c88.0 for ; Fri, 08 May 2026 02:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1778232687; x=1778837487; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=VDMazkU19xo6aeg8uO8FYpNwjaVlN14PTDXh6w6kmHk=; b=RXzLAsUS0g7yp9itjkLoOVnMRLoXhnvVymHb40Yp1RAI5q6YFsmYv2XrtCXbSOb6PX gjM/x/JK+oHyJrWJj9LxLuAGjhkEOYP3q7iqDXIyMMZW6uZoPiPpmj4sJ+oSIcZWtlkq PtGIWRx27UCjTDXnIv2OHW1I0IocylMlvKZgMaiBVKbdUX2uzkEMAcGNtWRaLPYgM1rH uhD1pYCO+ehWo9bXjlEw47yub/Xuwpy5Zmvnw6CaToXh7o0FCMnRKX8gBGj3V5Ngt656 k1dCziRDiVbUho/JRMyaGNoGu6gZnaHclUeyyJvgsXllrE/eGlrnTw+6/x3yw4iVnLzM DvVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778232687; x=1778837487; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VDMazkU19xo6aeg8uO8FYpNwjaVlN14PTDXh6w6kmHk=; b=sFrk9EyeH1q5FwfX/bBTb2k1R1lX0Qz5HjX9W8ghFHNBEWAs2MQ3olhj6Kwh35fb9k 7dAnbzeVlplLzK3u/Dz4ym+Z4CKWAAG5O1fZAwnaQz/M2COWPDz5g4c5Q8laGtN21TeE gT30S2DgjqcPNcDo+2q8vt2yQloEexyYGdlqPoq+gVsY0yxUgbD2mIZqKuxFUJ4kHNYD BoOeib0UFBprfRnhQzUxZ01EEPr5CYhr5UCs48FLskhiNFwVnGXDZSpvLl5v34OTtbWI +4QPDCDc69g5+zqXcpdDiHg2oVeu9ItjZWo3mdgFPbzKpngoo4+dPd2PXGkQTF/58OxQ bqIQ== X-Forwarded-Encrypted: i=1; AFNElJ8pc9O17DsRQBXWCdLPMH3fRu1MWiDKpyWrJczs6UE9wgmgvpG1t/H5PcJ9uvxBoia/DV62/mhfKWMLoyw=@vger.kernel.org X-Gm-Message-State: AOJu0YwsIjHyUydw4+XuSj+7n1M4+OHHPP/e9XwK9ONYXNzXMNBCZ667 +iw293vHDt1/oaF3EPf7paFl5za8nIlrg+Ko5EqL56elURhE1CAVvQQWfJrAGveArbo= X-Gm-Gg: AeBDietK6eBJZFZBoIF7unF2RFsH/RjWzCdpsJxedgcwAzSUOYvS5O6zRu6YM3NuQ7/ mTbNtyN+Pwl39MQiJib1PjGWu3Ir2SXedXP8crFAo9AfR5eKN4rwd0VW96pj3XUQThTsZ4Mlsar QyC+oaw6qc18LqGwbpwI/cEPcKyTZia+RZH8NErlMIeoIEgSPn9fpv3zXzBMnPVcSO02MlyQ5Kk c3zeeLuGkwWkLOJQs8XL5cBmgfh6TG6/NQHtb3BDhXZfKOpRo1/oUze7TKVS0y1Af1Ubln0/2HU i0xDUScVv7q0NKpXzTgoiadfSrJBlZJGyXknMAtFekc4PPOzIBKcsOy+Ql/ho1h32bXyw8pfttC z86QodfGMJcojzy5KCvFEt22eS1D6RdbmfBLvmmLnb4gGa8hKa7Hag4M2ojbEeUwZbUFXug48nu a8ofi+Qtc9ME0/stSAR1PbEyfw2hpAAjdZzA9kH0bkDJk= X-Received: by 2002:a05:7022:251f:b0:12d:ca32:59f with SMTP id a92af1059eb24-131969d414emr5780690c88.11.1778232687194; Fri, 08 May 2026 02:31:27 -0700 (PDT) Received: from sw07.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13277bb2b14sm1978374c88.0.2026.05.08.02.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 02:31:26 -0700 (PDT) From: Yong-Xuan Wang Date: Fri, 08 May 2026 02:31:21 -0700 Subject: [PATCH v2] irqchip/riscv-imsic: sync-up state before CPU offline Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260508-imsic-v2-1-e9f08dd46cf5@sifive.com> X-B4-Tracking: v=1; b=H4sIAGit/WkC/12NSQ6CQBBFr0JqbZseGIwr72FYQFFImTCkCzsaw t3txp3Ll7z//gZCnkngmm3gKbDwPEWwpwxwaKYHKe4ig9W21IV2ikdhVF2l0RQltlWuIbqLp57 fR+de/1he7ZNwTeNkDCzr7D/HUTDJ+28Go4xqmotzuu0Muvwm3HOgM84j1Pu+fwExv8LUrQAAA A== X-Change-ID: 20260503-imsic-d70c156cb740 To: Anup Patel , Thomas Gleixner , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, greentime.hu@sifive.com, vincent.chen@sifive.com, zong.li@sifive.com, Yong-Xuan Wang X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778232686; l=1599; i=yongxuan.wang@sifive.com; s=20260424; h=from:subject:message-id; bh=Mnv7DpO9+oYPGvgz11ygXzOtsg1VjNX6w1Z503dFEw0=; b=JObsgD+146rdng8X5Y+IatcEapo0L3mgv/Prrqfc7hebQ5/JH6ghkGrOu28eQDUxjawpuLjMU RXL6dFHJ9laCeCKbJcGW5FSM4uSLmLi7j8Um6i48qpNKZZTmTS7gA3y X-Developer-Key: i=yongxuan.wang@sifive.com; a=ed25519; pk=+8NCHB1ZJvZthQAmZspOAaqjo+/snaW8mFSiDx45HxY= The "move_prev" pointer in struct imsic_vector on the new CPU is cleared only after the old CPU has cleared "move_next". But when migrating all the interrupts out from an offling CPU, since the CPU is already marked as "offlined", the IMSIC driver skip to sync-up the interrupt vector in __imsic_remote_sync(). The "move_prev" pointer of these interrupts can only be cleared after the old CPU backs to online. Therefore, the affinity of interrupts originally targeting an offlined CPU cannot be updated. Clear the "move_prev" pointers in the CPU hotplug offline path to avoid stale migration state on offlined CPUs. Fixes: 0f67911e821c ("irqchip/riscv-imsic: Separate next and previous pointers in IMSIC vector") Signed-off-by: Yong-Xuan Wang --- Changes in v2: - Update the description and add the fixes tag (Thomas) - Link to v1: https://patch.msgid.link/20260503-imsic-v1-1-aa8330bd1c34@sifive.com --- drivers/irqchip/irq-riscv-imsic-early.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-riscv-imsic-early.c index ba903fa689bd..a7a1852b548c 100644 --- a/drivers/irqchip/irq-riscv-imsic-early.c +++ b/drivers/irqchip/irq-riscv-imsic-early.c @@ -158,6 +158,8 @@ static int imsic_dying_cpu(unsigned int cpu) /* Cleanup IPIs */ imsic_ipi_dying_cpu(); + imsic_local_sync_all(false); + /* Mark per-CPU IMSIC state as offline */ imsic_state_offline(); --- base-commit: 9b3a2be84803cf18c4b4d1efc695991f0daa153c change-id: 20260503-imsic-d70c156cb740