Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB6B43A759D for ; Wed, 20 May 2026 10:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779271917; cv=none; b=dqzAxHjSuI9xBThI+xQYyFUTJR8/fyxBz0VMsltqMVvziq5rA61ySzepRGvRdQNEUmYiVkrXSe58wjyprPYhaaAnOGgEbjUUVpLc247G/h6w97C7tREU6rRYNdEtvxUMb7vEf3PGXPO9H4p6wj8+3TZna/exJ/oyxxCi64usApk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779271917; c=relaxed/simple; bh=d+8Ec/ffNE5YUfBgkBR8Abr4reuwSabP2NOpyoCX1ks=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tApqqn3QwaMlmgnDJVdKSWRB8ut2cBzJY9dP7XufjkTZjL4ptDdwUgD4eVKDoK7aFucnYgogtByTLgZoW18Hm/osEGcDSEmp7nzFhua5OdTTKQDd6ZiWe0SKePD5ysWbyUuekLCeR6BaIylC09zC0nbnQc2aM0qHCbTyKMf1ko4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us; spf=none smtp.mailfrom=resnulli.us; dkim=pass (2048-bit key) header.d=resnulli-us.20251104.gappssmtp.com header.i=@resnulli-us.20251104.gappssmtp.com header.b=tAHZwuT7; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=resnulli.us Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20251104.gappssmtp.com header.i=@resnulli-us.20251104.gappssmtp.com header.b="tAHZwuT7" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-488b8bc6bc9so27318975e9.3 for ; Wed, 20 May 2026 03:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20251104.gappssmtp.com; s=20251104; t=1779271912; x=1779876712; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vdduK8eMpEjct8y6uHFcE34lkgqyAQEvN0CmvtgAtbs=; b=tAHZwuT7ri0AtMdpzR5WDvcWcLXp0f4K3ScAmi16oUOMF7KQv70x/awoLCL8cdjpQ9 cw5Rl+yYXKrcGsS0Z0FkFjeReKc6gBxQHoJi9XZre83zM5HfKCyFyjYEp1IGr2+xD7rn kMOqe+TpIfmAvee/w9CI535TUceh3YngrgI1yA4eGtQwr/5xK92crE//GcGfcu9Z6yGx VYj0b6cThXQwOAwUPXRjdwjEkJVQhhh8VOWQlb8UxdnHmHDlJN8GhbsYSdSvatYUv7r7 VCn4FfdHkvVLIBfiaNoZcWnWqdVcDoxnCabA8vaeFDipT+0FLPNIfwVEnUL38gMix+Mw 2IQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779271912; x=1779876712; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vdduK8eMpEjct8y6uHFcE34lkgqyAQEvN0CmvtgAtbs=; b=nldzVqXBknsqMsKVNZTwvzSJMU6mdF2CZKSeuemFFjAHEA3n+ZSr62d6uHgUqeHaa+ ZKA1+IVC41xlJlaThlqbTLgAsaqIVeFKhXitZRm4Bfz/YsG5UKIwMVAyGrnE7ooz8AIM 661jasPI/VGz+zKeJmduibhBHPJ58jgW1qXWKLBOEXXbYFezWJGd2orC7yub23teYe3o P3MGf52SOTO/hea1haEFzRBsGIUyOzyuyzwCNjqJurHq8z9WscUF7zQJiZ1J+DxiI06S FgUcvJLJ6hF+19pkTWHkbdgBh5se/tp8Au5KIOzVDId+DBNf2+P9nAehyADDGK/1vFBr yzDw== X-Gm-Message-State: AOJu0Yz+9SY4RIygAW+EjxM7DMfoWm28a73T+SygdyBt/OjnSYXAdqRx EQka2G9ylmhU37WTIq9hucr8CFxuBS3ovIK3rYMfn6IKX3730G5ct9tR8Ake+6hR0Xu7nXoNR14 et+Z5MOSWHA== X-Gm-Gg: Acq92OG72VJVQ0phOZivx+TMI6J6GKOBwymwWY6YUo/mLxYsD33ATnEPfk9SvAbTCKe s75nxo9MOW2zYVGqUmV/PQJARM4xgsaD6uakckGQFxNFqVmIBqRgoDyz1NqLse35IxEs2ESG7oD sNb0XZhjCJ5upWc2q/p4GNzjO/k1o2vuLm0yZJSxGkHFgMuu0Aecu7oZ+n0HLBlh6FPRrVwG0E8 QoqxviG7s8V0w5qC6lPEVPcIrwamMR6IXXBMZZbYwSs5qbbaw8OoyybHgv6Zfz4AoixUh4reGc4 Pxxzwo+qr6BAOEM//T1Jh07nnFBGRXUbdaFHl8tsyw9n1uwaw0UBnp3fBnz8K1izTxghHTCi7my 8MlTI1/K788JGnnAdBPfgLglCmsC5K6ZZLVCjLb4N5SCN6Cov4anONcfVYCJck9pMYl+iBHNetE xKu5sbKZIDXYNAbMJp9ZEmPWrws/H/bVDlThTgDl2+9Wg= X-Received: by 2002:a05:600c:8592:b0:48a:7aad:4425 with SMTP id 5b1f17b1804b1-48fe60e5235mr270850195e9.3.1779271911772; Wed, 20 May 2026 03:11:51 -0700 (PDT) Received: from localhost ([140.209.217.212]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48febe582d0sm156511025e9.18.2026.05.20.03.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 03:11:51 -0700 (PDT) From: Jiri Pirko To: linux-rdma@vger.kernel.org Cc: jgg@ziepe.ca, leon@kernel.org, edwards@nvidia.com, kees@kernel.org, parav@nvidia.com, mbloch@nvidia.com, yishaih@nvidia.com, lirongqing@baidu.com, huangjunxian6@hisilicon.com, liuy22@mails.tsinghua.edu.cn, jmoroni@google.com Subject: [PATCH rdma-next v6 11/15] RDMA/uverbs: Remove legacy umem field from struct ib_cq Date: Wed, 20 May 2026 12:11:25 +0200 Message-ID: <20260520101129.899464-12-jiri@resnulli.us> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520101129.899464-1-jiri@resnulli.us> References: <20260520101129.899464-1-jiri@resnulli.us> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jiri Pirko Now that all drivers use helper to get umem and manage the lifetime, legacy umem field in struct ib_cq is no longer needed. Remove it along with ib_umem_get_cq_tmp() helper that populated it and both error and destroy paths. Signed-off-by: Jiri Pirko --- v2->v3: - rebased on top of umem_list removal --- drivers/infiniband/core/umem.c | 29 ------------------- drivers/infiniband/core/uverbs_cmd.c | 1 - drivers/infiniband/core/uverbs_std_types_cq.c | 17 ----------- drivers/infiniband/core/verbs.c | 7 ----- include/rdma/ib_umem.h | 7 ----- include/rdma/ib_verbs.h | 1 - 6 files changed, 62 deletions(-) diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 233c4631f3a5..c449eb396a00 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -589,35 +589,6 @@ struct ib_umem *ib_umem_get_cq_buf_or_va(struct ib_device *device, } EXPORT_SYMBOL(ib_umem_get_cq_buf_or_va); -/** - * ib_umem_get_cq_tmp - Temporary CQ buffer umem getter. - * @device: IB device. - * @attrs: uverbs attribute bundle. - * - * Pins a CQ buffer described by the legacy CQ buffer attributes. - * Returns NULL when none are supplied. - * - * Will be removed once all CQ drivers have switched to get - * their buffer directly. - * - * Return: caller-owned umem on success; NULL when no legacy attribute - * is supplied; ERR_PTR(...) on error. - */ -struct ib_umem *ib_umem_get_cq_tmp(struct ib_device *device, - struct uverbs_attr_bundle *attrs) -{ - struct ib_uverbs_buffer_desc desc = {}; - int ret; - - ret = uverbs_create_cq_get_buffer_desc(attrs, &desc); - if (ret == -ENODATA) - return NULL; - if (ret) - return ERR_PTR(ret); - return ib_umem_get_desc(device, &desc, IB_ACCESS_LOCAL_WRITE); -} -EXPORT_SYMBOL(ib_umem_get_cq_tmp); - /** * ib_umem_release - release pinned memory * @umem: umem struct to release diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index fce6eb18287a..8eed017091b0 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -1079,7 +1079,6 @@ static int create_cq(struct uverbs_attr_bundle *attrs, return uverbs_response(attrs, &resp, sizeof(resp)); err_free: - ib_umem_release(cq->umem); rdma_restrack_put(&cq->res); kfree(cq); err_file: diff --git a/drivers/infiniband/core/uverbs_std_types_cq.c b/drivers/infiniband/core/uverbs_std_types_cq.c index 05d1294762c0..148cdd180dab 100644 --- a/drivers/infiniband/core/uverbs_std_types_cq.c +++ b/drivers/infiniband/core/uverbs_std_types_cq.c @@ -68,7 +68,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)( struct ib_device *ib_dev = attrs->context->device; struct ib_cq_init_attr attr = {}; struct ib_uobject *ev_file_uobj; - struct ib_umem *umem = NULL; struct ib_cq *cq; u64 user_handle; int ret; @@ -117,16 +116,9 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)( INIT_LIST_HEAD(&obj->comp_list); INIT_LIST_HEAD(&obj->uevent.event_list); - umem = ib_umem_get_cq_tmp(ib_dev, attrs); - if (IS_ERR(umem)) { - ret = PTR_ERR(umem); - goto err_event_file; - } - cq = rdma_zalloc_drv_obj(ib_dev, ib_cq); if (!cq) { ret = -ENOMEM; - ib_umem_release(umem); goto err_event_file; } @@ -135,11 +127,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)( cq->comp_handler = ib_uverbs_comp_handler; cq->event_handler = ib_uverbs_cq_event_handler; cq->cq_context = ev_file ? &ev_file->ev_queue : NULL; - /* - * If UMEM is not provided here, legacy drivers will set it during - * CQ creation based on their internal udata. - */ - cq->umem = umem; atomic_set(&cq->usecnt, 0); rdma_restrack_new(&cq->res, RDMA_RESTRACK_CQ); @@ -152,9 +139,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)( if (ret) goto err_free; - /* Check that driver didn't overrun existing umem */ - WARN_ON(umem && cq->umem != umem); - obj->uevent.uobject.object = cq; obj->uevent.uobject.user_handle = user_handle; rdma_restrack_add(&cq->res); @@ -165,7 +149,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)( return ret; err_free: - ib_umem_release(cq->umem); rdma_restrack_put(&cq->res); kfree(cq); err_event_file: diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index bac87de9cc67..de7d19fabd75 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -2221,12 +2221,6 @@ struct ib_cq *__ib_create_cq(struct ib_device *device, kfree(cq); return ERR_PTR(ret); } - /* - * We are in kernel verbs flow and drivers are not allowed - * to set umem pointer, it needs to stay NULL. - */ - WARN_ON_ONCE(cq->umem); - rdma_restrack_add(&cq->res); return cq; } @@ -2257,7 +2251,6 @@ int ib_destroy_cq_user(struct ib_cq *cq, struct ib_udata *udata) if (ret) return ret; - ib_umem_release(cq->umem); rdma_restrack_del(&cq->res); kfree(cq); return ret; diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h index 492c8d365730..370d802f0e63 100644 --- a/include/rdma/ib_umem.h +++ b/include/rdma/ib_umem.h @@ -96,8 +96,6 @@ struct ib_umem *ib_umem_get_cq_buf(struct ib_device *device, struct ib_umem *ib_umem_get_cq_buf_or_va(struct ib_device *device, const struct uverbs_attr_bundle *attrs, u64 addr, size_t size, int access); -struct ib_umem *ib_umem_get_cq_tmp(struct ib_device *device, - struct uverbs_attr_bundle *attrs); static inline struct ib_umem *ib_umem_get_va(struct ib_device *device, unsigned long addr, size_t size, @@ -229,11 +227,6 @@ ib_umem_get_cq_buf_or_va(struct ib_device *device, { return ERR_PTR(-EOPNOTSUPP); } -static inline struct ib_umem * -ib_umem_get_cq_tmp(struct ib_device *device, struct uverbs_attr_bundle *attrs) -{ - return ERR_PTR(-EOPNOTSUPP); -} static inline void ib_umem_release(struct ib_umem *umem) { } static inline int ib_umem_copy_from(void *dst, struct ib_umem *umem, size_t offset, size_t length) { diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 9dd76f489a0b..167fb924f0cf 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1738,7 +1738,6 @@ struct ib_cq { u8 interrupt:1; u8 shared:1; unsigned int comp_vector; - struct ib_umem *umem; /* * Implementation details of the RDMA core, don't use in drivers: -- 2.54.0