lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 10 Oct 2020 11:36:49 +0000
From:   "Bernard Metzler" <BMT@...ich.ibm.com>
To:     ira.weiny@...el.com
Cc:     "Andrew Morton" <akpm@...ux-foundation.org>,
        "Thomas Gleixner" <tglx@...utronix.de>,
        "Ingo Molnar" <mingo@...hat.com>, "Borislav Petkov" <bp@...en8.de>,
        "Andy Lutomirski" <luto@...nel.org>,
        "Peter Zijlstra" <peterz@...radead.org>,
        "Mike Marciniszyn" <mike.marciniszyn@...el.com>,
        "Dennis Dalessandro" <dennis.dalessandro@...el.com>,
        "Doug Ledford" <dledford@...hat.com>,
        "Jason Gunthorpe" <jgg@...pe.ca>,
        "Faisal Latif" <faisal.latif@...el.com>,
        "Shiraz Saleem" <shiraz.saleem@...el.com>, x86@...nel.org,
        "Dave Hansen" <dave.hansen@...ux.intel.com>,
        "Dan Williams" <dan.j.williams@...el.com>,
        "Fenghua Yu" <fenghua.yu@...el.com>, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-nvdimm@...ts.01.org,
        linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        linux-kselftest@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        kvm@...r.kernel.org, netdev@...r.kernel.org, bpf@...r.kernel.org,
        kexec@...ts.infradead.org, linux-bcache@...r.kernel.org,
        linux-mtd@...ts.infradead.org, devel@...verdev.osuosl.org,
        linux-efi@...r.kernel.org, linux-mmc@...r.kernel.org,
        linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
        linux-nfs@...r.kernel.org, ceph-devel@...r.kernel.org,
        linux-ext4@...r.kernel.org, linux-aio@...ck.org,
        io-uring@...r.kernel.org, linux-erofs@...ts.ozlabs.org,
        linux-um@...ts.infradead.org, linux-ntfs-dev@...ts.sourceforge.net,
        reiserfs-devel@...r.kernel.org,
        linux-f2fs-devel@...ts.sourceforge.net,
        linux-nilfs@...r.kernel.org, cluster-devel@...hat.com,
        ecryptfs@...r.kernel.org, linux-cifs@...r.kernel.org,
        linux-btrfs@...r.kernel.org, linux-afs@...ts.infradead.org,
        linux-rdma@...r.kernel.org, amd-gfx@...ts.freed.esktop.org,
        dri-devel@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
        drbd-dev@...n.linbit.com, linux-block@...r.kernel.org,
        xen-devel@...ts.xenproject.org, linux-cachefs@...hat.com,
        samba-technical@...ts.samba.org, intel-wired-lan@...ts.osuosl.org
Subject: Re: [PATCH RFC PKS/PMEM 10/58] drivers/rdma: Utilize new kmap_thread()

-----ira.weiny@...el.com wrote: -----

>To: "Andrew Morton" <akpm@...ux-foundation.org>, "Thomas Gleixner"
><tglx@...utronix.de>, "Ingo Molnar" <mingo@...hat.com>, "Borislav
>Petkov" <bp@...en8.de>, "Andy Lutomirski" <luto@...nel.org>, "Peter
>Zijlstra" <peterz@...radead.org>
>From: ira.weiny@...el.com
>Date: 10/09/2020 09:52PM
>Cc: "Ira Weiny" <ira.weiny@...el.com>, "Mike Marciniszyn"
><mike.marciniszyn@...el.com>, "Dennis Dalessandro"
><dennis.dalessandro@...el.com>, "Doug Ledford" <dledford@...hat.com>,
>"Jason Gunthorpe" <jgg@...pe.ca>, "Faisal Latif"
><faisal.latif@...el.com>, "Shiraz Saleem" <shiraz.saleem@...el.com>,
>"Bernard Metzler" <bmt@...ich.ibm.com>, x86@...nel.org, "Dave Hansen"
><dave.hansen@...ux.intel.com>, "Dan Williams"
><dan.j.williams@...el.com>, "Fenghua Yu" <fenghua.yu@...el.com>,
>linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
>linux-nvdimm@...ts.01.org, linux-fsdevel@...r.kernel.org,
>linux-mm@...ck.org, linux-kselftest@...r.kernel.org,
>linuxppc-dev@...ts.ozlabs.org, kvm@...r.kernel.org,
>netdev@...r.kernel.org, bpf@...r.kernel.org,
>kexec@...ts.infradead.org, linux-bcache@...r.kernel.org,
>linux-mtd@...ts.infradead.org, devel@...verdev.osuosl.org,
>linux-efi@...r.kernel.org, linux-mmc@...r.kernel.org,
>linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
>linux-nfs@...r.kernel.org, ceph-devel@...r.kernel.org,
>linux-ext4@...r.kernel.org, linux-aio@...ck.org,
>io-uring@...r.kernel.org, linux-erofs@...ts.ozlabs.org,
>linux-um@...ts.infradead.org, linux-ntfs-dev@...ts.sourceforge.net,
>reiserfs-devel@...r.kernel.org,
>linux-f2fs-devel@...ts.sourceforge.net, linux-nilfs@...r.kernel.org,
>cluster-devel@...hat.com, ecryptfs@...r.kernel.org,
>linux-cifs@...r.kernel.org, linux-btrfs@...r.kernel.org,
>linux-afs@...ts.infradead.org, linux-rdma@...r.kernel.org,
>amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
>intel-gfx@...ts.freedesktop.org, drbd-dev@...n.linbit.com,
>linux-block@...r.kernel.org, xen-devel@...ts.xenproject.org,
>linux-cachefs@...hat.com, samba-technical@...ts.samba.org,
>intel-wired-lan@...ts.osuosl.org
>Subject: [EXTERNAL] [PATCH RFC PKS/PMEM 10/58] drivers/rdma: Utilize
>new kmap_thread()
>
>From: Ira Weiny <ira.weiny@...el.com>
>
>The kmap() calls in these drivers are localized to a single thread.
>To
>avoid the over head of global PKRS updates use the new kmap_thread()
>call.
>
>Cc: Mike Marciniszyn <mike.marciniszyn@...el.com>
>Cc: Dennis Dalessandro <dennis.dalessandro@...el.com>
>Cc: Doug Ledford <dledford@...hat.com>
>Cc: Jason Gunthorpe <jgg@...pe.ca>
>Cc: Faisal Latif <faisal.latif@...el.com>
>Cc: Shiraz Saleem <shiraz.saleem@...el.com>
>Cc: Bernard Metzler <bmt@...ich.ibm.com>
>Signed-off-by: Ira Weiny <ira.weiny@...el.com>
>---
> drivers/infiniband/hw/hfi1/sdma.c      |  4 ++--
> drivers/infiniband/hw/i40iw/i40iw_cm.c | 10 +++++-----
> drivers/infiniband/sw/siw/siw_qp_tx.c  | 14 +++++++-------
> 3 files changed, 14 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/infiniband/hw/hfi1/sdma.c
>b/drivers/infiniband/hw/hfi1/sdma.c
>index 04575c9afd61..09d206e3229a 100644
>--- a/drivers/infiniband/hw/hfi1/sdma.c
>+++ b/drivers/infiniband/hw/hfi1/sdma.c
>@@ -3130,7 +3130,7 @@ int ext_coal_sdma_tx_descs(struct hfi1_devdata
>*dd, struct sdma_txreq *tx,
> 		}
> 
> 		if (type == SDMA_MAP_PAGE) {
>-			kvaddr = kmap(page);
>+			kvaddr = kmap_thread(page);
> 			kvaddr += offset;
> 		} else if (WARN_ON(!kvaddr)) {
> 			__sdma_txclean(dd, tx);
>@@ -3140,7 +3140,7 @@ int ext_coal_sdma_tx_descs(struct hfi1_devdata
>*dd, struct sdma_txreq *tx,
> 		memcpy(tx->coalesce_buf + tx->coalesce_idx, kvaddr, len);
> 		tx->coalesce_idx += len;
> 		if (type == SDMA_MAP_PAGE)
>-			kunmap(page);
>+			kunmap_thread(page);
> 
> 		/* If there is more data, return */
> 		if (tx->tlen - tx->coalesce_idx)
>diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c
>b/drivers/infiniband/hw/i40iw/i40iw_cm.c
>index a3b95805c154..122d7a5642a1 100644
>--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
>+++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
>@@ -3721,7 +3721,7 @@ int i40iw_accept(struct iw_cm_id *cm_id, struct
>iw_cm_conn_param *conn_param)
> 		ibmr->device = iwpd->ibpd.device;
> 		iwqp->lsmm_mr = ibmr;
> 		if (iwqp->page)
>-			iwqp->sc_qp.qp_uk.sq_base = kmap(iwqp->page);
>+			iwqp->sc_qp.qp_uk.sq_base = kmap_thread(iwqp->page);
> 		dev->iw_priv_qp_ops->qp_send_lsmm(&iwqp->sc_qp,
> 							iwqp->ietf_mem.va,
> 							(accept.size + conn_param->private_data_len),
>@@ -3729,12 +3729,12 @@ int i40iw_accept(struct iw_cm_id *cm_id,
>struct iw_cm_conn_param *conn_param)
> 
> 	} else {
> 		if (iwqp->page)
>-			iwqp->sc_qp.qp_uk.sq_base = kmap(iwqp->page);
>+			iwqp->sc_qp.qp_uk.sq_base = kmap_thread(iwqp->page);
> 		dev->iw_priv_qp_ops->qp_send_lsmm(&iwqp->sc_qp, NULL, 0, 0);
> 	}
> 
> 	if (iwqp->page)
>-		kunmap(iwqp->page);
>+		kunmap_thread(iwqp->page);
> 
> 	iwqp->cm_id = cm_id;
> 	cm_node->cm_id = cm_id;
>@@ -4102,10 +4102,10 @@ static void i40iw_cm_event_connected(struct
>i40iw_cm_event *event)
> 	i40iw_cm_init_tsa_conn(iwqp, cm_node);
> 	read0 = (cm_node->send_rdma0_op == SEND_RDMA_READ_ZERO);
> 	if (iwqp->page)
>-		iwqp->sc_qp.qp_uk.sq_base = kmap(iwqp->page);
>+		iwqp->sc_qp.qp_uk.sq_base = kmap_thread(iwqp->page);
> 	dev->iw_priv_qp_ops->qp_send_rtt(&iwqp->sc_qp, read0);
> 	if (iwqp->page)
>-		kunmap(iwqp->page);
>+		kunmap_thread(iwqp->page);
> 
> 	memset(&attr, 0, sizeof(attr));
> 	attr.qp_state = IB_QPS_RTS;
>diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c
>b/drivers/infiniband/sw/siw/siw_qp_tx.c
>index d19d8325588b..4ed37c328d02 100644
>--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
>+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
>@@ -76,7 +76,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx,
>void *paddr)
> 			if (unlikely(!p))
> 				return -EFAULT;
> 
>-			buffer = kmap(p);
>+			buffer = kmap_thread(p);
> 
> 			if (likely(PAGE_SIZE - off >= bytes)) {
> 				memcpy(paddr, buffer + off, bytes);
>@@ -84,7 +84,7 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx,
>void *paddr)
> 				unsigned long part = bytes - (PAGE_SIZE - off);
> 
> 				memcpy(paddr, buffer + off, part);
>-				kunmap(p);
>+				kunmap_thread(p);
> 
> 				if (!mem->is_pbl)
> 					p = siw_get_upage(mem->umem,
>@@ -96,10 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx
>*c_tx, void *paddr)
> 				if (unlikely(!p))
> 					return -EFAULT;
> 
>-				buffer = kmap(p);
>+				buffer = kmap_thread(p);
> 				memcpy(paddr + part, buffer, bytes - part);
> 			}
>-			kunmap(p);
>+			kunmap_thread(p);
> 		}
> 	}
> 	return (int)bytes;
>@@ -505,7 +505,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx,
>struct socket *s)
> 				page_array[seg] = p;
> 
> 				if (!c_tx->use_sendpage) {
>-					iov[seg].iov_base = kmap(p) + fp_off;
>+					iov[seg].iov_base = kmap_thread(p) + fp_off;

This misses a corresponding kunmap_thread() in siw_unmap_pages()
(pls change line 403 in siw_qp_tx.c as well)

Thanks,
Bernard.

> 					iov[seg].iov_len = plen;
> 
> 					/* Remember for later kunmap() */
>@@ -518,9 +518,9 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx,
>struct socket *s)
> 							plen);
> 				} else if (do_crc) {
> 					crypto_shash_update(c_tx->mpa_crc_hd,
>-							    kmap(p) + fp_off,
>+							    kmap_thread(p) + fp_off,
> 							    plen);
>-					kunmap(p);
>+					kunmap_thread(p);
> 				}
> 			} else {
> 				u64 va = sge->laddr + sge_off;
>-- 
>2.28.0.rc0.12.gb6a658bd00c9
>
>

Powered by blists - more mailing lists