From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Parri Subject: [Question] bluetooth/{bnep,cmtp,hidp}: memory barriers Date: Mon, 30 Jul 2018 05:10:30 +0200 Message-ID: <20180730031030.GA9430@andrea> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffy Chen , Brian Norris , AL Yu-Chen Cho To: Marcel Holtmann , Johan Hedberg , "David S. Miller" Return-path: Received: from mail-wm0-f53.google.com ([74.125.82.53]:54632 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbeG3En2 (ORCPT ); Mon, 30 Jul 2018 00:43:28 -0400 Received: by mail-wm0-f53.google.com with SMTP id c14-v6so11420219wmb.4 for ; Sun, 29 Jul 2018 20:10:37 -0700 (PDT) Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-ID: Hi, I'm currently puzzled by the the three calls to smp_mb__before_atomic() in bnep_session(), cmtp_session() and hidp_session_run() respectively: On the one hand, these barriers provide no guarantee on the subsequent atomic_read(s->terminate) (as the comments preceding the barriers seem to suggest), because atomic_read() is not a read-modify-write. On the other hand, I'm currently unable to say *why such an "mb" would be required: not being too familiar with this code, I figured I should ask before sending a patch. ;-) Andrea