Received: by 10.213.65.68 with SMTP id h4csp555445imn; Fri, 23 Mar 2018 10:15:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELvlYR/RqO+iEDysmnVluKMD78TjrK2QC5DvmMtiasP6jLf7qgHUFXJKS+A7zSK5uAP0dIfI X-Received: by 2002:a17:902:6941:: with SMTP id k1-v6mr11552176plt.185.1521825301799; Fri, 23 Mar 2018 10:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521825301; cv=none; d=google.com; s=arc-20160816; b=NlqLnZt3jB23N6C1ZVSsGL1T1KL0AvrrSgHBCH1qPBwY2l71xg2HDhJUrsJvLgWyMG +QprIZy+lVhWq+yYC1sMv0wC+PdONwiC5sJRntwNVqjBrqbF++Zk+x3/iA2lVBPAAc6N BM7qrvRibU3i/3tqiiwuyB91Jle+cYq73rODz7IOdCl4poAtAVe97KiPqI9WKB55kuul 8J36PMNWxPbEa5P7XkGbIjVHDdBWa1wznzA2TtGNqkxPlIcGpk+qQ9rgUDOy6pdXfY6b M2ou2MDlr5xSjxVnmFA9GbEoXGJLeCCuk8hslLTRn4uiZCbruPL4Gmol4DHuVf+PqxA/ Ll+Q== 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=+0TqB/S0DAQHpoIITexIfw66BDF0/rfIM5AUftzZlS0=; b=IhoXY5VQP4pfdvoFUVpGpV8fo6O6z/hw7WscAXQ3z/TM2bpNJib4sdi5Pr4h4RVa+b R7wHRfEI8tsCtEhauYp+F8O9LTTca4wuah4gvpHWrE1aLT+m9EwOJeSKYpgXQ9GLePvR FXdStk5TIFYo3pgtYl31FKBmAZNILAv55k+6Q8XopNaN2cDI3JoBFZu/Wnnapab9gVzH I9axzD8yzDW0HBd3NSAVLF2CEH3X1YHlF+mFuxuMQl7fYBlL2UZ14jG+MelWOO7xAFmp pSAvJabeAVJG9B2seQFVVP9IaQpHjiSo/ei/Pf3aIs8MApf+vLVt6NmuMcE9WXrrsqGr 9Llw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=bS3/NeS5; dkim=pass header.i=@codeaurora.org header.s=default header.b=XdTxYCFy; 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 y1-v6si9857676pli.586.2018.03.23.10.14.47; Fri, 23 Mar 2018 10:15:01 -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=bS3/NeS5; dkim=pass header.i=@codeaurora.org header.s=default header.b=XdTxYCFy; 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 S1752352AbeCWRNv (ORCPT + 99 others); Fri, 23 Mar 2018 13:13:51 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51790 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752025AbeCWRNt (ORCPT ); Fri, 23 Mar 2018 13:13:49 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0F6386030F; Fri, 23 Mar 2018 17:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521825229; bh=m4x3Ty9LWK1VejtwU9zjli7t9Rqb9jqFwWN6VeGfZ4g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bS3/NeS5WPdz4TmnuxeQieX9OImxmY7YTm+5pA7ka25ElfrZfi/Uzf04+BPSkr4qg bkiD3iB63vgBrCNNGc4ZT3wKZrYbcIURpiSrgIqcfBf+x5oMJ84ip7GJAoZ8sCuogn uvb8WolDknFqYcMTs8UzdGTy7jHhq0OHRQWwLjCw= 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 [192.168.0.105] (cpe-174-109-247-98.nc.res.rr.com [174.109.247.98]) (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 67AC66030F; Fri, 23 Mar 2018 17:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521825228; bh=m4x3Ty9LWK1VejtwU9zjli7t9Rqb9jqFwWN6VeGfZ4g=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=XdTxYCFy2uoFId6ZAcwoA1HKFTWRLecUw1WtaqDhnYzoK4LatyEu9xPos/tSEp2Oy el+NJa8cjl8NGehXTXo66pG+2sSo/faLJiFmv0cfUpyjRDKLQww4e9Ff2M1yy3CPx+ CdI5WGsdgMPtH0dpg6lPSXUOtHMHmpXXTW4Vohb4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 67AC66030F 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 v5 3/5] bnx2x: Eliminate duplicate barriers on weakly-ordered archs To: David Miller Cc: netdev@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ariel.elior@cavium.com, everest-linux-l2@cavium.com, linux-kernel@vger.kernel.org References: <20180323.124326.2170503491903886041.davem@davemloft.net> <4bd9ccd2-df8f-acad-2513-eefe065dc852@codeaurora.org> <20180323.130418.2223623186761161723.davem@davemloft.net> From: Sinan Kaya Message-ID: Date: Fri, 23 Mar 2018 13:13:46 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180323.130418.2223623186761161723.davem@davemloft.net> 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 3/23/2018 1:04 PM, David Miller wrote: > From: Sinan Kaya > Date: Fri, 23 Mar 2018 12:51:47 -0400 > >> It could if txdata->tx_db was not a union. There is a data dependency >> between txdata->tx_db.data.prod and txdata->tx_db.raw. >> >> So, no reordering. > > I don't see it that way, the code requires that: > > txdata->tx_db.data.prod += nbd; > > is visible before the doorbell update.> > barrier() doesn't provide that. > > Neither does writel_relaxed(). However plain writel() does. Correct for some architectures including ARM but not correct universally. writel() just guarantees register read/writes before and after to be ordered when HW observes it. writel() doesn't guarantee that the memory update is visible to the HW on all architectures. If you need memory update visibility, that barrier() should have been a wmb() A correct multi-arch pattern is wmb() writel_relaxed() mmiowb() We have decided to drop a similar patch on Infiniband due to incorrect usage of barrier(). If you feel strongly about it, I can remove the DOORBELL change. > > Therefore the code is only correct as-is, and your change potentially > adds a reordering problem. > -- 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.