From patchwork Mon Sep 25 12:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13397689 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 13256CE7A95 for ; Mon, 25 Sep 2023 12:03:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C6E56B013A; Mon, 25 Sep 2023 08:03:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 928F26B013B; Mon, 25 Sep 2023 08:03:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A3C76B013E; Mon, 25 Sep 2023 08:03:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 64BFE6B013A for ; Mon, 25 Sep 2023 08:03:35 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3BBA440BFA for ; Mon, 25 Sep 2023 12:03:35 +0000 (UTC) X-FDA: 81274985190.16.D41EDEC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id C646716002A for ; Mon, 25 Sep 2023 12:03:31 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=D7xWpvJz; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf08.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=1695643411; 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=5yL4QkVP4RCNljG2YuH7ghrXGWSOXdG8ot8eukgNDz+KkWu5do6dd1Os+R/tw9yRzB816A 64oErO4u9i2lBfo+uf5blvHTAbjxK8TwXm08cKvsrLKSJAEQ3t536o47xhIexvMJDV8HfJ c16Y52FjgarCVBKs0tysLxONN5ZScDg= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=D7xWpvJz; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf08.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=1695643411; a=rsa-sha256; cv=none; b=BucMTHwu1HSotIBrxutdBf5Q2J0ggiib9ipprjgVyKwFlUbTLCF/iPPCeyn6m79WM/DWSu 3eQxaFidIwec2iDJVAlNSg5zWfQWCI0XgFAvkTX53SlwTY1W/mn0E6UCqHvx2Zm78IATGH lkYpIwK7rZThJPsJg/jpcV4vEmgaHDg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695643411; 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=D7xWpvJzU2dieu6MANtMV21oNUhIH+An7pAgX67s4qwHrSdfDfnd9pHiNcMV/iwqFUtLGD 2gI8A4KBmU5KgvoDLnUMYQIGJsOtHeZX0Ig9hO0oAB+Xkbj0d2av7cBkSoihv4vq9siVBY l/VqUDZAQ0vNcbWxnzZe01BnOo7CD+Q= 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-322-N5vnkQuMM-ymsL1ps_d4Kg-1; Mon, 25 Sep 2023 08:03:29 -0400 X-MC-Unique: N5vnkQuMM-ymsL1ps_d4Kg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 AC2E7802C1A; Mon, 25 Sep 2023 12:03:28 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB2892156701; Mon, 25 Sep 2023 12:03:25 +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 v7 04/12] infiniband: Use user_backed_iter() to see if iterator is UBUF/IOVEC Date: Mon, 25 Sep 2023 13:03:01 +0100 Message-ID: <20230925120309.1731676-5-dhowells@redhat.com> In-Reply-To: <20230925120309.1731676-1-dhowells@redhat.com> References: <20230925120309.1731676-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspamd-Queue-Id: C646716002A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: x3wteqxke5z6sm8nit3j16zgxc8kcqio X-HE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LWO/oRLknASd06iuuTGNuzjAGM7klxoD8HZAI7FfwoQyJ8lcUsWLaDYhkKTFJB1B37XFNX5ioOSJC+KtxkjiN62L4R2AjcvATQnFN7yXDbDKj0TSgamwsgmUqoM/3P58yNaazMM0FRFU+x1UOtuMAb0qg8mCF5rJnnSLHx+8/2TkQ8cU7/6Hy1z5zB55p3ei5qJikXoCx1BNTIC77NVbcfLgWxV0mgh0W66OvkUBWtrg1PO/6l70Bh7HM1e/u8Sl3dS/txwnimkEeDcJr0WA7MY6MJdlS8wk2syRlvsWCIYHs8L3y++tjHWwvA4LlnV2ufjoXfOO0rYXA= 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);