Received: by 10.192.165.148 with SMTP id m20csp3785839imm; Mon, 23 Apr 2018 12:19:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx49C3YD2NXKSIfLaoyaVijfm8PL0CNmKLLIZ2maHgm+RWVWgXGpiL7Q8HylqNag0HUyf6piB X-Received: by 10.99.115.4 with SMTP id o4mr17653122pgc.404.1524511149663; Mon, 23 Apr 2018 12:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524511149; cv=none; d=google.com; s=arc-20160816; b=sA7geA14sXvzJqUHbj1q4UgpXp9GkwlVZlUN3heDnpPsVAIx4bwKgGfOaIx2+mXgnj h1Z98TIRr5SfanWPRNwuEdiMnxky4MQWPhkOQ1owP0y5Yc0WWqydSriNT3eN06JHm4gX tow7fQpoV9llLgQPaXClN1Faml46/2iLukPavdd6RmQEwM+YHW4FDvFuuc3JpYWm0M7E JANf+ncHL/YQahSGaqtH54R6QWW4sV32gsjH5VRQzz4A3MRH6D4y3h3juoEoIlKWC5KW 6zEwrUZ4CRXhaFfoqtuR8bZzJM7BuDllrYGjITzgvZdAzt6a0xwxspuFalJB57mX3jv/ JJyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=aoSerP6U7jyFdRmgPCXubYAIqeSUblOLtYNqnPmFN6s=; b=OBBx2XBZoUy7uUVqvvtkyCzmEBE/xhPFzXQtf/or6B80endtl2jRJaafPaqYyLAe7M igctr7kyyR0fux8umOPOf5GViRPQk4pL5sgmKctiqkYcDeXjhvofj6jeSv4QEM0eCldk 8IkuOX9u8mAGWwsVbuGC14caS0/q5XNl9+q7wtK2ZjivxxrbWvItouHLTL+mYBYKv0fd fIZbL3vLXq++9R03VpgVbbC4GE0SpvRr9+eyXUIOxtEGATTWYMDax/Zwpwna9UT2pZbr Lr4IErLp0zKUM2BPVxGdo+UuBy+gL9s5MjVrgWSRsN8NpvyEPVdPofvaHcGtt05K42Tl 3nyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dev-mellanox-co-il.20150623.gappssmtp.com header.s=20150623 header.b=BZVoBigJ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.co.il Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si6776023pge.639.2018.04.23.12.18.55; Mon, 23 Apr 2018 12:19:09 -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=@dev-mellanox-co-il.20150623.gappssmtp.com header.s=20150623 header.b=BZVoBigJ; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.co.il Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932393AbeDWTQ1 (ORCPT + 99 others); Mon, 23 Apr 2018 15:16:27 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:43667 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932175AbeDWTQX (ORCPT ); Mon, 23 Apr 2018 15:16:23 -0400 Received: by mail-wr0-f196.google.com with SMTP id v15-v6so26126882wrm.10 for ; Mon, 23 Apr 2018 12:16:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=aoSerP6U7jyFdRmgPCXubYAIqeSUblOLtYNqnPmFN6s=; b=BZVoBigJFWNpOsonW+m8nPo7NvDWG78C4CkYK3Y1NRzPzvualcHPYtZi478J2lPYWR xMgnMfZHEgQcexSQlcMAC1f6JmzEKLiWfXhM7hXqHfrh1Iu5CbmBNFJYYr2/smsuThpW 53zYCxcCYgcbWio18bJQH0/gW52MnPDo6tl5ZdBN++vEvgWSusAH0l6xGN4pLL1Gk1R3 dft7xqLa2VGZ4eIKOU1ILaDmQWa3UUZHweaxSDyLiE9v/T+KCWzzY09yb+wB7PZ+4Bhs RlXo5N8yQYVrc42je9URilw9BklSDFZ4CfEgVWD1ff+Y1ThUs3jXqNAnCHg5nSWi3n9O sTIQ== 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:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=aoSerP6U7jyFdRmgPCXubYAIqeSUblOLtYNqnPmFN6s=; b=I7+gLWebWRXb2xt1fXSj6dYqbjJiEfBKj5GoKZi+kSw3cFebD9QQWckGHc1t5+KKJy ucxShe6ol0CJruqnjMFdbWfzhM/eDDCpUs2oAuGznltxFeVMaEtnzTqz4NUIWYIbYH2F 32NgX6V1GMneMbpmvZuQruo0LxiB1W5svFv1jey6XgBR3z4B7vCO9NzDc+gisjZScYPe INf1GAvwY25w3ex5XDp2odKFAlZB09MmKP3gwJc9vYBSMF3kXbW5LSfEsW2r3kLFkXwD Vui2KoPm9dAn6nwG9kZej3lkZ+Td8god29TpbkIbn1h0hy1ZBwz8Al/okCRE3SnM6oKJ dPsQ== X-Gm-Message-State: ALQs6tDEQkEvQRSkFfKoN7XfhIgul8gbK7ZUskzdLyB7g3ytBNj+5Odg KsIA787fEgIptFi7JQ7kpTjsINip X-Received: by 2002:adf:86b2:: with SMTP id 47-v6mr18747652wrx.256.1524510982523; Mon, 23 Apr 2018 12:16:22 -0700 (PDT) Received: from localhost ([31.210.187.22]) by smtp.gmail.com with ESMTPSA id r8sm19187821wmg.44.2018.04.23.12.16.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Apr 2018 12:16:21 -0700 (PDT) Date: Mon, 23 Apr 2018 22:16:18 +0300 From: jackm To: =?ISO-8859-1?Q?H=E5kon?= Bugge Cc: Jason Gunthorpe , Doug Ledford , Don Hiatt , Dasaratharaman Chandramouli , Ira Weiny , Sean Hefty , OFED mailing list , linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/core: Make ib_mad_client_id atomic Message-ID: <20180423221618.0000795d@dev.mellanox.co.il> In-Reply-To: <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> <50E3FE4A-2C6E-4493-92E1-383C349FAE3A@oracle.com> Organization: Mellanox X-Mailer: Claws Mail 3.15.0 (GTK+ 2.24.31; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 23 Apr 2018 16:19:57 +0200 H=C3=A5kon Bugge wrote: > >=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. =20 >=20 > My understanding is that every lookup is using the {port, TID} tuple. > As such, it is not a bug, but, very confusing. Haakon, you are correct (see snippet from the IB spec, below). We will NOT have a situation where there are 2 threads/apps with the same agent ID on the *same port* (accessing the agent ID allocator is protected by a per-port spinlock). Having the same agent ID on DIFFERENT ports is OK. Thus, there is NO bug here. (But as Haakon says, IMHO it is more robust to avoid having the same agent ID for 2 agents even if those agents are on different ports). >=20 > > TIDs need to be globally unique on the entire machine. =20 >=20 Jason, that is not exactly correct. =46rom the IB Spec 1.3, C13-18.1.1 (in section 13.4.6.4 - TransactionID usage): "When initiating a new operation, MADHeader:TransactionID shall be set to such a value that within that MAD the combination of TID, SGID, and MgmtClass is different from that of any other currently executing operation. If the MAD does not have a GRH, its SLID is used in the combination in place of an SGID." Since the SGID/SLID is different for each port, the per-port guarantee of no 2 agents receiving the same agent-ID value is sufficient. -Jack