Received: by 10.192.165.156 with SMTP id m28csp78163imm; Thu, 12 Apr 2018 16:59:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx49P/vaPb3H4jsA16Bt3SUhVvR7Q5Rxvd6MuNsZ/0F/jE69srsbtqnIoC6eRRPp5hsVUyTtb X-Received: by 10.101.96.205 with SMTP id r13mr2263427pgv.427.1523577568498; Thu, 12 Apr 2018 16:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523577568; cv=none; d=google.com; s=arc-20160816; b=TQdFb+ZwJYg//gpmQK735s9U3hwMJI6H8FQNZB34xTUrl67+whCoy7XBML3dgkqtXc hjkQ3penKyQtK2YB9pVmL6U+a9RbI8gLJ9f+Whlg82Re+WPJNZU6C+eRB3Ovwj5UF73S MAFr0XRnX52DtRbMuROE9RRio+Xi6bvi2vIcTx44hbZZ8+0/RGervm4WfchBbBN52TJt cyV+frUFkBV2EDGczuXTImJ5Dwba+GNFQJW2Arlw/jtHfkp++WfJAEWNOQYsjFjEw9yz ucaiZX49Dmb57rZM8AkSsRKAj1+H2z51z8UVyg/OLJ7XgofmM/UCMrm4EipmXwOHNoBQ MKjw== 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=rHdPh6XyhX9CILXE+DmgsqLwHqixuT4Z/xD7WlB8xkw=; b=NYxdICntQaHXrpRnUI0MlS1RWXbF8JG+gT2g0x7cF7iN+WhyniMAYghWuwBsE6FZ4/ dq7WgxXq7QDua1e3/gHAQk7p0OXgbUYjGLS+jRvbSQpJizp8gMq7BC9e68NWeULtPSnx qjMuvKTW/eQAuDhxSUfBV8MFB+1atXCK7baQZJUP6A1GTcHI8KZ405crKNOscCCU/86O 1Hhuo7CaKR2M595xlgqOigIADlv+CmSKzvT2EFsa2+nw/y+Om1qG5CYn2Qs8JPB1gNcW Huk+SQM7YAzD60hLP3BXJa5LbwbMOT03AwpGJibeOPfEi9D5/qlsBvkK6XImhN42Umau SVwQ== 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 e13si3286978pff.238.2018.04.12.16.59.14; Thu, 12 Apr 2018 16:59:28 -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 S1753423AbeDLVv6 (ORCPT + 99 others); Thu, 12 Apr 2018 17:51:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:39770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753306AbeDLVv4 (ORCPT ); Thu, 12 Apr 2018 17:51: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 5F30521777; Thu, 12 Apr 2018 21:51:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F30521777 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: Thu, 12 Apr 2018 22:51:50 +0100 From: James Hogan To: Sinan Kaya Cc: linux-mips@linux-mips.org, arnd@arndb.de, timur@codeaurora.org, sulrich@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ralf Baechle , Paul Burton , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] MIPS: io: add a barrier after register read in readX() Message-ID: <20180412215149.GA27802@saruman> References: <1522760109-16497-1-git-send-email-okaya@codeaurora.org> <1522760109-16497-2-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9amGYk9869ThD9tj" Content-Disposition: inline In-Reply-To: <1522760109-16497-2-git-send-email-okaya@codeaurora.org> 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 --9amGYk9869ThD9tj Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 03, 2018 at 08:55:04AM -0400, Sinan Kaya wrote: > While a barrier is present in writeX() function before the register write, > a similar barrier is missing in the readX() function after the register > read. This could allow memory accesses following readX() to observe > stale data. >=20 > Signed-off-by: Sinan Kaya > Reported-by: Arnd Bergmann Both patches look like obvious improvements to me, so I'm happy to apply to my fixes branch. I'm guessing the case of a write to DMA buffer (i.e. reusing it) after a MMIO readX() (checking DMA complete) being visible to DMA reads prior to the readX() is precluded by a control dependency (you shouldn't reuse buffer until you've checked DMA is complete). But why don't we always use wmb() in the writeX() case? Might not the cached write to DMA buffer be reordered with the uncached write to MMIO register from the coherent DMA point of view? I'm waiting on feedback =66rom MIPS hardware folk on this topic. Cheers James --9amGYk9869ThD9tj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEd80NauSabkiESfLYbAtpk944dnoFAlrP1O8ACgkQbAtpk944 dnrpqw/8Dad0DiqnZB1K1nVKd3NAh/IRYNJCN/21AB9iuHjz+EjRP/jRgL3DdbtK 0dsYb8zpgOhY6oGdNqSdfjD51W3+2a53fAaGMO6sIeEBYrukRKKMTLPxAbA0XmxR K6hwn2KGhWcRZvIOFVmTmg3Yac6xXDybfViABG0apVJaeVIzG1gZ5R6qD6HnZezU OM9caiJ5PedkSd4lvfWjV6E/azqUd/nZJujs11/CKmAe5LbNtddQP9UOa+AuYqzb XzFRXia7IwnqaoksvNyu3fFqcH7QEE0RutjwZvgIIfehLc+msENq+bAl13C1lCoU IBszadUACPGcQDericA7fAj8tGomQjlYFsLKtooSUMKqU4aweNlk5f2eKzL1ohP4 imZ8gz4q8PeLvG/RINyD0+QQ3AE3OSvcQTdXQ4LB9Rc3vpPcxPQIzTpWd+pxuhCu bLUsxlOQC/eiuBYUoIyGDzzn9jcd/L5uGotIEtlfnvlkg+XvGrOQXw6Glw0rL4v0 Z06tsNeUZszbYf3YUIeg+ywaHXAJhQ1pqPZMlXh7qQvwnRi/Nhs9A6ptd7oG72No W1sEJ+PUjtN2pDT/fEbjKx7QFpAd91Bw/oyAoZPSFk0co00C656ROpZ1LxMLu52k mmrHohv8XaiW+1dtt5OGCdxRjh7gXMJVeN7rFuPu542EexH+mLY= =191/ -----END PGP SIGNATURE----- --9amGYk9869ThD9tj--