Received: by 10.192.165.148 with SMTP id m20csp3485616imm; Mon, 23 Apr 2018 07:21:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Pomopt7fo1dCnfYlPQX3d0famGNZhG4d2O2diQd7zTK9qhj/Hzn2zklManK0htovG3eDo X-Received: by 10.99.120.195 with SMTP id t186mr9314551pgc.97.1524493312302; Mon, 23 Apr 2018 07:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524493312; cv=none; d=google.com; s=arc-20160816; b=LQ81Ls7xswTf95vFHb62iqhZXrco+ACbfplpq1lxfpUu9QHxQdzUp1XGN2KpLB0Hhb 3fkM8Qmaho2bQpmjTa3dzrl0PLGfYujoWLFvXxAlwsdjJYQ/jBUIJYPkEpwJSKSheMRn sdARpZttp9oXPjNkKaxmWo9gYDDBHyRVu/dn1z6HxPaBe7eESJBx1xLmpGTUCWatSI9F 14x2qy1ROiZF66jXyiH7yKNxstUcTa6w0fDGi1vcObBPJjxt7qlVKGKMQDXnMxKb+6cn LepTQVzhOu70iNY9EuxlxT+nZGHfpRrdPYdX6GLHYrBVOugIOpC7XqxS04tCSMjWcj50 yeGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=qFuQMyVaKgvnWGHZCjeu9Z+PQz5T5ev5Wp5Nt+k4zg0=; b=lJDPq8PCXKLT5gk0AHSBHqSDicjL8xLLugF2oB0axN8xUm0f2peHqrcgs9IQTd7kXf l7Gr5sXWh+L6ribyGJRy+X8hFs8Sr80k75a9mZkoCl0F4ofiE2KuFaHd0DBCh8yA+BaR MoGr4qG+MixJ4+M4RxgYu4k8Ykz5WabaRGD74hdM+z2LSpGXBw/Iwqa6TqeWhNePBXwB kXk8khnR1A8Z3ecwXF5wV35c0H3q2nCjOriwZAnuT/NOvqZiDBgo5yy7QgPK8tRVAhde LzM8PQlrTNoVLD2VyQCy+dFnZIWtcMuqrZ+PvKuCjiN/3h36tj+khKcS3HYZwWNeHjDG TNQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=CAYjMpRV; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si11754993plg.396.2018.04.23.07.21.37; Mon, 23 Apr 2018 07:21:52 -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=@oracle.com header.s=corp-2017-10-26 header.b=CAYjMpRV; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755342AbeDWOUZ (ORCPT + 99 others); Mon, 23 Apr 2018 10:20:25 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:38270 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755184AbeDWOUX (ORCPT ); Mon, 23 Apr 2018 10:20:23 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3NEBaav131934; Mon, 23 Apr 2018 14:20:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2017-10-26; bh=qFuQMyVaKgvnWGHZCjeu9Z+PQz5T5ev5Wp5Nt+k4zg0=; b=CAYjMpRVSz/ZYquSr6/hEr+B3/CrwKg3+gCQX0fjGL2c5q0cmXYn6EiEv/PVUnRSS5ys lg5q/jFhitpSBfXkUydj4zxbmiQdvMMsfgEKyHlojcm2RedGx87/ENSlEyv7MLL/YG6a Z/u1xC4/Sh9ELyFuJga0UpN1Kjsb92E3yiZxRjrxpC1ZWqAN4iAddVlxYfbD+2j9LoZB mlFuNWsChlvOLM6imeuoB1Yc/7b51JRzoRXEI2LJalW+vnAhwbhSBREN4eN5zeUp+nmK kmnKL5vv+z04ZIz8hS8YynttP8AIA4lLH3njcqh/ioIIIIDBuKltaZ2cq8Qmb7KktPbo 6g== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2hfttxwmu5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Apr 2018 14:20:03 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w3NEK2S5015284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Apr 2018 14:20:03 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3NEK1bP009613; Mon, 23 Apr 2018 14:20:01 GMT Received: from dhcp-10-172-157-170.no.oracle.com (/10.172.157.170) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 23 Apr 2018 07:20:01 -0700 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH] IB/core: Make ib_mad_client_id atomic From: =?utf-8?Q?H=C3=A5kon_Bugge?= In-Reply-To: <20180420153451.GF30433@ziepe.ca> Date: Mon, 23 Apr 2018 16:19:57 +0200 Cc: Doug Ledford , Don Hiatt , Dasaratharaman Chandramouli , Ira Weiny , Sean Hefty , OFED mailing list , linux-kernel@vger.kernel.org, jackm Content-Transfer-Encoding: quoted-printable Message-Id: <50E3FE4A-2C6E-4493-92E1-383C349FAE3A@oracle.com> References: <20180418142450.15581-1-Haakon.Bugge@oracle.com> <1524196555.11756.30.camel@redhat.com> <20180420153451.GF30433@ziepe.ca> To: Jason Gunthorpe X-Mailer: Apple Mail (2.3445.6.18) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8871 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=507 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804230144 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Jack > On 20 Apr 2018, at 17:34, Jason Gunthorpe wrote: >=20 > On Thu, Apr 19, 2018 at 11:55:55PM -0400, Doug Ledford wrote: >> On Wed, 2018-04-18 at 16:24 +0200, H=C3=A5kon Bugge wrote: >>> Two kernel threads may get the same value for agent.hi_tid, if the >>> agents are registered for different ports. As of now, this works, as >>> the agent list is per port. >>>=20 >>> It is however confusing and not future robust. Hence, making it >>> atomic. >>>=20 >>=20 >> People sometimes underestimate the performance penalty of atomic ops.=20= >> Every atomic op is the equivalent of a spin_lock/spin_unlock pair. Well, may be this holds true if the mutex and the variable is located in = the same cacheline. >> This >> is why two atomics are worse than taking a spin_lock, doing what you >> have to do, and releasing the spin_lock. Is this really what you = want >> for a "confusing, let's make it robust" issue? >=20 > But it is on the ib_register_mad_agent() path which is not a > performance path.. >=20 > This actually looks like a genuine bug, why is it described only as > 'confusing'? ib_register_mad_agent is callable from userspace, so at > least two userspace agents can race and get the same TID=E2=80=99s. My understanding is that every lookup is using the {port, TID} tuple. As = such, it is not a bug, but, very confusing. > TIDs need to be globally unique on the entire machine. If you are correct Jason, let me reword the commit message. Thxs, H=C3=A5kon