Received: by 10.192.165.148 with SMTP id m20csp404806imm; Fri, 20 Apr 2018 08:36:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx48YITlqozCN3/PP5nPMUapqbwUOZN0pxB9CDpgdCMf3DrjloG+Ly13J6doKlqTrsQ0BGgq5 X-Received: by 10.167.133.66 with SMTP id y2mr10267407pfn.210.1524238599773; Fri, 20 Apr 2018 08:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524238599; cv=none; d=google.com; s=arc-20160816; b=MNyLA6QACUKsBNMCWdXulsYvFWpNO7F1rWb45FWS5ATj/6IVOh1yJVtc/cwlqndFMH SHYxRuU1bWVJh8BmTWb2mpD1sZjnTQ07F9VafoXVsQWlxa6ESf2mHyIKAzYD9khCjEC+ 4QQJSwpVBa9ZZKHE/CLCPa2b+Y5TnieJ8mQa3dASItNNYPXTxq/VBWOPKHpomOk7TaZa /uTLNidQWmWRJT4MMwiHNN4y+dnCdkmX/uOLepNyGE4Gp6ifb6I9ibMEzi5Xa3FSTL2M LNfJPN5X7F/170ktyCpL4kU9x0iNoRFYQbjyJ8jTD0vqeK9IiSAa+3G6fn3RU8SftlfZ P9Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=CdSjnRXSSQ4zRe1/H9yFt/XhKuWW06WwhWdVsXkJRlA=; b=sR3ZEpIHij9m8KjfxxZ6rSEzyE56se2C8w93nOjeB+rwD9TuGQ7I2TjF5B9IZ6R5u/ wKSs5Y/POTEa9JNEf6VSZveXbehJY9qe5jJtutvclnlYAu/FBqgKK8/k5P/ThGY+18L5 AFcDIVEp4nroj55G+7qVR4SfvPvs75d56xZP2bqpajIlUEoMR9DaJA50B/nfigATIU8d r98xeT6dmFaLroz9XUh5/w2/T8bn74W0sxGWGvfMbKWJwM14X+tKjynAJKDSl06846y4 Ea816M8ebE/V1rLU/V0xR6WKfHK3cxoz4KPPGPXwN696APvuGn9gfptiOU310qpWTA+N hLaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=JrCxYEqY; 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 w9-v6si5782911plp.389.2018.04.20.08.36.25; Fri, 20 Apr 2018 08:36:39 -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=@ziepe.ca header.s=google header.b=JrCxYEqY; 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 S1755837AbeDTPey (ORCPT + 99 others); Fri, 20 Apr 2018 11:34:54 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:37793 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755821AbeDTPex (ORCPT ); Fri, 20 Apr 2018 11:34:53 -0400 Received: by mail-pl0-f67.google.com with SMTP id f7-v6so5471699plr.4 for ; Fri, 20 Apr 2018 08:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=CdSjnRXSSQ4zRe1/H9yFt/XhKuWW06WwhWdVsXkJRlA=; b=JrCxYEqY0s7tQ5uII5fRYkFDlaphcugT5cGh6NB8K3oVcEnpWcuQ62pmTHtktPJdNR F024hRlmp0nw+mDDV5Miyn4WogZkjQQQFDW139GomVuYXikGvlNr+cao1rNtIzOs7atk 5lyRJ1F/TWogJrB7Nd2RWLQzSYo9TBWJOU9TwpQNASY5PQE3dWQxWx4oBNP+b+wlVmHY am3NBKFveVvuzqsNVt9qojtMJGzNQ6PtmlJ39SKKxS2Ns0qeMyYOVOkOAfrzif7WE7ME B2p5WDBdEqjZ9+1uCz5RS0jK8YRH3hyFhBIdOmAqS0ftlmKgZdsUEvjCujSNWg/L7GY2 8Piw== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=CdSjnRXSSQ4zRe1/H9yFt/XhKuWW06WwhWdVsXkJRlA=; b=cFZ/zfvbS9irAwxAOQpSwZTtx9uzSiqO2Hxmnmh3U4fAW9akso6rw7INB0vNmFdp/B LnYtY5OnkOqZLisI3ns6CurIWeeQAUIJOBwBV0/Uq4Gr8P4G9pjWm/UMfVrn3aCElzKc mAU92lbSvhxpvpa6iyDxIYOq4oXLFi1SHJvg/7ZNqwd+tkjHeHLO80821upj/xCW2QDo F0coOKSGiiFFouie42+dhHH3gag65k8gzJcrrQPa8GA6Goq9hRsqwtULmE3Pp0VwyFFp /Ww2TTkEr5h0eQiMwihMB9y6m/1txOEkZ239PMYZ6MywKmgzKcAUNZZ3fyAYQ4HP2ujm YCUA== X-Gm-Message-State: ALQs6tCuUy9Fr/cEngsIRmZ1jHdTLUcYw6AaAVr1lmGFgWaITa9zn2OJ 3jS/AOS87b6apstfpuaFg7+25Q== X-Received: by 2002:a17:902:3381:: with SMTP id b1-v6mr10742313plc.248.1524238492862; Fri, 20 Apr 2018 08:34:52 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id o88sm23556496pfa.29.2018.04.20.08.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 08:34:52 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1f9Y3n-00004u-8P; Fri, 20 Apr 2018 09:34:51 -0600 Date: Fri, 20 Apr 2018 09:34:51 -0600 From: Jason Gunthorpe To: Doug Ledford Cc: =?utf-8?B?SMOla29u?= Bugge , Don Hiatt , Dasaratharaman Chandramouli , Ira Weiny , Sean Hefty , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/core: Make ib_mad_client_id atomic Message-ID: <20180420153451.GF30433@ziepe.ca> References: <20180418142450.15581-1-Haakon.Bugge@oracle.com> <1524196555.11756.30.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1524196555.11756.30.camel@redhat.com> 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 On Thu, Apr 19, 2018 at 11:55:55PM -0400, Doug Ledford wrote: > On Wed, 2018-04-18 at 16:24 +0200, HÃ¥kon 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. > > > > It is however confusing and not future robust. Hence, making it > > atomic. > > > > People sometimes underestimate the performance penalty of atomic ops. > Every atomic op is the equivalent of a spin_lock/spin_unlock pair. 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? But it is on the ib_register_mad_agent() path which is not a performance path.. 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's. TIDs need to be globally unique on the entire machine. Jason