Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1266427pxa; Thu, 13 Aug 2020 05:04:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhYB0c3YQVUL9D92tmk8FeKHpmftWzC2Gn9B/DBPELNBEZD3LoupSgoPuVkO5b+f/2oh0R X-Received: by 2002:a17:906:2451:: with SMTP id a17mr4262992ejb.274.1597320262308; Thu, 13 Aug 2020 05:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597320262; cv=none; d=google.com; s=arc-20160816; b=w7PZe0nZ84ehgdfURngvrX3I2HpzjInML3vdi9S03pmmJhpHS+HLkIbE3jtMSW6SoL m/el2kI3gkwGLejszhEAd7u0DIoTrxxbP9gjn/Uke6b8dsD4EPpO/ldYp/sbKvovCBLE Bz0QFmfZ8CjVwXBkNexxJVk45p6d74hnrRvM3CcGNlGgnvNf/CjucJCmyi/yAFZr/B/1 IrhAcpsClMgVn39SYWru0ETrAVwaS0FAHjDkZW7m5gUqXiSBOTFoPULWe734lE/NdPz/ gDPVqLIDsBPuOQqk+miSHaA+U/xFNKED41CaMkcHXxEu12k16UvuilApINmbgGj8zARp TQhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=i41Yc10MxJ8SD/RmIm1p0LXK6Fe4vVxPBwR0fO9tHsU=; b=fmm791iJC4PkB8pQ1faNdcvlcIovcB+Un4FuTuWE2AmO03KHWHPpsHSg/USJu9nkJB W30lBVZFwzcjmm8yqBpgsLFPLFA9qPbs8GyaocaQrZq1D2ud/hpZWgt9qSM/3E9UTf0d rqsLWhJ5qV5pxgLuRHsl/Gi05xMuPjiv2bLqax/aC49rIdf9Y/XbENs/ko6SVT/xikfO YP1Nyan0tNPiQNx2F1WQCbrgpr4ydV07y4DFuVUsl+V8gg6Jw/unBZSTcoBcSY4Um+Df Pgg2Y0nGvCWTX+yZVITod0V/rl5pCxthxJ6dm4bB1ubdHo3SMFWqsRJ9723Mme/mS6aq eoig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=wUkEP4gz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u24si3374357edb.159.2020.08.13.05.03.57; Thu, 13 Aug 2020 05:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=wUkEP4gz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726639AbgHMMCq (ORCPT + 99 others); Thu, 13 Aug 2020 08:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbgHMMBf (ORCPT ); Thu, 13 Aug 2020 08:01:35 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63AE4C061757; Thu, 13 Aug 2020 05:00:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=i41Yc10MxJ8SD/RmIm1p0LXK6Fe4vVxPBwR0fO9tHsU=; b=wUkEP4gznD8yhOKXfehUrg6u+p 4PCOcBf33WvByOdBvWwLPp6R8/WwxJlEYyQ3CY9ej+Zc55i7MERAd+5CuKACgEOMwJkJpICIjvu6D 4s1dRmOfQoghu7xdIO1fYpsEAEON7cEh4NTueg4+NtGD15C7xchhSji6EQqceguowmv1PUXzJ7Nts a0pAqKr+kEI15dkeOFh7FsqIvbIZKziG+7HYp+GACowqL/3hO1OafqdRTUrgk5GEc79FmzQH2KoHP UeKSdlIY4bl8Zozt8Pc5cSWRv3VGquq0YjgcJVVK0c7xUZQ0+VQiSFpdainJpwi+h0C1SJd8c8qzl p9a5QjuA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6Bu5-0003VD-3H; Thu, 13 Aug 2020 12:00:17 +0000 Date: Thu, 13 Aug 2020 13:00:17 +0100 From: Matthew Wilcox To: peterz@infradead.org Cc: Christoph Hellwig , Jacob Wen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] block: insert a general SMP memory barrier before wake_up_bit() Message-ID: <20200813120017.GH17456@casper.infradead.org> References: <20200813024438.13170-1-jian.w.wen@oracle.com> <20200813073115.GA15436@infradead.org> <20200813114050.GW2674@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200813114050.GW2674@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 13, 2020 at 01:40:50PM +0200, peterz@infradead.org wrote: > On Thu, Aug 13, 2020 at 08:31:15AM +0100, Christoph Hellwig wrote: > > On Thu, Aug 13, 2020 at 10:44:38AM +0800, Jacob Wen wrote: > > > wake_up_bit() uses waitqueue_active() that needs the explicit smp_mb(). > > > > Sounds like the barrier should go into wake_up_bit then.. > > Oh, thanks for reminding me.. > > https://lkml.kernel.org/r/20190624165012.GH3436@hirez.programming.kicks-ass.net > > I'll try and get back to that. +++ b/drivers/bluetooth/btmtkuart.c @@ -340,11 +340,8 @@ static int btmtkuart_recv_event(struct hci_dev *hdev, struct sk_buff *skb) if (hdr->evt == HCI_EV_VENDOR) { if (test_and_clear_bit(BTMTKUART_TX_WAIT_VND_EVT, - &bdev->tx_state)) { - /* Barrier to sync with other CPUs */ - smp_mb__after_atomic(); + &bdev->tx_state)) wake_up_bit(&bdev->tx_state, BTMTKUART_TX_WAIT_VND_EVT); - } } return 0; It'd be nice to be able to write: if (hdr->evt == HCI_EV_VENDOR) test_clear_and_wake_up_bit(&bdev->tx_state, BTMTKUART_TX_WAIT_VND_EVT); ... maybe with a better name.