Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4878566pjb; Mon, 27 Jul 2020 07:26:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQmrkFSMv80ai1RS/ocInOdDd3YIt7m12SqNlNWw2jrWC9NVUoJRQJg4UgyBMuetdH3YjG X-Received: by 2002:a50:ed15:: with SMTP id j21mr22279593eds.246.1595859975162; Mon, 27 Jul 2020 07:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595859975; cv=none; d=google.com; s=arc-20160816; b=NdapaVlDuxdjUks4Xjh12fm4I+iM4t3+0Ob14XROHFYZjpJ+WPqP5R0Gp/GkuAjx7I BsNl7Zp2F/rcX3J7rz/gjPFoTEC0/DvoIbXz5oOWONTgbruwQWK150NpvW/SsjZ3bJrb JEqpL/7Cl4MQLm9i6HxhM/HY9nmwM74hoWveWNEKDtX9ldBsf5XrN/LafDDAOn3Rn2OI duXAzYX+X4sRSPUCHpvsyxEawPZ+fcC/bEHvjJ0qaFahmD2AR9DKzDCMGhMCylaolkNT Q26W9IhxUnTr9Vq4U1n2CJgHR7jMrjDgq30xDmrNsFZLsClWZ5C99oJq0jUaBBhkRq12 8h9Q== 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=c+xjkQAf6vpufYyEVJ4WStquwHoXEjGjTxawyasWWuE=; b=swZ+Q2q/5oc9RZomb6HSJ1fO2juSKwfZyIVGWPx7nVbJyKXpQSxPNS4hTu7Szz6B5z zTdItpQyrST8PDduhbmH23B7nIYpBktTU40OByWLph2RVTZUE9Tb7PyVfv/5S7qfe7rO bpIUKflA7a/xI3kh4AhUHqP2IV4tnA3z+ZA2fkn8BNmfU3XLsi+zWDdgoadXfI9vwYRn QpH50pCNtxtknX1yyrpmTUTwn9i1I+0I38co2ESIig33PPxmtoo6cC8bO+MFy2GLUGQY 7OOihYLdZzQmyQoiTLouMvgERtAJJVZVYTf9QZWhI3wwcB5F+O9CE+qkfPsTuxOdLTCr Acbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XfogZUZ6; 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 b16si831753eja.517.2020.07.27.07.25.53; Mon, 27 Jul 2020 07:26:15 -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=XfogZUZ6; 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 S1732290AbgG0OYf (ORCPT + 99 others); Mon, 27 Jul 2020 10:24:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:54104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732202AbgG0OYc (ORCPT ); Mon, 27 Jul 2020 10:24:32 -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 EF2272083E; Mon, 27 Jul 2020 14:24:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859871; bh=MutjSMAafDXjPRebpjYD2MZe+oGnDIbyaCZJHeddI8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XfogZUZ6rH7QemqeXIObsCuNoiYLja7sZWf3kOf8ZEpsIlwyyH8UGJX0CMmzvo5+b yQ/blLhReJHNLrHvqJnBQcbNA0oj1LH8wD05HqxgrNg1obSCD+hpTFecETFEivBwH2 XOalHOr965RBaxE/e44qqkt87enTah0PBu8ochzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Palmer Dabbelt , Sasha Levin Subject: [PATCH 5.7 137/179] RISC-V: Upgrade smp_mb__after_spinlock() to iorw,iorw Date: Mon, 27 Jul 2020 16:05:12 +0200 Message-Id: <20200727134939.307666976@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@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 3f1737f301ccb..d0e24aaa2aa06 100644 --- a/arch/riscv/include/asm/barrier.h +++ b/arch/riscv/include/asm/barrier.h @@ -58,8 +58,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