Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3585469imm; Tue, 29 May 2018 09:41:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqHs3LsRtc+Q8vc9tx/fL9X+n7FHoVzZZMXN05Wi87eoksWvrzsuMUnl1zfAle5sk9X57vg X-Received: by 2002:a17:902:6503:: with SMTP id b3-v6mr18275679plk.147.1527612096158; Tue, 29 May 2018 09:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527612096; cv=none; d=google.com; s=arc-20160816; b=H40TfzOalOCn6nb2UBbqw4NoOAZD5mLnuHLCWsRon8QcVYSNdtQfTaVvI+yFjP3RQF AxB+kt07PFRnVKWVqxW7hIxYpfZCZwJMB5WooQjFH7fWv+r6QFZpI+f1WrOpOFcw7a9a 5/GLyk2dke4s9+Yf42BUEYtjXlghTRYGCB5LFtb++/8CgtmrfkK5CTPmeDpOzX40VQuf 3H56Ll4LBPKwlgtOrJeN5y6dMWtr5WPU66Pdd4AzjCFgCLtxMteI5ddeg1TUF65+PMKu dNN8O8iFZpbIV4G+8dnQtoVgqKoVxmCHpvTlflBP+ZxWQNQ6EQpiESB0VfE4Owg5FW6i iLjw== 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=+xl2xahLLewVGKpRauOigu2U7vrr5cm0A05j9QdKQSQ=; b=Ks2XYVcpq4v+7qfgTXs1QwtocKWTnHHPXRcNcuRfw+HbDhgPCs9xL1zN6n0W1SNFEQ 1qBEpdupQKYttPrjztC3fBiJIt0i6CFnXFZMnyuizV2SYhx7XAI+qx2wD+TOEfWfFd6y cyXP/PZ+CejiR5BQlIwpBbo3W/C94EyC2xD/qMFdB6fGeTSLnCoomRfCJ6BMwRPf2uL7 U9s0hNiJgHVoQpOUOet48Zc2TjKD+olccpv4Kf3jzn9+FcAau6LAChmsQWQd1vbRd1VC vVtyW8VJGEVlXM8O8q8p/XEzF8EMCkI+Yu7xPE9Q2gargiCNf9m3qO9hJlB2jrTaoW1+ bwBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=kPa6rVND; 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 g3-v6si31708832plp.594.2018.05.29.09.41.21; Tue, 29 May 2018 09:41:36 -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=kPa6rVND; 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 S936904AbeE2Qkk (ORCPT + 99 others); Tue, 29 May 2018 12:40:40 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36872 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936494AbeE2Qkj (ORCPT ); Tue, 29 May 2018 12:40:39 -0400 Received: by mail-wm0-f67.google.com with SMTP id l1-v6so42502064wmb.2 for ; Tue, 29 May 2018 09:40:38 -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=+xl2xahLLewVGKpRauOigu2U7vrr5cm0A05j9QdKQSQ=; b=kPa6rVNDEauJLHGUzuFTScXrkz4rqtr+cYxsBuORcaDaNlmWdZiPvEvH4nlW6k76S8 TmbWpLL/sIyBkIgHkC8mNicHg7eu1xugsiMeJWaa9z9TVWEiLlDCWowmop9KnQZGdiNu Vqmpjd31OljvrxBFKTQPGbm23Z4cKCmhh8fQMDhAIi//JyWty4JxzfeO1lvTAUS5Otl0 9FXVHglu7qoOgwvGLl7jm1+DlYZ3ME1UONMZu1ePwmOYfIEBYyjL8vQAANSt64ouGUwC LvVmDFpHWVIjAyxSHOb+JUb5SDywa8QLfs7Lm6e5qmhX4XZlWb6k37vCfFySzkouygWc 0nog== 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=+xl2xahLLewVGKpRauOigu2U7vrr5cm0A05j9QdKQSQ=; b=BBYbUyHof1MvNaQ91K3cctCONRa3OovxK3m4fKeXTj1v8pKoGKJxNzk4cRLhwdHccK tqPower+EmCl+ANHfL6iUQta5Xc/DFIQGB4Lu5Vj9iHr5L0m+DUkM6e56oGu2/w8P4OX CJ61PSEATLx6anOUFjrJ/qs5Q79cuTbOuGrwhf4yPO915NGt0UYWcM7CS0LMtsvWl/Xm VJ7FuzXnKxVTPiIXyLZ8IRylfrlpYS4+QzeOO5Z0iTKAlC4iIoypW4Fg+dmwpTS+7UYv oqXCkJl/91jIjuoCJweTBfuvMSlOmDVeZWlnnomiXMHUj1nUJDqKPyQchNBZU4VrC5TN z9tA== X-Gm-Message-State: ALKqPwe54BE4UAMYcDK5xNWeYV+CwRTrbuSgWmhUmkCf9/IQOImjpPpl P+LqajxLvei1MFxiUC1m5WwVqQ== X-Received: by 2002:a1c:30ce:: with SMTP id w197-v6mr10624729wmw.22.1527612037846; Tue, 29 May 2018 09:40:37 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id x130-v6sm23018384wme.24.2018.05.29.09.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 09:40:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1fNhfk-0006ED-Qk; Tue, 29 May 2018 10:40:32 -0600 Date: Tue, 29 May 2018 10:40:32 -0600 From: Jason Gunthorpe To: =?utf-8?B?SMOla29u?= Bugge Cc: Hans Westgaard Ry , Doug Ledford , Jack Morgenstein , Daniel Jurgens , Parav Pandit , Pravin Shedge , OFED mailing list , linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/mad: Use ID allocator routines to allocate agent number Message-ID: <20180529164032.GB18457@ziepe.ca> References: <20180529073808.27735-1-hans.westgaard.ry@oracle.com> <20180529154922.GA18457@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Tue, May 29, 2018 at 06:16:14PM +0200, HÃ¥kon Bugge wrote: > > > On 29 May 2018, at 17:49, Jason Gunthorpe wrote: > > > > On Tue, May 29, 2018 at 09:38:08AM +0200, Hans Westgaard Ry wrote: > >> The agent TID is a 64 bit value split in two dwords. The least > >> significant dword is the TID running counter. The most significant > >> dword is the agent number. In the CX-3 shared port model, the mlx4 > >> driver uses the most significant byte of the agent number to store the > >> slave number, making agent numbers greater and equal to 2^24 (3 bytes) > >> unusable. > > > > There is no reason for this to be an ida, just do something like > > > > mad_agent_priv->agent.hi_tid = atomic_inc_return(&ib_mad_client_id) & mad_agent_priv->ib_dev->tid_mask; > > > > And have the driver set tid_mask to 3 bytes of 0xFF > > The issue is that some of the mad agents are long-lived, so you will > wrap and use the same TID twice. We already have that problem, and using ida is problematic because we need to maximize the time between TID re-use, which ida isn't doing. Preventing re-use seems like a seperate issue from limiting the range to be compatible with mlx4. Jason