Received: by 10.192.165.148 with SMTP id m20csp1221288imm; Wed, 25 Apr 2018 14:48:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpXZw8YYxJw2F1h6lYEk5H18VX7Xc9Kw91zpSvkZ8HrgWJJbNE5VFJq8+w34jslXejE/SYv X-Received: by 2002:a17:902:5382:: with SMTP id c2-v6mr8406868pli.335.1524692905957; Wed, 25 Apr 2018 14:48:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524692905; cv=none; d=google.com; s=arc-20160816; b=Mz4/HPNRN0bh+nfnFR197fpvQHtNcilY778uGwnTwTOSPsFGdOprunwqaZyhnEZFdk gNpYBESZEwdEaCdYwTxdf04W753s0ZBXBfiRjmoVgqwBKrzWbeZDc7AoEIDLlAtyrliW JEntsz7XJWRwV/Rc2n63WmksBTIfHg1FsDViFPO7BILxa4QrhvlLxO04FMXljKJsQuMm RuQJW7T2PEdeK3EIuf1WyyL4/Be9SR5gMTlzJIBNwlUaLIHxLk/w8gKwHn+pUaEB+vNc ha3RnIJwRiV/+1ml3sQikp72AsRu39LeS1MdRZjiCfTKqZJW+UxWqhrZk5Mtpb2h1mfY xm0A== 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=C+gbUSTJHtVtaKuUWg4NfG2Z/elGvKUc6tS4I0SvKLI=; b=roXiiuv8TPWP7utIvsn94uP8z2TmLVom88AGKam7ytNcP4EDjn6NB2TJzMNvJpf/h9 kI0XkOJ+6mFY+8h/mLMZUx+dUFRtYT/gqcj6neu8A4zuapSffYMttwGCrPwVq3sKxGN7 JuznloEBtJ7yqnK4k6QPgIFLcxIFSvRxXhCWcMYMsMlnGtk3i5jcCn+245SE64zi8DfB 9+/pAq+e8rO+AFw0It+fvXBP7fiBaq8X/wr3xO3U0hJ16zPToIo28nAGc84RnBbPybP0 UTkQSuDdueRjvv9PyeP3/butIeHpRX+7UM92I1q5b/sMSutmTY04Wfld1/RtDfoQzFPL vVRQ== 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 i4si14725695pgn.433.2018.04.25.14.48.11; Wed, 25 Apr 2018 14:48:25 -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 S1753247AbeDYVrD (ORCPT + 99 others); Wed, 25 Apr 2018 17:47:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:36346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbeDYVq4 (ORCPT ); Wed, 25 Apr 2018 17:46:56 -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 E37D1214D5; Wed, 25 Apr 2018 21:46:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E37D1214D5 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: Wed, 25 Apr 2018 22:46:51 +0100 From: James Hogan To: NeilBrown Cc: Ralf Baechle , Paul Burton , linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] MIPS: c-r4k: fix data corruption related to cache coherence. Message-ID: <20180425214650.GA25917@saruman> References: <87sh7klyhc.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline In-Reply-To: <87sh7klyhc.fsf@notabene.neil.brown.name> 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 --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi NeilBrown, On Wed, Apr 25, 2018 at 02:08:15PM +1000, NeilBrown wrote: > Cc: stable@vger.kernel.org (v4.8) FYI my preferred form of this is: Cc: # 4.8+ > /* > * Either no secondary cache or the available caches don't have the > * subset property so we have to flush the primary caches > - * explicitly > + * explicitly. > + * As Index type operations are not globalized by CM, we must > + * use the HIT type when CM is present. I don't think Index type operations *can* be sensibly globalised to separate primary caches, since they directly index the lines in the cache rather than any particular physical or virtual address, so this fundamental issue doesn't sound specific to the CM. I'm not entirely clear OTOH whether there are any non-CM r4k-like SMP capable cores that don't have coherent IO or inclusive caches. - Octeon doesn't use c-r4k and has coherent IO - Netlogic appear to have coherent IO=20 - Loongson64 have inclusive caches - bmips, only bmips5000 appears to have multicore (not just multi-thread with I presume shared dcaches), and that has inclusive caches So I suppose that does just leave non-multicore and CM systems as potentially reaching these bits of code... > */ > - if (size >=3D dcache_size) { > + if (!mips_cm_present() && size >=3D dcache_size) { =2E.. but even for CM systems its only if there are foreign CPUs running (i.e. not just threads on the same core sharing the same dcache) that it actually matters. So I'm thinking "!mips_cm_present()" should probably be replaced with "!r4k_op_needs_ipi(R4K_INDEX)" (and the comment updated to mention that IPI calls aren't implemented here). That effectively means: !CONFIG_SMP || cpumask_empty(&cpu_foreign_map[0]) Otherwise the patch looks spot on. Thanks for spotting this! Cheers James --nFreZHaLTZJo0R7j Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQS7lRNBWUYtqfDOVL41zuSGKxAj8gUCWuD3SgAKCRA1zuSGKxAj 8jxaAQCjN7fGjCbL9rA4R+BAfse5BLH8yfkHr3MGSlqlg1WdgAEAvcze6SBWRFlC LxHvEdBgz+wy9S+LYgU2ERRG62e6FQ0= =j2yT -----END PGP SIGNATURE----- --nFreZHaLTZJo0R7j--