Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp210894ybh; Mon, 20 Jul 2020 14:41:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzawCUMSeJwyDQ86jONClz8kX226hG6mTndKCPnGqMIRpPEcuEvkUQEozxPhYJPFLpPu4e4 X-Received: by 2002:a17:906:95d9:: with SMTP id n25mr23008764ejy.437.1595281269463; Mon, 20 Jul 2020 14:41:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595281269; cv=none; d=google.com; s=arc-20160816; b=IoMeFycdIvhueOkVMp/tXnF05ZuzfEtIYU+KlDLgbaS8cq/rcMtaDfv/BuZzPo0t/F zqIvrOTYZGKvsjqH5TtnvU6PcYIyAWKzkn/SHX+saMF3/BuL/aU5pl4O8o8yYskuWeir OFDB1hrMziWK8RAhv7tlKYrfUCPlqPwOFbh46d0T28pU4rZg4pg/G9uUmTN8XjJpgCWI iESpHpKU91HlX4rJ5D2bZDlf+bDEs41DXip1136auhcdzhGki9xCt5SkrR3PIPhcb6a1 Fw1c6BYbvwmX6n0cnt+gnokfdkkGs0gfkcncuv9/VmoK9ySpW64GwL7HxnaJqSoX6rMD zVeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PK4UsbvkJegmKoIT6vH0/T+v9scdz+5X6EFwcYRI66g=; b=rb1AfuqG/afA+K88tzYUUOFig6s+NZrtcTxRLT8qMcQJtQxyBpzEhdXXvn0Wc5nPbB cay9gLYS3DRDnikKG+t+LtE4B2CEOheBsqEFP7gt7yYVJ+36XhKvTixqvkWOi081vQuu Y2PRPnw7rmuscj7tE9ZX/cQIdLlO2iiaBaiPnRb8Me5auOqwZK05avbHQGZay2HZYlkG VTMPlbNHHeZ6NkDs8E53r8eyXVU+9Ncmm/VIV+trnrdyWAQlHmpQCpRwACiM5wcqlQuq 82dS0Tyn/0uMZUMVeyets+466m9UnU9opB3rvQ17qKLLdeMXYTgQzU8ixoWgNCXbjtr4 J89g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QpLciazk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id op20si7438184ejb.717.2020.07.20.14.40.45; Mon, 20 Jul 2020 14:41:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QpLciazk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728584AbgGTVjw (ORCPT + 99 others); Mon, 20 Jul 2020 17:39:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:58494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728393AbgGTVjN (ORCPT ); Mon, 20 Jul 2020 17:39:13 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 39D0822BF5; Mon, 20 Jul 2020 21:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595281152; bh=GGUUnrT70vCshPJghf6krsi3BKNCu8O77QYQpIvqC9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QpLciazkAdfgR7dOUbS+nFL1d/PUAbhcn+XmkuiBRdHyRebVLjSpKdAf95EEySc7o q17iWBUiOOgDmzQ/xSr0zOuubzLkJoUF+u76pcVkP4oDIjZia31nwBJnAzuv2A1HIE opp5xt0xgesYFj4c/e8j86Bg/hD+NUSAwPxgXMCU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Palmer Dabbelt , Sasha Levin , linux-riscv@lists.infradead.org Subject: [PATCH AUTOSEL 4.19 18/19] RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw Date: Mon, 20 Jul 2020 17:38:49 -0400 Message-Id: <20200720213851.407715-18-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200720213851.407715-1-sashal@kernel.org> References: <20200720213851.407715-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Palmer Dabbelt [ Upstream commit 38b7c2a3ffb1fce8358ddc6006cfe5c038ff9963 ] While digging through the recent mmiowb preemption issue it came up that we aren't actually preventing IO from crossing a scheduling boundary. While it's a bit ugly to overload smp_mb__after_spinlock() with this behavior, it's what PowerPC is doing so there's some precedent. Signed-off-by: Palmer Dabbelt Signed-off-by: Sasha Levin --- arch/riscv/include/asm/barrier.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/barrier.h b/arch/riscv/include/asm/barrier.h index d4628e4b3a5ea..f4c92c91aa047 100644 --- a/arch/riscv/include/asm/barrier.h +++ b/arch/riscv/include/asm/barrier.h @@ -69,8 +69,16 @@ do { \ * The AQ/RL pair provides a RCpc critical section, but there's not really any * way we can take advantage of that here because the ordering is only enforced * on that one lock. Thus, we're just doing a full fence. + * + * Since we allow writeX to be called from preemptive regions we need at least + * an "o" in the predecessor set to ensure device writes are visible before the + * task is marked as available for scheduling on a new hart. While I don't see + * any concrete reason we need a full IO fence, it seems safer to just upgrade + * this in order to avoid any IO crossing a scheduling boundary. In both + * instances the scheduler pairs this with an mb(), so nothing is necessary on + * the new hart. */ -#define smp_mb__after_spinlock() RISCV_FENCE(rw,rw) +#define smp_mb__after_spinlock() RISCV_FENCE(iorw,iorw) #include -- 2.25.1