Received: by 10.192.165.156 with SMTP id m28csp9069imm; Thu, 12 Apr 2018 15:25:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx48OK06MURgAnB/XWutxSe7fDt0T/7Vwfq8PWLLEsHzm/T60ETMi8zYpfAA6kTaNYQonyPXK X-Received: by 2002:a17:902:8283:: with SMTP id y3-v6mr2847718pln.10.1523571902455; Thu, 12 Apr 2018 15:25:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523571902; cv=none; d=google.com; s=arc-20160816; b=wqpjUeimOBGyOUW8NNGq2VqafVFJYVc9FhDNFNIwrgow8QshAniy6kckd0MI8JWJ3f qqNaJx2bgSwxv5hk7u4gTSiKatk/KKD3QWwF0v1p0Ij/PKS/vyDiuLPJRjFZ5qJ9uwQS cp31Vl/1jr1YjshsFz53HpgQhjTzyAt0gkLqAj/s2Fvs1zO/j6GoMKUX8kyKbCQusX+d 6t81OujdM3kTZUsHzEBxaPtlV2PIooLKWlDmx0IMLwRXFgi25f3TnRMXhwpJOCxLLRhJ EB1xKMAZ/7cvn74sJOAaXcWz76H6wE8JPlKcjjCxVjHGYD11lOxi/b/H9qbYjUitidet mZaw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=ZYSwZI71r4q4yYFyuQyG6XRRBqyDDGzw58GK38Zk3Dk=; b=QAlhAV/s3s9+CXOclQgjFl/zo1u1lYh7ah7wr5yzdyLY9sc3rTU0Tcp0pvlrFBxFxA HkgKk0PWfTh/PQPsbC2y106Zr3vJ34ko5kHLhbrvK+MSX3nemKCNZOrBxeaQMleFFBJK L7RYtedfC+wvtVGbhMvujR5BQoSPGIkgFkxpH7JJQd4X3TokXV0I6iKItkhD/+vwji79 FtsM+5tIKuNZOnRSjNEhRgQvYdeVkf9rHlQ5goTLqD2jHgSGZl3ld2boO3lut3w/4lPM ytkvce5cavVe9N5Ok7n3tVm6LN4PALh3Tc049VH5ScDR8vdGWv53d3zPv49BEv8Qswjj q2Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=bo4ZiTbf; dkim=pass header.i=@codeaurora.org header.s=default header.b=gZai8mJo; 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 t198si2912734pgc.600.2018.04.12.15.24.47; Thu, 12 Apr 2018 15:25:02 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=bo4ZiTbf; dkim=pass header.i=@codeaurora.org header.s=default header.b=gZai8mJo; 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 S1753454AbeDLWU3 (ORCPT + 99 others); Thu, 12 Apr 2018 18:20:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:40850 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbeDLWU2 (ORCPT ); Thu, 12 Apr 2018 18:20:28 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8C21960F90; Thu, 12 Apr 2018 22:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523571627; bh=t8fyu+cXciREdrVlOP2JsdBA8C6zHOCrJSaVY+6J/VE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bo4ZiTbf6t71cOzQzXU1h24K58Gd9lgtlbpz6gAPSy4+mkPV9ZkgLzCdjqBO2NQca 1bRnm1WKDT9O+DrXTMDZ7B5ZZNEnFBALhKESGp0lPsLTzVnoiiUdetoKYeHZEG+uP7 pYYof1FMnJ/BAA9t/KD+ViRtiodEnsQogEVenKBs= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.235.228.150] (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8BC1C60F90; Thu, 12 Apr 2018 22:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523571626; bh=t8fyu+cXciREdrVlOP2JsdBA8C6zHOCrJSaVY+6J/VE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=gZai8mJog7dYjJF4/eQh8vHug93oPH//Bi3vr/vVRIdYd8hMB3e/fvwyKGGunNH4d jx485k6P6NTfZEChRRRRzQlAvJNaB0DKLkYHZhMTbgciSQKeVxeA73CpCB43ktDDYB KCO23OwNQ9hvG2bH4Yshu06/wqTua8ZAl1+t0/qE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8BC1C60F90 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH v3 2/2] MIPS: io: add a barrier after register read in readX() To: James Hogan 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 References: <1522760109-16497-1-git-send-email-okaya@codeaurora.org> <1522760109-16497-2-git-send-email-okaya@codeaurora.org> <20180412215149.GA27802@saruman> From: Sinan Kaya Message-ID: Date: Thu, 12 Apr 2018 18:20:16 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180412215149.GA27802@saruman> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/12/2018 5:51 PM, James Hogan wrote: > 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 > from MIPS hardware folk on this topic. Are you asking about this? #if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_LOONGSON3_ENHANCEMENT) #define war_io_reorder_wmb() wmb() #else -#define war_io_reorder_wmb() do { } while (0) +#define war_io_reorder_wmb() barrier() #endif There is a write barrier in writeX() but seem to be different from platform to platform. I'm not familiar with the MIPS architecture. We can always use a wmb() but it could hurt performance where it is not needed. This is the kind of input we need from the MIPS folks if compiler barrier is enough or we need a wmb() for all cases. -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.