Received: by 10.213.65.68 with SMTP id h4csp60170imn; Thu, 15 Mar 2018 09:30:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELvSm2SVR6wfrz4M2giFuVKjtDMYlOK0mZLNWQVl5Et2+cTZyEWfDTklIrQvGmMtjXtOXiau X-Received: by 2002:a17:902:a516:: with SMTP id s22-v6mr6341653plq.191.1521131427142; Thu, 15 Mar 2018 09:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521131427; cv=none; d=google.com; s=arc-20160816; b=dayn0DfNRgRF9pIudP81oL8InDuNmZLdrrjyVLgp6ENmAH7SCdLbTdTMwkbbiHU2rb kcK3+Nt3RDuWQV0Skg7O0EY12YCGmkohosIMiFD6u1+fH59CgYWNlfwobc5Ktgxnav44 dzmpwtp3HdGeJFyuil9Ftz9GbYDgx6LHUcsWZX3p9b4gkpy9MrEWvZN6bvJ25PgFjxTO RUNeu6biq5EV6GOKUVVYWTIkLYrJ2yxUAyJN0qZB6rthG16fnoPARtCwCZeRj8DUppl3 5TwoSwzS8Q4tPclj/QoUrq3mqIA82+mUbsULflgZresry7oXTtUAaY1tsoKtHoxjShjz 6+qg== 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=5RIvummBKR+qmAgT1J2N8CySL1C3/HfSAoP+OKsjC8s=; b=ssWelkUPrlHs0jV7UyHs0TwfKek5LPLdBikgOnFs6mcdBKMIPPpRNW1glBo+48atOx 8lB9JqJaANWTxXptI2roZNRj3LhGrrErDoMhBe82Ee33btNwXmwK3/5LiI32QTTHMaE0 oSz6aF7A2UOvMc1/Fm0bO82OUe2o/qmMpODb4PMhf3JE294hLP5aqHg/9f2i+pdV+6Jk 5YAkNPVdsvTwEjSKAoRj8d6eiboUYlZxrPisUaf2KqTy0StduK9MJiXMXPca7du8VL4i quDOGqcQAfrPaVYWzZdY5JOs8rf/zstUX9GoOvxnE9Cvg3AGLue9vhVogkYN4nSTl6pK 9Pxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fiYt56X7; dkim=pass header.i=@codeaurora.org header.s=default header.b=emS+zsfn; 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 m137si3661262pga.270.2018.03.15.09.30.11; Thu, 15 Mar 2018 09:30:27 -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=fiYt56X7; dkim=pass header.i=@codeaurora.org header.s=default header.b=emS+zsfn; 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 S1752164AbeCOQ1x (ORCPT + 99 others); Thu, 15 Mar 2018 12:27:53 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:60424 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751791AbeCOQ1u (ORCPT ); Thu, 15 Mar 2018 12:27:50 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6182F60F90; Thu, 15 Mar 2018 16:27:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521131270; bh=CXssBaEpDXL5zUtFXa62clLOZt2MPBBhIU3bNfiHKdg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=fiYt56X7Oc6J1dFSxBi8hh6KXdF6XEAUFGM5OThN80rf/EY3zXyeqxxye1i4Pn+EX fwVXHgNSt7X32YyqtBUldOJ0P/mtJNUTvXPW/SENSvMkyt0KQJA+HEzHbMZaA4Z0Sq ggjYIPf2mcUX0D9p9bDoi82AOkBEAGJE2ckp4uP8= 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 6AE4360FEC; Thu, 15 Mar 2018 16:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521131268; bh=CXssBaEpDXL5zUtFXa62clLOZt2MPBBhIU3bNfiHKdg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=emS+zsfn9JdqGBWnA6lZDilSR793pq5tFxE77MxdEeVnB2RkxX04NDflmImhH4iOp gssgA8q72FJhzPQZyOVndQRRV9DBsZbsutivx5NXZp4bFnyQuX93YA6ok9hsb4uA6F trxNMq16CUpzWxusg7XrBS7apb0S6ybjQtMjt+U4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6AE4360FEC 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: <0175e460-3424-9838-1064-9f63dab3304f@codeaurora.org> Date: Thu, 15 Mar 2018 12:27: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: 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/15/2018 12:21 PM, Sinan Kaya wrote: > 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. > Now that I read your email again, I think this is the reason if I understood you correctly. "instead of invoking both a smp_wmb and a wmb" You'd need something like update tx_buffer_info update tx_desc smp_wmb() point first tx_buffer_info next_to_watch value at last tx_desc update next_to_use wmb() notify device via writel_relaxed() Let me work on your comments. -- 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.