From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752254AbeCOQVX (ORCPT ); Thu, 15 Mar 2018 12:21:23 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48814 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751357AbeCOQVV (ORCPT ); Thu, 15 Mar 2018 12:21:21 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 48B9460590 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 7/7] ixgbevf: eliminate duplicate barriers on weakly-ordered archs To: Alexander Duyck Cc: Timur Tabi , Netdev , sulrich@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jeff Kirsher , intel-wired-lan , LKML References: <1520997629-17361-1-git-send-email-okaya@codeaurora.org> <1520997629-17361-7-git-send-email-okaya@codeaurora.org> <12150aa0-77ba-878e-31f4-d4f8d6a28ccb@codeaurora.org> <2a4f4dec64b7462ae64152f6c2df9754@codeaurora.org> <53bf7dfe-32ee-1861-e6ea-81f667590a43@codeaurora.org> From: Sinan Kaya Message-ID: Date: Thu, 15 Mar 2018 12:21:17 -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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/2018 10:32 AM, Alexander Duyck wrote: > We tend to do something like: > update tx_buffer_info > update tx_desc > wmb() > point first tx_buffer_info next_to_watch value at last tx_desc > update next_to_use > notify device via writel > > We do it this way because we have to synchronize between the Tx > cleanup path and the hardware so we basically lump the two barriers > together. instead of invoking both a smp_wmb and a wmb. Now that I > look at the pseudocode though I wonder if we shouldn't move the > next_to_use update before the wmb, but that might be material for > another patch. Anyway, in the Tx cleanup path we should have an > smp_rmb() after we read the next_to_watch values so that we avoid > reading any of the other fields in the buffer_info if either the field > is NULL or the descriptor pointed to has not been written back. How do you feel about keeping wmb() very close to writel_relaxed() like this? update tx_buffer_info update tx_desc point first tx_buffer_info next_to_watch value at last tx_desc update next_to_use wmb() notify device via writel_relaxed() I'm afraid that if the order of wmb() and writel() is not very obvious or hidden in multiple functions, somebody can introduce a very nasty bug in the future. We also have to think about code maintenance. -- 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.