From nobody Thu Dec 18 20:37:04 2025 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.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 B0C6E233539 for ; Mon, 13 Jan 2025 15:09:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736781001; cv=none; b=WLaEAxrzQe+AYEz9+3JwX/O4hj60ILgZHExn8DhbNcBGrpy5gbzh2YPUhj938DMsWwKf260XrqbgOpAH1ZECwU4lhklEsL4kIiWE6S7fjJitczzMSVcX0mvl1xmy7xInJlpOJljLtQo4VDFZeTTc0BTAY5HkjOG2flMrTB+3adg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736781001; c=relaxed/simple; bh=Bnd5IecsMg8lE7hIkayxmcmzksJPscm4JxEaie+mc7M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZAo+ZDAfibpnG4RWcJHDbM159qe6/AcJ8R8k0CJRqltvypYMbLr6bCmqfaWQF2JcT+boE8XVcMLTP7G/IrVplt8tD4Jc9Sa+KqwIe4xbu+G5cV8g1oSGTlQzXGGoiIM+OZEqhWzFwP0uzUm4Ks7m0VRr4rQ4Jnx/DR4IBNVeEhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=cP1vTuQe; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="cP1vTuQe" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2f43da61ba9so5839417a91.2 for ; Mon, 13 Jan 2025 07:09:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1736780999; x=1737385799; 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=yrBkAyqGMS8V2VSoket5Q8LogeyFHT+hq05EyX1hziI=; b=cP1vTuQete0NvZ4u/gJOtj3EF5JBuVTJKJdVIxU6AWbcdH8SejZDBcNLfeyfwrcB/L SAB2+Qa8gD8ZX0o04Lo6/tOEa5kxDqxJv5mgZSkc/tpyBR46bxZsvnEFRIhLRoLBN9bK 3/DAic9IYIHMJn6IatsguV3gNxmxzmHnmNFzOXIfhpOF5DnohXFh6aefiTGuM4XahZOo 1D3Wnk2NMywLsQCHI6uOVBhcrWzfOm9WfTolr+MQ/T9NlxxXx8KuCU1PmnM8k7QCSGyY jKBZCKaU+znHSnjLYE0G/ufUOmmthWG05Ib+2Kos/7SZ9DqB0rxKhcYK4s48xMJHBc/q KuZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736780999; x=1737385799; 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=yrBkAyqGMS8V2VSoket5Q8LogeyFHT+hq05EyX1hziI=; b=Gh/n52aOnbprU4EV9xjFpcIm/Z+jFKJLPxHTfda2UBvI1xvsMoCqVl9feWUx37nEii 7u6kyUk5DjbVvF2xHKkJCM61IA8GwRjnk9k9VNPuVhOjoR0oa0pcnbkMZ+Ysew6gx3rf 2bW2AIDpUODpHtkc2BNrgzSgWTortTJkTru/RXaiiPftRW3sri3kYEhK8gISNtOhbeVV h838vK9KcpeeUZR6v3Fg3pbSPJSxMSXmli2Ieh45Uc5do2cPyG68dPMigZhutygS33Eg uLQlxAxAbQ3pfrtf9mLooWiCo6+t6Kd9KY6Xsj2AhR4e6zGT4GvicRTO2usPt7MrWJ9w dhXw== X-Forwarded-Encrypted: i=1; AJvYcCVHOn3Ib1bWKpKEfWaet2PMxSzGNkBmmOh3f2x32sSY+RgjHlifQ2aZKcs4F8f/S1qJHSvNVmACLT5/vnY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw5Xysjh9AI75j0yKZeFZDxh2Mq0u6yKZac+tEaVBIs7I9O/K84 wRkBckWG34M8CX7bye+mh0k0+6GjeovFgM6ZHDfjqR8mTwMwZgtjsZgo7nsQO3c= X-Gm-Gg: ASbGncuzZlfJjUufZ7mYA0ZW+Dh6kRp4o67seSQG34qgEv9/zHUuSm0vdtk4PQxdLXX Kvnp479SrvXjrVzQ4splBGl9NYji3RoWW8xlk5eXFg2iv9ke4wdmU4mbhwxqRIe+FnSqPgAo/dB OqFO+M6xEV9hASutJzyya90Wjyw5igp7NKv43ozQz20mdz/92T0Wczhvmy0XUaEEf8j/qO6H92X TRMX6THkIvud9x3PnjWwbXKRdg+4GWyvKSArTeEcDYJ9ZT3c2BT6GCCU7CMUtfS6XG3HH/JqJ2U nd9qha4MP6Gho7GpwOFZ+/Q6D38V0vewXDbtT8U= X-Google-Smtp-Source: AGHT+IGfPH54n4jg25Exlw8FAYVNncyhxePsJ8eA3RiB3a/wcXqKMqGrQ7KsPaB5LXBOZKh8ij+1/A== X-Received: by 2002:a17:90b:5487:b0:2ee:f80c:688d with SMTP id 98e67ed59e1d1-2f5490bd537mr30669805a91.25.1736780998974; Mon, 13 Jan 2025 07:09:58 -0800 (PST) Received: from J9GPGXL7NT.bytedance.net ([61.213.176.56]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f54a26ae2fsm10193120a91.9.2025.01.13.07.09.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Jan 2025 07:09:58 -0800 (PST) From: Xu Lu To: daniel.lezcano@linaro.org, tglx@linutronix.de, anup@brainfault.org, paul.walmsley@sifive.com, palmer@dabbelt.com Cc: lihangjing@bytedance.com, xieyongji@bytedance.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Xu Lu Subject: [PATCH 4/5] irqchip/timer-clint: Use wmb() to order normal writes and IPI writes Date: Mon, 13 Jan 2025 23:09:32 +0800 Message-Id: <20250113150933.65121-5-luxu.kernel@bytedance.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) In-Reply-To: <20250113150933.65121-1-luxu.kernel@bytedance.com> References: <20250113150933.65121-1-luxu.kernel@bytedance.com> 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" During an IPI procedure, we need to ensure all previous write operations are visible to other CPUs before sending a real IPI. We use wmb() barrier to ensure this as CLINT issues IPI via mmio writes. Signed-off-by: Xu Lu --- drivers/clocksource/timer-clint.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/clocksource/timer-clint.c b/drivers/clocksource/timer-= clint.c index 0bdd9d7ec545..8d73b45f9966 100644 --- a/drivers/clocksource/timer-clint.c +++ b/drivers/clocksource/timer-clint.c @@ -48,6 +48,12 @@ EXPORT_SYMBOL(clint_time_val); #ifdef CONFIG_SMP static void clint_send_ipi(unsigned int cpu) { + /* + * Ensure that stores to normal memory are visible to the other CPUs + * before issuing IPI. + */ + wmb(); + writel(1, clint_ipi_base + cpuid_to_hartid_map(cpu)); } =20 --=20 2.20.1