Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3196262imm; Tue, 29 May 2018 02:56:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqA0TrOvn8JMLogencKqDbigV4iPA3TGKeW6y90zO1V4ajKm3DV8vOF2hzfCW2g5DwNRKIA X-Received: by 2002:a65:5884:: with SMTP id d4-v6mr13150711pgu.292.1527587763939; Tue, 29 May 2018 02:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527587763; cv=none; d=google.com; s=arc-20160816; b=egR9r6gTm1E6NDdIQzTYbvUvsGb5xsgUPlC9H4iFOFcdiEQMcB1tkOpLIScvi7ptQX pasUJEoa2nr7+6COdglYrQxfsEvAx5EROC9ICRD10vqn64ETShkSou27e5p8x6h/w2sm Mj/fO9gnEvP0RL4eaSlxQ+VVXflRU5GkALgF+a+tsUAKrXqulgn3aCxsK/t6VcYv/uvS zgryRE7jfyh/mhFQDvP4QY5brhJ/JjT9y67YgqMX9MOj+E30erR95J5gNiuVBzlc4p7U 3xPVNpsGjNVm7x9AR4xakOHLVYON8+Vpk6K7Vm+CoFuLsF4AJ2jRoeTFgiPcUpnG0l8N FIzA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=3lCd5ZVIbWuchuZIuC19wGKAjGNSjh6PPYl4PATf2gY=; b=g3AUzA94+m80nsjD43Cgt5P3RHWpK3I+IdWY1cIW/q7G8+dW0OQAxDPZ9712slVb7r CpGc6D0Rp0RqaTbU71vefV33hE/FPS5DSta42TK4qSKJ9d/8hEZXoEKXJUi5bYG9ANuL wTeCHLPlwBd7CB58a9jKUFX42wcmhOMDRXg4x1N/F2l6lIeXz0J6NR7ucGY7OAPqvS1O pi2TER1xSzWgYaMQqi1/Ah+BhI9ombi5/LlSGUyHDYdSPJb0TTY6HqDrUOM77NHODSPe JUC+45UbgQsH68iXeoxSIGgjwo7/98hHEdVxK8lR6j02Gn9zevXC60+XDdo1829l8ICY YOSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OyVjWHZf; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8-v6si31471411ple.222.2018.05.29.02.55.50; Tue, 29 May 2018 02:56:03 -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=@kernel.org header.s=default header.b=OyVjWHZf; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932890AbeE2Jy5 (ORCPT + 99 others); Tue, 29 May 2018 05:54:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:33862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932517AbeE2Jyt (ORCPT ); Tue, 29 May 2018 05:54:49 -0400 Received: from localhost (unknown [5.29.173.205]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2EDDE2086A; Tue, 29 May 2018 09:54:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527587688; bh=ynkKrvh4JRZrv6sYxvX19JfOyJFHvaYuATC0Q9lYAok=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OyVjWHZfSfRlfFvPqtbPNJ/Rz05dFKV3zl2zVuMg74FzDPt1RUzH9utuZh/hSFwAJ QCpqg6/3qX9RrD8mpqwK6Lf7u0CFkhKtixVT9z9+Cc2pOGY1Vn8itww8HxbwE6zGtK J1s69lvjL3O5Ncn6tm35pmdDtefi/lLxkcS5w79c= Date: Tue, 29 May 2018 12:54:45 +0300 From: Leon Romanovsky To: Hans Westgaard Ry Cc: Doug Ledford , Jason Gunthorpe , Hakon Bugge , Jack Morgenstein , Daniel Jurgens , Parav Pandit , Pravin Shedge , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] IB/mad: Use ID allocator routines to allocate agent number Message-ID: <20180529095445.GG3697@mtr-leonro.mtl.com> References: <20180529073808.27735-1-hans.westgaard.ry@oracle.com> <20180529085459.GF3697@mtr-leonro.mtl.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3Gf/FFewwPeBMqCJ" Content-Disposition: inline In-Reply-To: <20180529085459.GF3697@mtr-leonro.mtl.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --3Gf/FFewwPeBMqCJ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 29, 2018 at 11:54:59AM +0300, Leon Romanovsky 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. The current codebase uses a variable which is incremented > > atomically for each new agent number giving too large agent numbers > > over time. The IDA set of functions are used instead of the simple > > counter approach. This allows re-use of agent numbers. A sysctl > > variable is also introduced, to control the max agent number. > > Why don't you simply limit this number per-driver? By default, any > variable is allowed and mlx4_ib will set something else. > > What is the advantage of having sysctl? Anyway, it doesn't pass smoke test. [ 126.428407] RPC: Unregistered rdma transport module. [ 126.428513] RPC: Unregistered rdma backchannel transport module. [ 194.664081] IPv6: ADDRCONF(NETDEV_UP): ib0: link is not ready [ 209.068702] BUG: unable to handle kernel NULL pointer dereference at 0000000000000070 [ 209.068858] PGD 80000000341cf067 P4D 80000000341cf067 PUD 34188067 PMD 0 [ 209.068941] Oops: 0002 [#1] SMP PTI [ 209.069006] Modules linked in: netconsole nfsv3 nfs fscache mlx4_ib(-) mlx4_en mlx4_core devlink ib_ipoib rdma_ucm ib_ucm ib_uverbs ib_umad rdma_cm ib_cm iw_cm ib_core dm_mirror dm_region_hash dm_log dm_mod nfsd pcspkr i2c_piix4 auth_rpcgss nfs_acl lockd grace sunrpc ip_tables ata_generic cirrus drm_kms_helper pata_acpi syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm e1000 virtio_console i2c_core serio_raw ata_piix floppy [last unloaded: mlxfw] [ 209.069312] CPU: 4 PID: 11048 Comm: modprobe Not tainted 4.17.0-rc7-2018-05-29_11-04-56_Hans_Westgaard_Ry__hans_westga #1 [ 209.069413] Hardware name: Red Hat KVM, BIOS Bochs 01/01/2011 [ 209.069486] RIP: 0010:_raw_spin_lock_irqsave+0x1e/0x40 [ 209.069536] RSP: 0018:ffffc90000b4fd70 EFLAGS: 00010046 [ 209.069591] RAX: 0000000000000000 RBX: 0000000000000246 RCX: ffffea0004d7ed00 [ 209.069653] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000070 [ 209.069717] RBP: 0000000000000000 R08: ffff88013446fc00 R09: 000000018010000f [ 209.069778] R10: 0000000000000001 R11: ffff88013446fc00 R12: 0000000000000070 [ 209.069849] R13: 0000000000000202 R14: 0000000000000000 R15: 0000000000000000 [ 209.069915] FS: 00007fc34caf7740(0000) GS:ffff88013fd00000(0000) knlGS:0000000000000000 [ 209.069987] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 209.070043] CR2: 0000000000000070 CR3: 000000008853e000 CR4: 00000000000006e0 [ 209.070128] Call Trace: [ 209.070189] ib_unregister_mad_agent+0x2d/0x540 [ib_core] [ 209.070260] ? __slab_free+0x9a/0x2d0 [ 209.070332] ib_agent_port_close+0xad/0xf0 [ib_core] [ 209.070396] ib_mad_remove_device+0x59/0xb0 [ib_core] [ 209.070466] ib_unregister_device+0xd4/0x180 [ib_core] [ 209.070537] mlx4_ib_remove+0x67/0x1f0 [mlx4_ib] [ 209.070594] mlx4_remove_device+0x93/0xa0 [mlx4_core] [ 209.070648] mlx4_unregister_interface+0x37/0x90 [mlx4_core] [ 209.070705] mlx4_ib_cleanup+0xc/0x4db [mlx4_ib] [ 209.072113] __x64_sys_delete_module+0x15b/0x260 [ 209.073567] ? exit_to_usermode_loop+0x7f/0x95 [ 209.074945] do_syscall_64+0x48/0x100 [ 209.076448] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 209.077799] RIP: 0033:0x7fc34bfe36b7 [ 209.079122] RSP: 002b:00007ffc8ffa98b8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 [ 209.080500] RAX: ffffffffffffffda RBX: 00000000013455c0 RCX: 00007fc34bfe36b7 [ 209.081875] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 0000000001345628 [ 209.083265] RBP: 0000000000000000 R08: 00007fc34c2a8060 R09: 00007fc34c053a40 [ 209.084655] R10: 00007ffc8ffa9640 R11: 0000000000000206 R12: 0000000000000000 [ 209.086028] R13: 0000000000000001 R14: 0000000001345628 R15: 0000000000000000 [ 209.087416] Code: 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 53 9c 58 0f 1f 44 00 00 48 89 c3 fa 66 0f 1f 44 00 00 31 c0 ba 01 00 00 00 0f b1 17 85 c0 75 05 48 89 d8 5b c3 89 c6 e8 1e c9 81 ff eb [ 209.090262] RIP: _raw_spin_lock_irqsave+0x1e/0x40 RSP: ffffc90000b4fd70 [ 209.091720] CR2: 0000000000000070 [ 209.093137] ---[ end trace 7b8a6faa27868861 ]--- [ 209.094546] Kernel panic - not syncing: Fatal exception [ 209.096910] Kernel Offset: disabled [ 209.098291] ---[ end Kernel panic - not syncing: Fatal exception ]--- Thanks > > Thanks --3Gf/FFewwPeBMqCJ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJbDSNlAAoJEORje4g2clin8AMQALwvb8EGT0pBWmz2ec3hCW2S kqEynJc22mXk3O2Pz7R4rFG0UoUwTTVYYcYY7SMiJWV59M+BnpQ9jEihJ2Ng1ZlH cEvRS9+Y53LRYYadWn0JHGeSEBKGugaPIB4grTnIF3Nvik+zvFsWCE2/2lkidATc ExB4D8Or0tgkV+wCg3/sQmtAfQYFx6pzzftr5YKlVjSNUx3kMmM1VTjqIP9i96n7 jPWiW1rjSTG+9Mi6nMJKdjOZA7sjWBDDOrFGkYYmapVcuprEWQ7nWhhuylpCErJi Gl1hiDlD1hfLQUoPI0F2LZ1Rx4ZADhxLBkZ3jFQVcfRgsmL/M/tP+Qd2CcZdsegI 0GBXd/fzkKAy2TTlpnUeQ3q6l21SI7mq1AKnSB87sd9fllTTvwgm3/9d7Qz/6Zlf 2GFDDDZOTbkgh/f5+oVnggWyR86GaAdIl0zVTkz33gP0OrVKIYe98GPqM7l5j0b9 ggc8hGMg83ReaWTby9K/VjelRJUTqOlaNNdmDn1Qv2KfyMVZTZq62VKU1dZY5nmw fGk7++PKzDe+fHDTFQHIU3jIPxhsjyJQw2thwxlLK+kjqFjoUf3MMrgq7ymHz4Ho mTHtFlyg35x2cMGvnvZXzzez8kTNu7/WFlvm6V4UZIoNGAgMeujWACey5bgupWAs gXTtGXJg3Eayy1AR+0OF =STt8 -----END PGP SIGNATURE----- --3Gf/FFewwPeBMqCJ--