Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3473853imm; Sun, 29 Jul 2018 20:11:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIyTTXbLqHpk0skfxrcaiFSbzbyK0IcJXiuX7FE06uXjTTdAbQ2qpAgfaEWfPKyRNWGMaz X-Received: by 2002:a63:cf4a:: with SMTP id b10-v6mr14891623pgj.235.1532920301944; Sun, 29 Jul 2018 20:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532920301; cv=none; d=google.com; s=arc-20160816; b=wwqAOBJDkp7t7BjoxF44fmGbRz4+MuLt93saBKt4YL550ilC4xpHrlesvnpSEGC+zY v/jPMtGMi5HEnBluTq6UREp6/3vKdNacikh+DTm/BNpMcqUnA1LRqNKTPuYzyg+gn7rW mlAk4JN+4jqHVlHKXVBqAl7dAd2KM6ot4tPftaCOOTwsqpvB2g0AYi9KAgxjRdkRprut FPdwCmzTm43dE0vjxNg6fYxq//zJKOqUw2MaUJhm3T+IZTQHHUJR9YakzkQWmiXqlb7v xcmfgQrBlVedcIsPCvVXWHFNdsjurCK/VSsmdZIb8AyZVvF8W4Ib4He8YuRAybrDJjgu SWdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=nfECFzjZPVlyRfUz2yJg3SfVMrKQXDob7lF9CNDUsV0=; b=gMJI4EdoJBds4eaAzwQV0YiBjQ9T2LQ9g3i6cSBKMXjObgO9v6xvXawCNQjRKrkXl+ kwqWsL4n+W/NkoP698n1ekuLmOiCvM6DzrRXuppw2iHZQFdMrJXGt9CWNV3xK6NRHGHH qzjBB/GgBzpZNFUBxPP3y/nvBd1XN1wjrbG+bu/xAHGfjyscLvLTfmQyXJqQYCcFqrN5 nhsbvww16Lrn078JNRiKdeSKsgvxNhPfLY+5d8iJAXAu/S4q7dHxkfKgxHlOzNpvLUtC myBkE7d6ezf7fxf2Qgjt/Rp+Tem7Bf0iTl4E19+M7zdSOIwxCE0LjNbs10p4MdUY6mcN ZDTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="BMg/CXQb"; 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 u6-v6si5846150pld.256.2018.07.29.20.11.27; Sun, 29 Jul 2018 20:11:41 -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=@amarulasolutions.com header.s=google header.b="BMg/CXQb"; 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 S1725992AbeG3En3 (ORCPT + 99 others); Mon, 30 Jul 2018 00:43:29 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:51890 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbeG3En2 (ORCPT ); Mon, 30 Jul 2018 00:43:28 -0400 Received: by mail-wm0-f51.google.com with SMTP id y2-v6so11437662wma.1 for ; Sun, 29 Jul 2018 20:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=nfECFzjZPVlyRfUz2yJg3SfVMrKQXDob7lF9CNDUsV0=; b=BMg/CXQbq/x8HwUBEQJ9twJrEo3vxsuWkBBl0n6h4qNnQ/dkCo0jon7G/3ecmWzDB+ +azZAYWdt/h+EbrzK4D1ksp/9/D5dHNU+DWuze0V8pwq01SQVB7lOtRVV4ICFP3hveP0 zhwAaidfJJuGdFpgl5g8n9jBtv3cAi0HbwquQ= 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:mime-version :content-disposition:user-agent; bh=nfECFzjZPVlyRfUz2yJg3SfVMrKQXDob7lF9CNDUsV0=; b=CZt9IKVHAj8jnOLV2K1o1mWO7qpN3ABVD+OpKEiz6z62udZ581zfOz4TRG4ta7aCMN toITN4S77qSuzg2NaTkIzXo1Zv++E5qVhMv/1Dwb5wkKR/52MWSUH0mcaTRT5w+yTGhh I/033cVDcMQuDXU1bjTmHlF86a6VS/vu0OF2R45HGrX9mZ6LiQCaweQwqtr35O7NzSdz NbJcxPNb5gGKzp9q5fwv5tbCJ+Llr819qCCLl6IwkHAIIosyNKycC+0f4YVubwBK9xfz AiIT48PlG+XeIe8xnFuX0sDnhzTstiYfOdPMuLSA4lEJeqUvLmm4AdBE/EHpWbRy1S0C IbCQ== X-Gm-Message-State: AOUpUlG6TWvU/e+Tg0xKAPtIlmtItIzjM+ARA+9QQZITkl3Gust6ryDP J5YyLJ8XLauwepmzWNIGvgQODQ== X-Received: by 2002:a1c:be13:: with SMTP id o19-v6mr12774605wmf.1.1532920236976; Sun, 29 Jul 2018 20:10:36 -0700 (PDT) Received: from andrea ([94.230.152.15]) by smtp.gmail.com with ESMTPSA id t6-v6sm14588872wmf.8.2018.07.29.20.10.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Jul 2018 20:10:36 -0700 (PDT) Date: Mon, 30 Jul 2018 05:10:30 +0200 From: Andrea Parri To: Marcel Holtmann , Johan Hedberg , "David S. Miller" Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffy Chen , Brian Norris , AL Yu-Chen Cho Subject: [Question] bluetooth/{bnep,cmtp,hidp}: memory barriers Message-ID: <20180730031030.GA9430@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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