From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78E5D149C53 for ; Mon, 27 Jan 2025 16:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737994985; cv=none; b=KL8AhK9Oj0HyfozbAml+XTNg3FfCAl7ZEarjSt5Z9ZV8P5FvDIuG6d9TIZ3DDnlPP0GEWFQeKXnhl7cjdDMpRATk9JXBrAC7EoNpXlRbi/jPpq9ECURuWpLtIfVcOyYil7zg4JUkiBIsi1yvuw2AqOdP3aQ/DEc+ieT0+cWZrW0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737994985; c=relaxed/simple; bh=Gclvmqq1vjGUU/MEBjmnvxgGNoRxHLCFm+FZeNGGr3o=; h=MIME-Version:Date:From:To:Cc:Message-Id:In-Reply-To:References: Subject:Content-Type; b=qW/BMrYDaN8K4bhcN3Vpyq4mPOfafL9Q2yUGSae5QSFyBJDiF7QQw/Hy0DD7DwEDwY2xAJIP2wDmaXEXoSe4DlZ+T/rXEE/8OzTzoRtx9uWxVyh1M90jd/6xlWUbJHXK+BxtX1BrtErILal194W+mfFpoXAPyDBnU+Dw7synLV4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=zouG8SAm; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=bW2LJgmd; arc=none smtp.client-ip=103.168.172.150 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="zouG8SAm"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="bW2LJgmd" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 61E6F13801E9; Mon, 27 Jan 2025 11:23:02 -0500 (EST) Received: from phl-imap-11 ([10.202.2.101]) by phl-compute-10.internal (MEProxy); Mon, 27 Jan 2025 11:23:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1737994982; x=1738081382; bh=ApVJqWJrmAI+GPk+oFV8g7rgJ0iBONaFFyXlKmkLfs4=; b= zouG8SAm1KWB2csr0aKKjF77qSzd2OYDy0xGnQrmnZKSWN1D916uQdppeKlHxXoX Yq+vx5nCbHh4E9KsLQN9tHiHbRgJJH8v3x9VYmAE9IhEdMEx5tQK+iTVrA1oy1rc A4WcKTaCNyNVJxdfG+SDj2CBS5FQPYK40dun8Kp+YZr0SKtJcSkHZbkVLgdVS3Kp nEkz8FnQwzPFB9XZCSDigRHh/GhRGkmISMLgmXafey2epOcAvjBAKC3dYB8f0x2W ODG7STA2YwKADnfvHaeHY29vovk76VHCAwrGA+ULkKBEpj0AGrNfkff/U5FfM3NU P1rmxF5SctX3ksCeBkdDqw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1737994982; x= 1738081382; bh=ApVJqWJrmAI+GPk+oFV8g7rgJ0iBONaFFyXlKmkLfs4=; b=b W2LJgmdgeGsMyCnWZDAPHla8B3nCuhP7H2HgwxZRlrZZemDx86CMWEQK1Pur9Khs MmN3JJtv35Dibajhtb2gFzfGJxT/wYevvB44FbcMutRegnD/J4ordet4dcT1ZKTh 0NmjIC7IEuC0u84EwvQjRHKnaxFOTG0dmCTA/bWFpMdtvx17hMMRNVsV8r7Zoqvs aRQYEpgiOExwwC5PdlsZ0q0ICOFKNJYZlYQ8PRtW0A94mY9+23jCNSH+xp0IkLUG lqmXdmkCLXJ1B/iIu8TJd03cfTlB5XhaLUhdldnpDRru1nMqOFRNJCBK+rnX3O6N Zwk7wz7pB3NtnFIR7Ad0w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudejgedgudefieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvfevkfgjfhfutgfgsehtjeertder tddtnecuhfhrohhmpedftehrnhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnug gsrdguvgeqnecuggftrfgrthhtvghrnhephfdthfdvtdefhedukeetgefggffhjeeggeet fefggfevudegudevledvkefhvdeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprghrnhgusegrrhhnuggsrdguvgdpnhgspghrtghpthhtohep uddtpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegrnhhuphessghrrghinhhfrg hulhhtrdhorhhgpdhrtghpthhtoheplhhihhgrnhhgjhhinhhgsegshihtvggurghntggv rdgtohhmpdhrtghpthhtoheplhhugihurdhkvghrnhgvlhessgihthgvuggrnhgtvgdrtg homhdprhgtphhtthhopeigihgvhihonhhgjhhisegshihtvggurghntggvrdgtohhmpdhr tghpthhtohepphgrlhhmvghrsegurggssggvlhhtrdgtohhmpdhrtghpthhtohepthhglh igsehlihhnuhhtrhhonhhigidruggvpdhrtghpthhtoheplhhinhhugidqrhhishgtvhes lhhishhtshdrihhnfhhrrgguvggrugdrohhrghdprhgtphhtthhopegthhgrrhhlihgvse hrihhvohhsihhntgdrtghomhdprhgtphhtthhopehprghulhdrfigrlhhmshhlvgihsehs ihhfihhvvgdrtghomh X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 9C8572220072; Mon, 27 Jan 2025 11:23:01 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Mon, 27 Jan 2025 17:21:46 +0100 From: "Arnd Bergmann" To: "Xu Lu" , "Thomas Gleixner" , "Anup Patel" , "Charlie Jenkins" , "Paul Walmsley" , "Palmer Dabbelt" Cc: lihangjing@bytedance.com, "Xie Yongji" , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Message-Id: In-Reply-To: <20250127093846.98625-1-luxu.kernel@bytedance.com> References: <20250127093846.98625-1-luxu.kernel@bytedance.com> Subject: Re: [PATCH RESEND] irqchip: riscv: Order normal writes and IPI writes Content-Type: text/plain Content-Transfer-Encoding: 7bit On Mon, Jan 27, 2025, at 10:38, Xu Lu wrote: > RISC-V distinguishes between normal memory accesses and device I/O and > uses FENCE instruction to order them as viewed by othe RISC-V harts and > external devices or coprocessors. The FENCE instruction can order any > combination of device input(I), device output(O), memory reads(R) and > memory writes(W). For example, 'fence w, o' can be used to ensure all > memory writes from instructions preceding the FENCE instruction appear > earlier in the global memory order than device output writes from > instructions after the FENCE instruction. There is nothing risc-v specific in here really, it's just a bug in the driver: writel() means access the mmio register with appropriate barriers, while writel_relaxed() is a special case that should only ever be used if a particular function is sensitive to performance and never needs to be serialized. > diff --git a/drivers/irqchip/irq-thead-c900-aclint-sswi.c > b/drivers/irqchip/irq-thead-c900-aclint-sswi.c > index b0e366ade427..8ff6e7a1363b 100644 > --- a/drivers/irqchip/irq-thead-c900-aclint-sswi.c > +++ b/drivers/irqchip/irq-thead-c900-aclint-sswi.c > @@ -31,7 +31,7 @@ static DEFINE_PER_CPU(void __iomem *, sswi_cpu_regs); > > static void thead_aclint_sswi_ipi_send(unsigned int cpu) > { > - writel_relaxed(0x1, per_cpu(sswi_cpu_regs, cpu)); > + writel(0x1, per_cpu(sswi_cpu_regs, cpu)); > } > > static void thead_aclint_sswi_ipi_clear(void) > -- thead_aclint_sswi_ipi_clear() seems to have the same bug, it also uses the _relaxed() version for no apparent reason. Arnd