Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5577312ima; Tue, 5 Feb 2019 14:19:33 -0800 (PST) X-Google-Smtp-Source: AHgI3IbSSPhZlm4I/9uLwlMQVgKDcgxi/RTCVdNilBojxVEnPizdbOjX8/JWMOEpKH0Wluf/KhZP X-Received: by 2002:a63:5207:: with SMTP id g7mr6663707pgb.253.1549405173411; Tue, 05 Feb 2019 14:19:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549405173; cv=none; d=google.com; s=arc-20160816; b=iNLNSSsLSbr3/W2fkrusaLYJpdaU2IkfDg6E6k5uQ6zSbPgJiutlHREKnTaoWw9y1J ZwOSO/SAf+mapwtbtgg7BfRMtUFEK9zEMGHfZVWx2APPFie8pfCqrpz/isBEPvra/Rb6 ydlAQgDEkKw/fYOOqPAdva+JZLdNlFCMxpBNLE2BUaNqeJcUWS2sXD1UcalcZkki/GV7 zRbCgdSgaK+zZg4oN9kEq9W+gx9GpW00R4PK7LBv7Q/E1NFcLV7flKQM/PM4ECHIzx4+ fdqs+DGe+1Gv7iKwqLGUudOSC6n089xSP+X/tdG0BHOjIXjhR+I+IJGJq1S5t6KZQ1gs C5DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:subject:cc:to :from:date:dkim-signature; bh=X4lvvyam38GLCpa0pit/dcyoJDzh8hSmyA7X9bt4e5o=; b=oWwRTzA8qUOmrOX6JhpW9vtODtHjr28fYQiwijddCP7zh6PfNEKVyvQY5iIKw2QZbR 7ua9f4MqMS8A6tYe0mSW5cjpCNHl3okE+isYAU4xUcSw/j8JZs2kpJt3mksuwpAtOb6u 01HseTAAYkBd+fZTClIpQQDnREd6FR621Nnia31gXnT52zxXnvk29TQ7MbbRe7TfACK6 Vb3NFs33OeuPHSKfb4KcGlUSkxas9RLIi8zguvVbL7DFsVhBnzoZB8JnZgyrfnhBwyPb PnbDV/IUWD/nvN4dkZhqZGRaju9WaDPqhIKA31uE7ChSzjVjUJ5uiVTFbE7+4D8HIelo QsRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=qr5iMtgg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o19si4350962pfi.261.2019.02.05.14.19.16; Tue, 05 Feb 2019 14:19:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@canb.auug.org.au header.s=201702 header.b=qr5iMtgg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728644AbfBEWR5 (ORCPT + 99 others); Tue, 5 Feb 2019 17:17:57 -0500 Received: from ozlabs.org ([203.11.71.1]:56769 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726742AbfBEWR4 (ORCPT ); Tue, 5 Feb 2019 17:17:56 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 43vJqM2Zsxz9sDL; Wed, 6 Feb 2019 09:17:51 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=canb.auug.org.au; s=201702; t=1549405073; bh=T3kta/i70oBGGm6f1t4x/h/Ir2nlKA4hWIqlIdgGPtI=; h=Date:From:To:Cc:Subject:From; b=qr5iMtggHH4qBdDcz2Q/quA4B0codSn9xSFG49wA01NkkT9AUWWpmQ/Xo5MBOKkA8 rSUiIN2ZMJwp1cCyKj/KLww3yvt0Dkc6QVW69/An/bm709z/x+brz9fbaZ3ZxKUYEf gAVlQd1WwHCPiHyYmb65u5cn8n0yFCK5HjB3f47ehsdbg9yeFRIsgA+kmhQZJwReFv S7NKfwR6/mIWOGUZl9GOB2U4fWgyYwzZd0N1F6ZawbM5Fm6Ys8Rtneackilfk6sjCl lA1rca7bk7n0/s+H0lkeFkxMIpcVT6QzOIwwUO+5ZBz5iOmKyYyCxAOy0w6/nLaKRZ 9TkiDTDhCy60g== Date: Wed, 6 Feb 2019 09:17:36 +1100 From: Stephen Rothwell To: Ralf Baechle , James Hogan Cc: Linux Next Mailing List , Linux Kernel Mailing List , Huacai Chen , Paul Burton , Huang Pei Subject: linux-next: manual merge of the mips tree with the mips-fixes tree Message-ID: <20190206091736.73bd95ec@canb.auug.org.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/XXTD5u49pk6W=n13DKfhCzR"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/XXTD5u49pk6W=n13DKfhCzR Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi all, Today's linux-next merge of the mips tree got conflicts in: arch/mips/include/asm/barrier.h arch/mips/include/asm/pgtable.h between commit: e02e07e3127d ("MIPS: Loongson: Introduce and use loongson_llsc_mb()") from the mips-fixes tree and commits: 535113896e80 ("MIPS: Add GINVT instruction helpers") 82f4f66ddf11 ("MIPS: Remove open-coded cmpxchg() in set_pte()") from the mips tree. I fixed it up (see below and for the latter file, I used the mips tree version but wondered if cmpxchg() needs the fixups from the mips-fixes tree commit) and can carry the fix as necessary. This is now fixed as far as linux-next is concerned, but any non trivial conflicts should be mentioned to your upstream maintainer when your tree is submitted for merging. You may also want to consider cooperating with the maintainer of the conflicting tree to minimise any particularly complex conflicts. --=20 Cheers, Stephen Rothwell diff --cc arch/mips/include/asm/barrier.h index b7f6ac5e513c,b48ee2caf78d..000000000000 --- a/arch/mips/include/asm/barrier.h +++ b/arch/mips/include/asm/barrier.h @@@ -222,42 -236,11 +236,47 @@@ #define __smp_mb__before_atomic() __smp_mb__before_llsc() #define __smp_mb__after_atomic() smp_llsc_mb() =20 +/* + * Some Loongson 3 CPUs have a bug wherein execution of a memory access (= load, + * store or pref) in between an ll & sc can cause the sc instruction to + * erroneously succeed, breaking atomicity. Whilst it's unusual to write = code + * containing such sequences, this bug bites harder than we might otherwi= se + * expect due to reordering & speculation: + * + * 1) A memory access appearing prior to the ll in program order may actu= ally + * be executed after the ll - this is the reordering case. + * + * In order to avoid this we need to place a memory barrier (ie. a sync + * instruction) prior to every ll instruction, in between it & any ear= lier + * memory access instructions. Many of these cases are already covered= by + * smp_mb__before_llsc() but for the remaining cases, typically ones in + * which multiple CPUs may operate on a memory location but ordering i= s not + * usually guaranteed, we use loongson_llsc_mb() below. + * + * This reordering case is fixed by 3A R2 CPUs, ie. 3A2000 models and = later. + * + * 2) If a conditional branch exists between an ll & sc with a target out= side + * of the ll-sc loop, for example an exit upon value mismatch in cmpxc= hg() + * or similar, then misprediction of the branch may allow speculative + * execution of memory accesses from outside of the ll-sc loop. + * + * In order to avoid this we need a memory barrier (ie. a sync instruc= tion) + * at each affected branch target, for which we also use loongson_llsc= _mb() + * defined below. + * + * This case affects all current Loongson 3 CPUs. + */ +#ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS /* Loongson-3's LLSC workaround */ +#define loongson_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memo= ry") +#else +#define loongson_llsc_mb() do { } while (0) +#endif + + static inline void sync_ginv(void) + { + asm volatile("sync\t%0" :: "i"(STYPE_GINV)); + } +=20 #include =20 #endif /* __ASM_BARRIER_H */ diff --cc arch/mips/include/asm/pgtable.h index 910851c62db3,6c13c1d44045..000000000000 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h --Sig_/XXTD5u49pk6W=n13DKfhCzR Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEENIC96giZ81tWdLgKAVBC80lX0GwFAlxaC4AACgkQAVBC80lX 0GwktQf+NHMvhV4u4QOPoJGuHgHdQ5sWm44t4VZoLjQfYKDyggWvQG60erao0q37 WFWFbSx3aJR0R2KzMareFVzy+7p5vJbegJ2qqroNsR10t2sYo9TATDKofyykeEwA bxFWyJzCBSOB3yzUAne0Z+W9biYuta2K+bNxJLv/KRny0y+Jyh7r2+HXq0Rpi5hj KgOFbVVXZhWLeE1+MaJKDiF3V6ZvZN83WlJ96e1OMCjpDVEQB9griX8BpJA+FaXW 7DqkNr1uQXOsFCS28IuSwsk5jVEWSZ2Ochyo8chDL6thSagaj/9I50Pw1eAXdgLQ WWUl6CMaNjGxCVXhjxYBGfkbqu0pUw== =z9ev -----END PGP SIGNATURE----- --Sig_/XXTD5u49pk6W=n13DKfhCzR--