Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4868353pjb; Mon, 27 Jul 2020 07:13:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygDHj23slQ/8P8ecgCHoeWuRxX1KjU2EnrE7hpSzvqPtlpLalTsjqOWfC25+spz3mdRgWe X-Received: by 2002:a17:906:3bd5:: with SMTP id v21mr16767480ejf.329.1595859194336; Mon, 27 Jul 2020 07:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859194; cv=none; d=google.com; s=arc-20160816; b=eXEKgNu6YNX4H3CN5HyL6bvm8njZhuWmemvi6XxbgYz0c1DB/B0nYFOFYjvEqhAOQJ 2F8mwhRwnkv5zI3hJdhYyGzghc2uOzlx07qmGvSBYgXIfG7kTKpyjjA4o9Eaoyd4uPme kt+ybHweoZWOEVSitTNalg6SJNCTNGYohsBHscgMCSrB5uGpJX737ego0MSGUzGZDc1a 4IkLprYA4Qp4kY6U44AHtDCgkbhgb29KEG3yYRd3PNwiiJfYydmSLrFh5ilx+kui6MvS cwOYB6Uvdcyypc0RBh+3y5VK/fsZuxDh0ADKqyCVPCCdNIwgSUS/rwwBd8GLDptsGghj Fy1A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PK4UsbvkJegmKoIT6vH0/T+v9scdz+5X6EFwcYRI66g=; b=HxR9MJ9ZkkcRzetC6sOqq29HW1hNFDyRKXd7pXOO2iQe8IuEhtEJUqEHp/S4yDAMBZ PKJ9CXOqbfPtA+FrcDmANY88tV2dLbfRYgRQZNr4J2Rn0dTsIjiRgP47Vd/ynTmez32Q BCbb4z6aihE65wCcRDh6iaTaz3Cq7XA9McWc1k0/Jf9vnh5hV8Wkn5KF8T+88xpd8hEK CMfejbZ7yR6uqMrYDTiABOM+O+14XnDOufa1od6fINs/z+0sJ6u6NE5DLLnoDT53YRP0 oDAuRlTuxlnPEDgSxXeSyz/O3ovbMDvl1lGP3vIUMy5eqEABzHGYbUYQb5bbrKY9Pl0X ADOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b1XMcfOU; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj23si3282371ejb.482.2020.07.27.07.12.52; Mon, 27 Jul 2020 07:13:14 -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=b1XMcfOU; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730012AbgG0OLb (ORCPT + 99 others); Mon, 27 Jul 2020 10:11:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:35096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728654AbgG0OL3 (ORCPT ); Mon, 27 Jul 2020 10:11:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 909C72173E; Mon, 27 Jul 2020 14:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859089; bh=GGUUnrT70vCshPJghf6krsi3BKNCu8O77QYQpIvqC9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b1XMcfOUqsH2914v7EkcmuFkKoCZGHnSWmBFkpJ+KT+fxoBVNG6i79jmZSxFfsf7H RvZVCrZdbPm8Lxa3+7lgpuvTrvaVbyMJ+Cox8Oe+DrapeeuAGYASRQWqFyXyKjwfTY 9gJmWHZK+fJERgB0VSS0YvWlm8vuujbJPnYf3n6c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Palmer Dabbelt , Sasha Levin Subject: [PATCH 4.19 60/86] RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw Date: Mon, 27 Jul 2020 16:04:34 +0200 Message-Id: <20200727134917.444705980@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134914.312934924@linuxfoundation.org> References: <20200727134914.312934924@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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