From patchwork Wed Sep 20 22:22:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13393496 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 B0E32CD13CF for ; Wed, 20 Sep 2023 22:22:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 329586B019A; Wed, 20 Sep 2023 18:22:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D8A66B019F; Wed, 20 Sep 2023 18:22:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 152A56B01A1; Wed, 20 Sep 2023 18:22:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 013CB6B019A for ; Wed, 20 Sep 2023 18:22:52 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CDC73C0D97 for ; Wed, 20 Sep 2023 22:22:52 +0000 (UTC) X-FDA: 81258401784.27.27200E5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id 2DE8E1C0022 for ; Wed, 20 Sep 2023 22:22:50 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HNrA5sgo; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.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=1695248570; 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=MtOjDqv0+Kph2xnYKalmFxB+Ts156OF7V8Ox3qV0NzDb4AEGNBBPhfNzBmne2yyAVDbEwV qNZHdnjoTiif6hwYKriUAtWS15GoFnQd5Wm/tMpC4Kpp5hERZFNZcLIqVJeEV5gL2HQCIJ H5YuSVBaKz8max0t1ZeEJD+jsd7oeNQ= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=HNrA5sgo; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf18.hostedemail.com: domain of dhowells@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695248570; a=rsa-sha256; cv=none; b=pSlpbZJrJLPMvlxiQx0xVUhHeA5ky7/dd8+zxKbcsQZRc8XKf+SflvHAoEdOGg8rJjuu0B KPvg8YvZbuZAoIEfBD0z4TjEkUio6AXhYx8FidaTVzeagbhCh1TiRRzb+pHfykZxoqgUee 0mWDvPNpwOEVVc5E/tsfzKYRDEu0BG8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695248569; 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=HNrA5sgovKS1kYk9UfNGmHYAz7nChnCdT3FWFbWnqhOo/pxr1GRLqWhh/q1UGwBSm1l+po b2e7Y60WaW+CiO2YOV+jBy3KOTOdfguBAr4obWQoXgf1wuex3P8UO3XfikR8+HGv/yOnNJ ztpeaMoCxMyUeAOgAanux1iwaxp0aJU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-qSI8WUj0N3Orf3pb4D2D6g-1; Wed, 20 Sep 2023 18:22:45 -0400 X-MC-Unique: qSI8WUj0N3Orf3pb4D2D6g-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 58FB9185A797; Wed, 20 Sep 2023 22:22:44 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB58E492C37; Wed, 20 Sep 2023 22:22: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 v5 02/11] infiniband: Use user_backed_iter() to see if iterator is UBUF/IOVEC Date: Wed, 20 Sep 2023 23:22:22 +0100 Message-ID: <20230920222231.686275-3-dhowells@redhat.com> In-Reply-To: <20230920222231.686275-1-dhowells@redhat.com> References: <20230920222231.686275-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2DE8E1C0022 X-Stat-Signature: ibiocqyjgp3a8xh9srtt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RRB1l+qVqPtfcqE/YDrHgX9Pr5ObnDViw3aXjgUCqLucE8DYbO/d1h7OMAAfYVVdqp9AM6EgqHvekmvbpgNAU9Qi3VcryTDDUYDjxOqPmrD/vKhqzOG3GHrhdqm74Q2FYk8Lx/Oj3MsbVxw3FCHlhjZ8x5lsROBX08bmSkOYel+zUg0IdJg6PH+Iz6y5dLXils26FdhWERfXNpqBxzCHO9Skr1FpxyTRMJB75zUgsT6NHTPm+Ye0qo1u37T3z1ApCI99syfQM2zD5xGlLyw6aCiikD864F0FSQQNGh5ozQDcTgxrOxjH11JBWms4mpIcO6h1mRhIN+tFXurys0= 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);