All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] Set steering-tag directly for PCIe P2P memory access
@ 2025-11-13 21:37 Zhiping Zhang
  2025-11-13 21:37 ` [RFC 1/2] " Zhiping Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Zhiping Zhang @ 2025-11-13 21:37 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky, Bjorn Helgaas, linux-rdma,
	linux-pci, netdev, Keith Busch, Yochai Cohen, Yishai Hadas
  Cc: Zhiping Zhang

Currently, the steering tag can be used for a CPU on the motherboard; the
ACPI check is in place to query and obtain the supported steering tag. This
same check is not possible for the accelerator devices because they are 
designed to be plug-and-play to and ownership can not be always confirmed.

We intend to use the steering tag to improve RDMA NIC memory access on a GPU
or accelerator device via PCIe peer-to-peer. An application can construct a
dma handler (DMAH) with the device memory type and a direct steering-tag
value, and this DMAH can be used to register a RDMA memory region with DMABUF
for the RDMA NIC to access the device memory. The steering tag contains
additional instructions or hints to the GPU or accelerator device for
advanced memory operations, such as, read cache selection.

Signed-off-by: Zhiping Zhang <zhipingz@meta.com>

Zhiping Zhang (2):
  PCIe: Add a memory type for P2P memory access
  RDMA: Set steering-tag value directly for P2P memory access

 .../infiniband/core/uverbs_std_types_dmah.c   | 28 +++++++++++++++++++
 drivers/infiniband/core/uverbs_std_types_mr.c |  3 ++
 drivers/infiniband/hw/mlx5/dmah.c             |  5 ++--
 .../net/ethernet/mellanox/mlx5/core/lib/st.c  | 12 +++++---
 drivers/pci/tph.c                             |  4 +++
 include/linux/mlx5/driver.h                   |  4 +--
 include/linux/pci-tph.h                       |  4 ++-
 include/rdma/ib_verbs.h                       |  2 ++
 include/uapi/rdma/ib_user_ioctl_cmds.h        |  1 +
 9 files changed, 53 insertions(+), 10 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: [RFC 2/2] Set steering-tag directly for PCIe P2P memory access
@ 2025-11-18  7:38 ` Dan Carpenter
  0 siblings, 0 replies; 21+ messages in thread
From: kernel test robot @ 2025-11-17  8:55 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20251113213712.776234-3-zhipingz@meta.com>
References: <20251113213712.776234-3-zhipingz@meta.com>
TO: Zhiping Zhang <zhipingz@meta.com>

Hi Zhiping,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on pci/next]
[also build test WARNING on pci/for-linus linus/master v6.18-rc6 next-20251114]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Zhiping-Zhang/Set-steering-tag-directly-for-PCIe-P2P-memory-access/20251114-054930
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link:    https://lore.kernel.org/r/20251113213712.776234-3-zhipingz%40meta.com
patch subject: [RFC 2/2] Set steering-tag directly for PCIe P2P memory access
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-161-20251117 (https://download.01.org/0day-ci/archive/20251117/202511171603.TwX3hgKc-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202511171603.TwX3hgKc-lkp@intel.com/

smatch warnings:
drivers/net/ethernet/mellanox/mlx5/core/lib/st.c:139 mlx5_st_alloc_index() error: uninitialized symbol 'ret'.

vim +/ret +139 drivers/net/ethernet/mellanox/mlx5/core/lib/st.c

888a7776f4fb04 Yishai Hadas  2025-07-17   81  
888a7776f4fb04 Yishai Hadas  2025-07-17   82  int mlx5_st_alloc_index(struct mlx5_core_dev *dev, enum tph_mem_type mem_type,
1f035dcb026b8a Zhiping Zhang 2025-11-13   83  			unsigned int cpu_uid, u16 *st_index, u16 direct_st_val)
888a7776f4fb04 Yishai Hadas  2025-07-17   84  {
888a7776f4fb04 Yishai Hadas  2025-07-17   85  	struct mlx5_st_idx_data *idx_data;
888a7776f4fb04 Yishai Hadas  2025-07-17   86  	struct mlx5_st *st = dev->st;
888a7776f4fb04 Yishai Hadas  2025-07-17   87  	unsigned long index;
888a7776f4fb04 Yishai Hadas  2025-07-17   88  	u32 xa_id;
888a7776f4fb04 Yishai Hadas  2025-07-17   89  	u16 tag;
888a7776f4fb04 Yishai Hadas  2025-07-17   90  	int ret;
888a7776f4fb04 Yishai Hadas  2025-07-17   91  
888a7776f4fb04 Yishai Hadas  2025-07-17   92  	if (!st)
888a7776f4fb04 Yishai Hadas  2025-07-17   93  		return -EOPNOTSUPP;
888a7776f4fb04 Yishai Hadas  2025-07-17   94  
1f035dcb026b8a Zhiping Zhang 2025-11-13   95  	if (mem_type == TPH_MEM_TYPE_P2P)
1f035dcb026b8a Zhiping Zhang 2025-11-13   96  		tag = direct_st_val;
1f035dcb026b8a Zhiping Zhang 2025-11-13   97  	else {
888a7776f4fb04 Yishai Hadas  2025-07-17   98  		ret = pcie_tph_get_cpu_st(dev->pdev, mem_type, cpu_uid, &tag);
888a7776f4fb04 Yishai Hadas  2025-07-17   99  		if (ret)
888a7776f4fb04 Yishai Hadas  2025-07-17  100  			return ret;
1f035dcb026b8a Zhiping Zhang 2025-11-13  101  	}
888a7776f4fb04 Yishai Hadas  2025-07-17  102  
888a7776f4fb04 Yishai Hadas  2025-07-17  103  	mutex_lock(&st->lock);
888a7776f4fb04 Yishai Hadas  2025-07-17  104  
888a7776f4fb04 Yishai Hadas  2025-07-17  105  	xa_for_each(&st->idx_xa, index, idx_data) {
888a7776f4fb04 Yishai Hadas  2025-07-17  106  		if (tag == idx_data->tag) {
888a7776f4fb04 Yishai Hadas  2025-07-17  107  			refcount_inc(&idx_data->usecount);
888a7776f4fb04 Yishai Hadas  2025-07-17  108  			*st_index = index;
888a7776f4fb04 Yishai Hadas  2025-07-17  109  			goto end;
888a7776f4fb04 Yishai Hadas  2025-07-17  110  		}
888a7776f4fb04 Yishai Hadas  2025-07-17  111  	}
888a7776f4fb04 Yishai Hadas  2025-07-17  112  
888a7776f4fb04 Yishai Hadas  2025-07-17  113  	idx_data = kzalloc(sizeof(*idx_data), GFP_KERNEL);
888a7776f4fb04 Yishai Hadas  2025-07-17  114  	if (!idx_data) {
888a7776f4fb04 Yishai Hadas  2025-07-17  115  		ret = -ENOMEM;
888a7776f4fb04 Yishai Hadas  2025-07-17  116  		goto end;
888a7776f4fb04 Yishai Hadas  2025-07-17  117  	}
888a7776f4fb04 Yishai Hadas  2025-07-17  118  
888a7776f4fb04 Yishai Hadas  2025-07-17  119  	refcount_set(&idx_data->usecount, 1);
888a7776f4fb04 Yishai Hadas  2025-07-17  120  	idx_data->tag = tag;
888a7776f4fb04 Yishai Hadas  2025-07-17  121  
888a7776f4fb04 Yishai Hadas  2025-07-17  122  	ret = xa_alloc(&st->idx_xa, &xa_id, idx_data, st->index_limit, GFP_KERNEL);
888a7776f4fb04 Yishai Hadas  2025-07-17  123  	if (ret)
888a7776f4fb04 Yishai Hadas  2025-07-17  124  		goto clean_idx_data;
888a7776f4fb04 Yishai Hadas  2025-07-17  125  
888a7776f4fb04 Yishai Hadas  2025-07-17  126  	ret = pcie_tph_set_st_entry(dev->pdev, xa_id, tag);
888a7776f4fb04 Yishai Hadas  2025-07-17  127  	if (ret)
888a7776f4fb04 Yishai Hadas  2025-07-17  128  		goto clean_idx_xa;
888a7776f4fb04 Yishai Hadas  2025-07-17  129  
888a7776f4fb04 Yishai Hadas  2025-07-17  130  	*st_index = xa_id;
888a7776f4fb04 Yishai Hadas  2025-07-17  131  	goto end;
888a7776f4fb04 Yishai Hadas  2025-07-17  132  
888a7776f4fb04 Yishai Hadas  2025-07-17  133  clean_idx_xa:
888a7776f4fb04 Yishai Hadas  2025-07-17  134  	xa_erase(&st->idx_xa, xa_id);
888a7776f4fb04 Yishai Hadas  2025-07-17  135  clean_idx_data:
888a7776f4fb04 Yishai Hadas  2025-07-17  136  	kfree(idx_data);
888a7776f4fb04 Yishai Hadas  2025-07-17  137  end:
888a7776f4fb04 Yishai Hadas  2025-07-17  138  	mutex_unlock(&st->lock);
888a7776f4fb04 Yishai Hadas  2025-07-17 @139  	return ret;
888a7776f4fb04 Yishai Hadas  2025-07-17  140  }
888a7776f4fb04 Yishai Hadas  2025-07-17  141  EXPORT_SYMBOL_GPL(mlx5_st_alloc_index);
888a7776f4fb04 Yishai Hadas  2025-07-17  142  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-02-02  6:04 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 21:37 [RFC 0/2] Set steering-tag directly for PCIe P2P memory access Zhiping Zhang
2025-11-13 21:37 ` [RFC 1/2] " Zhiping Zhang
2025-11-14 13:12   ` Jonathan Cameron
2025-11-18  0:50     ` zhipingz
2025-11-24 21:27   ` Bjorn Helgaas
2025-12-01 17:43     ` Zhiping Zhang
2025-11-13 21:37 ` [RFC 2/2] " Zhiping Zhang
2025-11-17 16:00   ` Jason Gunthorpe
2025-11-20  7:24     ` Zhiping Zhang
2025-11-20 13:11       ` Jason Gunthorpe
2025-12-04  8:10         ` Zhiping Zhang
2025-12-27 19:22           ` Zhiping Zhang
2026-01-06  0:57             ` Jason Gunthorpe
2026-01-13  7:43               ` Zhiping Zhang
2026-01-13 16:49                 ` Jason Gunthorpe
2026-01-24  1:13                   ` Zhiping Zhang
2026-01-28 16:57                     ` Jason Gunthorpe
2026-02-02  6:04                       ` Zhiping Zhang
2026-01-03  5:38 ` [RFC 2/2] [fix] mlx5: modifications for use cases other than CPU Zhiping Zhang
  -- strict thread matches above, loose matches on Subject: below --
2025-11-17  8:55 [RFC 2/2] Set steering-tag directly for PCIe P2P memory access kernel test robot
2025-11-18  7:38 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.