Received: by 10.213.65.68 with SMTP id h4csp3065231imn; Mon, 9 Apr 2018 13:46:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+dEuz58vkI8024Ot1P8sF6eza+xlbg6WFVOG6FJBWjhRT/zh7UJfodsKj6XQXMtU2vO4DY X-Received: by 10.98.244.6 with SMTP id r6mr362297pff.242.1523306782289; Mon, 09 Apr 2018 13:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523306782; cv=none; d=google.com; s=arc-20160816; b=ouD7ItDwf1mKEpUYd6CNFT885wvRyU4XdrxvFBpD6F2DBBJNURHLXlXA8hXnBXIEEq T5PcnN3PJMVqYM91/TSOEfJsIB/Lg3qSDadkTB0wa2zfsTAffU60JPaJX3kmXtMGVzAf spxEBHL7P9/3vzrDdV8mZEHiH9/ZWp2e4xv/HxzfCd63PKZmh1RrN3LCT2QGjQ3lgHMM 5zb3wAPHqtHEyAuDinKKbF2xuOW87sRg9IFEw90SV8wcXn2ZqOyAqHMXQWeFvPMJDESg wAcHoipa/J15TeudglGrkMhk6IGEXef6i1bV6ZnhQv2WXOQBMSc29Y6IJYyo8fPJaBAq 21wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=QI+A4TTeBuh3T5wQtyjh/byI5oYLbXFwSoKLZDr/fNg=; b=Nj+nY2ty3OaO9MsM9Muv0bX8BY4hrlHwAH/bRr1HLgBEEtuuPKpm5vgFrt1QuOzQdg iUVePKFluFZBMW/zaS0m22XhQTqHN/tfY28L2gdAlNUbDX9KukxNjlt/jUYYArLtDe9b nwEJGP9o93C6MwMK0+FM5ETAPKr2i8sGv/AfRu10kHPXdjgGbTQ1eyAKj5G9d/XkGr2n 7Ec0bS1nvR0MBdEdeaA/in2yVZ3wadIzL/4yh/ilvMMHyfumujrY/HyDetg2RVKWpxLA EsazPoeW7iUF36jCa3QmqWuRlTMSBppBxR3kzGBhblU6MgzEeeyBjg9x2jDIu6/6lt92 27tg== ARC-Authentication-Results: i=1; mx.google.com; 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 186si701627pgi.821.2018.04.09.13.45.44; Mon, 09 Apr 2018 13:46:22 -0700 (PDT) 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; 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 S1754482AbeDIUmj (ORCPT + 99 others); Mon, 9 Apr 2018 16:42:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:45754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754388AbeDIUmf (ORCPT ); Mon, 9 Apr 2018 16:42:35 -0400 Received: from saruman (jahogan.plus.com [212.159.75.221]) (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 4FE9721785; Mon, 9 Apr 2018 20:42:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FE9721785 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jhogan@kernel.org Date: Mon, 9 Apr 2018 21:42:29 +0100 From: James Hogan To: Sasha Levin Cc: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Paul Burton , "linux-mips@linux-mips.org" , Ralf Baechle Subject: Re: [PATCH AUTOSEL for 4.9 173/293] MIPS: Handle tlbex-tlbp race condition Message-ID: <20180409204229.GE17347@saruman> References: <20180409002239.163177-1-alexander.levin@microsoft.com> <20180409002239.163177-173-alexander.levin@microsoft.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0QFb0wBpEddLcDHQ" Content-Disposition: inline In-Reply-To: <20180409002239.163177-173-alexander.levin@microsoft.com> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0QFb0wBpEddLcDHQ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 09, 2018 at 12:25:09AM +0000, Sasha Levin wrote: > From: Paul Burton >=20 > [ Upstream commit f39878cc5b09c75d35eaf52131e920b872e3feb4 ] >=20 > In systems where there are multiple actors updating the TLB, the > potential exists for a race condition wherein a CPU hits a TLB exception > but by the time it reaches a TLBP instruction the affected TLB entry may > have been replaced. This can happen if, for example, a CPU shares the > TLB between hardware threads (VPs) within a core and one of them > replaces the entry that another has just taken a TLB exception for. >=20 > We handle this race in the case of the Hardware Table Walker (HTW) being > the other actor already, but didn't take into account the potential for > multiple threads racing. Include the code for aborting TLB exception > handling in affected multi-threaded systems, those being the I6400 & > I6500 CPUs which share TLB entries between VPs. >=20 > In the case of using RiXi without dedicated exceptions we have never > handled this race even for HTW. This patch adds WARN()s to these cases > which ought never to be hit because all CPUs with either HTW or shared > FTLB RAMs also include dedicated RiXi exceptions, but the WARN()s will > ensure this is always the case. =2E.. > + /* > + * If the CPU shares FTLB RAM with its siblings then our entry may be > + * replaced at any time by a sibling performing a write to the FTLB. > + */ > + if (cpu_has_shared_ftlb_ram) cpu_has_shared_ftlb_ram was only added in v4.13, commit e7bc8557428f ("MIPS: Add CPU shared FTLB feature detection"). To backport this patch you'd need that one too at least (and I6500 support was also new in 4.13 so you'd also have to drop that case from the backport of that patch). There may be other dependencies too, I don't know OTOH. Cheers James --0QFb0wBpEddLcDHQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAlrL0DUACgkQbAtpk944 dnqzGxAAnk8FHAtfIuBnHAWn4zo52YiO17tEzqjop4yu1MSgmlzilTMq1ebc1ziz raCU6EBUPfvHxPsI+hFZs1IzyyGwNCCuvNdXH5L99FK/fku1sLzMm1wTP3cCiVaF 5G8ysaeZedI+QA5DkyV3O32otpmmTCEauog6it0nNSuazQ4vGHlEMey0HfVPFTal ssGDCUGrigjsg2zyHZ50UzWjpcxXLHwR6xtSiipi1s9K2tRp07Ivj4N2cMO/qNqW /qEY7lwEwj1o+uKO1lVzwF/r9H6To0C+okmA3D/5E2YH4ZfL/w1RjBcZcxC2iabX V5HS5A21j9kx5gnPPn3/ynJ/wigisOFZk8cPJehwsF2NYTLgWxFD+nOislhi5n3m N6oCW2+g6E4qJCXWeJazJ2ooN/LZ4r4qEk/0EKzq+Bc8nYbr1mS1eTlVxC5/pAdZ qAZWAvWNh3NCFqTWinue5o0903ddIdOZ3Ovy1/eiyO0Ln8pyZhdrpYxZdurAujL+ 3fQxh/BwkSmtx6leX9brwE4QJNEzngmjWcqAVM46OHXGrTgLDr4Njt9kpHFItrKa OIoB+Wp6iXFy9I4/XIcZuV+SUaIhv6C2LVxxMC9Vy7JVGoVA9Pvp2q3Zssa6fYob TXwYhAIbdCtTjvtxlVT67GPvYMEoZSXxgR2o0AOg9z2+mf1UGHM= =UWpd -----END PGP SIGNATURE----- --0QFb0wBpEddLcDHQ--