From patchwork Fri Sep 22 12:02:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13395702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A88DC04AAB for ; Fri, 22 Sep 2023 12:02:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DEAFF6B02C8; Fri, 22 Sep 2023 08:02:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D73576B02C9; Fri, 22 Sep 2023 08:02:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C13BF6B02CA; Fri, 22 Sep 2023 08:02:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ADA0E6B02C8 for ; Fri, 22 Sep 2023 08:02:51 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7ECF11A1008 for ; Fri, 22 Sep 2023 12:02:51 +0000 (UTC) X-FDA: 81264096942.22.DADFBDD Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 8039A1C0044 for ; Fri, 22 Sep 2023 12:02:48 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=f0Aphdli; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695384168; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=j/K7bby96tUMA/iC07lWusXqTlhgR9zlJgJ7++h0ZQI=; b=OuphWCjZdp7UX9hQQgNJN9WhEv5abZ16V4Crew9r3WHtsqlxDNvTyedqNZVtbCCtB/Cjlt WhWQfJvBVdTx2XZxDogH7xrXgUrLqC3qO0rGLm8hqwvJbIUPBpSYEUxEcBE/WBnmq97r+A WicE+bbqKPba0A2vX+XOJxHYe/ZMbSI= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=f0Aphdli; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695384168; a=rsa-sha256; cv=none; b=QB+JN8pNFYrJH6JZdXvcHYfCiQDGnVMzrz7CnWES0atAeiba434TalOniZAZuWkWiCzZBI 37WyJQClRST1/S6cZHaoJvhQYq2q0AzDbGuh9kWZXwdePhz027VDBSXZu/KPEfi6IrCKxf nqYe2jB5aEhM+fze8FOvhMCiVtBYSXo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695384167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j/K7bby96tUMA/iC07lWusXqTlhgR9zlJgJ7++h0ZQI=; b=f0AphdliAb1hv6cAOvrk79VKuRoMOUGfkm5jARoBysxyIjsPw9e5rJ/Y+u7L3efyNguivI DEv5FkIFUyviOaLW9Ph102CGICxcuP6bf5fjlAAkHXInPW8nmMkjLhGdl9CSHIfBXM/7VY tVR9WVEjcFGMHySXtil7SWOnH0Rnheo= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-160-cipZYxGtNhaQj5TKw06UkQ-1; Fri, 22 Sep 2023 08:02:43 -0400 X-MC-Unique: cipZYxGtNhaQj5TKw06UkQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C824A1C01731; Fri, 22 Sep 2023 12:02:42 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FF4820268D6; Fri, 22 Sep 2023 12:02:40 +0000 (UTC) From: David Howells To: Jens Axboe Cc: David Howells , Al Viro , Linus Torvalds , Christoph Hellwig , Christian Brauner , David Laight , Matthew Wilcox , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org Subject: [PATCH v6 04/13] infiniband: Use user_backed_iter() to see if iterator is UBUF/IOVEC Date: Fri, 22 Sep 2023 13:02:18 +0100 Message-ID: <20230922120227.1173720-5-dhowells@redhat.com> In-Reply-To: <20230922120227.1173720-1-dhowells@redhat.com> References: <20230922120227.1173720-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Rspamd-Queue-Id: 8039A1C0044 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 6hpzaiyhwrpdyy6jsconaxfumer4ps7r X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EO1RWHY33/5MtVG2M93tqaAufxpa3/gjUPaL8XWquPLaMVlYmAuuObaUmPVzzwgRVshLxct/o+QDC0nkf32pkOcg6SC07eeGec1Pup0GuvEecCOsR10777D6iwV0G6DP/TkYMlDl45Lp385o5JGcO8Hu8k3tM2Fq0pF4twz1HVJXKwUsI8RVmwB9wG6AFP83nSJENE1A742ZClfP4o7degJU23EarhjxQLUTyJgZEZKVjCt5C0OFGsgGOMsmU6E1RD20IwTdqnSN84Noh5TAEL70lEouIHoshHh8uu+yHmyF2tTrhSrbSDc/9g52xSgwFeOPo2G+s5feLLIqNS+5ceEjfVE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use user_backed_iter() to see if iterator is UBUF/IOVEC rather than poking inside the iterator. Signed-off-by: David Howells cc: Dennis Dalessandro cc: Jason Gunthorpe cc: Leon Romanovsky cc: linux-rdma@vger.kernel.org --- drivers/infiniband/hw/hfi1/file_ops.c | 2 +- drivers/infiniband/hw/qib/qib_file_ops.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c index a5ab22cedd41..788fc249234f 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -267,7 +267,7 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from) if (!HFI1_CAP_IS_KSET(SDMA)) return -EINVAL; - if (!from->user_backed) + if (!user_backed_iter(from)) return -EINVAL; idx = srcu_read_lock(&fd->pq_srcu); pq = srcu_dereference(fd->pq, &fd->pq_srcu); diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c index 152952127f13..29e4c59aa23b 100644 --- a/drivers/infiniband/hw/qib/qib_file_ops.c +++ b/drivers/infiniband/hw/qib/qib_file_ops.c @@ -2244,7 +2244,7 @@ static ssize_t qib_write_iter(struct kiocb *iocb, struct iov_iter *from) struct qib_ctxtdata *rcd = ctxt_fp(iocb->ki_filp); struct qib_user_sdma_queue *pq = fp->pq; - if (!from->user_backed || !from->nr_segs || !pq) + if (!user_backed_iter(from) || !from->nr_segs || !pq) return -EINVAL; return qib_user_sdma_writev(rcd, pq, iter_iov(from), from->nr_segs);