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: 142807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp4978861vqi; Thu, 21 Sep 2023 09:36:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcGoGp64+LX7Jj90ckJW5wH/q7bDiwPwtoJWm0rUnFtDqlKpqHS+S/t6PgMPXRT6cvUQL8 X-Received: by 2002:a05:6e02:2181:b0:34b:ba9b:c764 with SMTP id j1-20020a056e02218100b0034bba9bc764mr7521141ila.18.1695314184911; Thu, 21 Sep 2023 09:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695314184; cv=none; d=google.com; s=arc-20160816; b=D9mAfpcGSCyVsswsoEK9eahUK63UdlESNQIoHyZ39xpDHOnhJibuy+pOnsQy5Ae+uS j9r/mWK9b7MJ/+kJRYZ+8lEB4ETyEbVww4WI/TAQOXxC3+ywWSF8/dmT7lDYoznA31re oM7B0J9foMYtvwfNdd4/NsSovfpeOL0z4xEOo9D3hPEaBlb+chkLtJXg2AQtfyaN+SO9 UYr4XLUafKKI+qvh//pf7xqBkEOuM6mkBTh66mesVCNPMMgtBDWxrCIoWHydLpoUi7a8 zmpdewhT/5H1+ZUFwUDttGuOzbgkZnj2njhmX2NunEptrpMkUE/IPVBlsSY4NKLixpwf 14BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=j/K7bby96tUMA/iC07lWusXqTlhgR9zlJgJ7++h0ZQI=; fh=3J0v3VaTENk/DMzc7JGGBW1QJC1sH7oD+abUVn63OZg=; b=HxCLOs01/n8DVWMYxlL2n2GxuEmljvZ3i7p7u4UTjM8Mola0w8n6plP7jfj7oOSyf8 /qIxyPrSuFPmPMn7bkoYRCs+mIDUDx2dQBARk3sUSMLaYWNN6Vsuo9V7NqrPIjWC6SBr QJGZA+VDoE1clKRXdveCr6hbR3LTo000kTux6vSihe9B88booQaRMKnAtMVvYfRlo7tb 9FFyRxlpmODl5VpxA663q/kcWapayC8F9zQiSjbRzFn6nWfIG1iq3QuupgqVGN1hNX3W JnKtMEgOkjjNEGMBcb6GP7JwLLzmLPU4Wd9h6HTF6GiUcbFLxwR4Pe7VuYMU3Qon8Vnv Bjcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HNrA5sgo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a21-20020a63e855000000b0056aa105b6a4si1745432pgk.79.2023.09.21.09.36.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 09:36:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HNrA5sgo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8F12781A5A5B; Wed, 20 Sep 2023 15:24:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229473AbjITWYO (ORCPT + 27 others); Wed, 20 Sep 2023 18:24:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjITWYM (ORCPT ); Wed, 20 Sep 2023 18:24:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452AEE8 for ; Wed, 20 Sep 2023 15:22:50 -0700 (PDT) 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 15:24:32 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777665767062221715 X-GMAIL-MSGID: 1777665767062221715 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);