Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3534888imm; Fri, 25 May 2018 07:21:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxE+vVKO3PsmnoYCJJY0TgLHZvhrq4+6+c//GpnXJds0Fbu/jJsDS0sfuyyJMXdBTCjR7K X-Received: by 2002:a65:50c7:: with SMTP id s7-v6mr2172535pgp.359.1527258099918; Fri, 25 May 2018 07:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527258099; cv=none; d=google.com; s=arc-20160816; b=DdD6gIwSV/TB4GIytPaIPsdDlVlYXkqOC3pWKiEMFyUFA82rp16++93ngvN47Q1C2N 7/VZ8x4CfHHVjxxyxhSVkFn8SmmR0La29AZE5ypPjZ0DIk4Cyburc62LzmGoRJrRF1oa adT4XVDF/ZMQa4vRFGsT9chVnG5ycKtjBc29/JCNc5csL4qCPWi9OCmG/DqmUSXu1wCy ikLymBGEW84RdvBj7IBrtkQDz3WMKUhfxurbPe65EilJBdoyywP8r0ITos8IsPHFvV9z v5rgf5+WTwwWfay3M5tb2mLNCGoUWz2tUr/EYEII0rTzWtPurrkLP0U9k2Eq0RFHnKcj Rnzg== 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:dkim-signature:arc-authentication-results; bh=AGCP7ai34vmMMbVVpLyZpIpiOhVYHd7RuJ9LpBQypYc=; b=bXKnUPAQ02GljFFubaUKAmsah7W5/U98FIWHcwCueGg07pb1jQIedTeUeyAoGeT2J8 x5txFFC4hGCgFgF72woOO2jqPYR0YQf+F9VpnSPxZlo5LTQfhr3YkBLnwzUV38VBOjGn Hec3n58OkPaGDHgtxg/un80aVvMbLctsFH+uEiUrv8wS9Dr8b0LptrtyBdhDgJ6+C7eh FHoqGsLuXqAlUlObUB01m9UKcbmjjtm5F+hbhRyU4XL3obtWMhYbD+LWtTjpignyDYIP WafOCSsB96sleW0KMHkaNfDfXIl7UPxiReYEVuKKdAzTc7uBT+rras0KEjuMpm9nYgiZ BoKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NqvFC4Em; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j127-v6si18464847pgc.204.2018.05.25.07.21.24; Fri, 25 May 2018 07:21:39 -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=@linaro.org header.s=google header.b=NqvFC4Em; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936190AbeEYOVH (ORCPT + 99 others); Fri, 25 May 2018 10:21:07 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:46270 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935949AbeEYOVF (ORCPT ); Fri, 25 May 2018 10:21:05 -0400 Received: by mail-wr0-f193.google.com with SMTP id x9-v6so9550538wrl.13 for ; Fri, 25 May 2018 07:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=AGCP7ai34vmMMbVVpLyZpIpiOhVYHd7RuJ9LpBQypYc=; b=NqvFC4EmjKDNr9H2MUxFIr/yKo0hwg3kSNUI1k7DsxnQQA2saZY4FCWyxRDFflRrC7 CuTfhDLrZfe7pFh7FHIGU3utEceFYfCEqiJrUwtbilFJbZy33ha5V6QzKPA6ewPuh1u5 S68SCZJfbgBm2trZYGBoqSpDwNVlEwT2v3gXI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=AGCP7ai34vmMMbVVpLyZpIpiOhVYHd7RuJ9LpBQypYc=; b=MG7r5EM1ruL1wRF3UAJyFb/qRlUQc94SHBelAKQk4IFml1hRjun4mRUv3MxB8XE2Ip L24Yjao6w7cYAQn2ghI/1jR3CM5+3FZ3YDQxthmH1rG2R6Z7PqsBiXrp49GHpQAeJa2O g4YU8R32SCSCsF4cYjdwK4HzGmeXQNlY8eIn3L0LKOWzwOj9G2h/MDwexN3NjI6NI5tL AHWKJF/BGP/FWeeek6mT6DXmlZKkbRsovLQZZXfDoX7ImjhQ8CBUI+bWAcYYJdJBR3/p 73WJNjnXi5MVbOsmq0wMPytKugucnFhXbLVU6cH7DP5JUtf9OMa2QwNs7FjiiOsHPHtc zs/g== X-Gm-Message-State: ALKqPwdXaSL/X3k/zcbEOcirM4IjO+KWmchr26u0kJcAI0NMd7hWG3aJ B6iBw9g+Q43QAF+kimNJjVw1cA== X-Received: by 2002:a19:6387:: with SMTP id v7-v6mr1697874lfi.74.1527258064015; Fri, 25 May 2018 07:21:04 -0700 (PDT) Received: from localhost.localdomain (h-229-118.A785.priv.bahnhof.se. [5.150.229.118]) by smtp.gmail.com with ESMTPSA id e7-v6sm4428208ljj.95.2018.05.25.07.21.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 May 2018 07:21:03 -0700 (PDT) Date: Fri, 25 May 2018 16:21:01 +0200 From: Niklas Cassel To: Bob Copeland Cc: Adrian Chadd , Kalle Valo , David Miller , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [PATCH] ath10k: transmit queued frames after waking queues Message-ID: <20180525142101.GA14422@localhost.localdomain> References: <20180517231512.13085-1-niklas.cassel@linaro.org> <20180521203701.GA7619@localhost.localdomain> <20180524155034.xse7cfm5figfktuj@localhost> <20180525123656.GB8780@localhost.localdomain> <20180525125023.alc42lkgehc6iodg@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180525125023.alc42lkgehc6iodg@localhost> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 25, 2018 at 08:50:23AM -0400, Bob Copeland wrote: > On Fri, May 25, 2018 at 02:36:56PM +0200, Niklas Cassel wrote: > > A spin lock does have the advantage of ordering: memory operations issued > > before the spin_unlock_bh() will be completed before the spin_unlock_bh() > > operation has completed. > > > > However, ath10k_htt_tx_dec_pending() was called earlier in the same function, > > which decreases htt->num_pending_tx, so that write will be completed before > > our read. That is the only ordering we care about here (if we should call > > ath10k_mac_tx_push_pending() or not). > > Sure. I also understand that reading inside a lock and operating on the > value outside the lock isn't really the definition of synchronization > (doesn't really matter in this case though). > > I was just suggesting that the implicit memory barrier in the spin unlock > that we are already paying for would be sufficient here too, and it matches > the semantic of "tx fields under tx_lock." On the other hand, maybe it's > just me, but I tend to look askance at just-in-case READ_ONCEs sprinkled > about. I agree, because of the implicit memory barrier from spin_unlock_bh(), READ_ONCE shouldn't really be needed in this case. I think that it's a good thing to be critical of all "just-in-case" things, however, it's not always that obvious if you actually need READ_ONCE or not. E.g. you might need to use it even when you are holding a spin_lock. Some people recommend to use it for all concurrent non-read-only shared memory accesses: https://github.com/google/ktsan/wiki/READ_ONCE-and-WRITE_ONCE Is there a better guideline somewhere..? Kind regards, Niklas