RDMA/siw: Relax from kmap_atomic() use in TX path
Subsystems (2)
PATCH 1/1 RDMA/siw: Relax from kmap_atomic() use in TX path
Since the transmit path is never executed in an atomic context, we do not need kmap_atomic() and can always use less demanding kmap().
--- drivers/infiniband/sw/siw/siw_qp_tx.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/infiniband/sw/siw/siw_qp_tx.c +5 -7
@@ -76,16 +76,15 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)if (unlikely (!p))return -EFAULT ; - buffer =kmap_atomic (p); + buffer =kmap (p);if (likely (PAGE_SIZE - off >= bytes)) {memcpy (paddr, buffer + off, bytes); -kunmap_atomic (buffer); }else {unsigned long part = bytes - (PAGE_SIZE - off);memcpy (paddr, buffer + off, part); -kunmap_atomic (buffer); +kunmap (p);if (!mem->is_pbl) p = siw_get_upage(mem->umem,
@@ -97,11 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)if (unlikely (!p))return -EFAULT ; - buffer =kmap_atomic (p); -memcpy (paddr + part, buffer, - bytes - part); -kunmap_atomic (buffer); + buffer =kmap (p); +memcpy (paddr + part, buffer, bytes - part); } +kunmap (p); } }return (int )bytes;
Signature · 1 line
2.17.2
Hey Bernard, is the code below called directly from the driver’s post_send function? If so it must use atomic...I think.
Stevo
Quoted 52 lines · Bernard Metzler
Since the transmit path is never executed in an atomic context, we do not need
kmap_atomic()and can always use less demandingkmap().Signed-off-by Bernard Metzler <[email protected]>---
drivers/infiniband/sw/siw/siw_qp_tx.c| 12 +++++-------1 file changed, 5 insertions(+), 7 deletions(-)drivers/infiniband/sw/siw/siw_qp_tx.c +5
-7@@ -76,16 +76,15 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)if (unlikely (!p))return -EFAULT ; - buffer =kmap_atomic (p); + buffer =kmap (p);if (likely (PAGE_SIZE - off >= bytes)) {memcpy (paddr, buffer + off, bytes); -kunmap_atomic (buffer); }else {unsigned long part = bytes - (PAGE_SIZE - off);memcpy (paddr, buffer + off, part); -kunmap_atomic (buffer); +kunmap (p);if (!mem->is_pbl) p = siw_get_upage(mem->umem,@@ -97,11 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx *c_tx, void *paddr)if (unlikely (!p))return -EFAULT ; - buffer =kmap_atomic (p); -memcpy (paddr + part, buffer, - bytes - part); -kunmap_atomic (buffer); + buffer =kmap (p); +memcpy (paddr + part, buffer, bytes - part); } +kunmap (p); } }return (int )bytes;Signature · 1 line
2.17.2
-----"Steve Wise" <[email protected]> wrote: -----
Quoted 10 lines
To: "Bernard Metzler" <[email protected]>
From: "Steve Wise" <[email protected]>
Date: 09/07/2019 12:31AM
Cc: [email protected], [email protected]
Subject: [EXTERNAL] Re: [PATCH] RDMA/siw: Relax fromkmap_atomic()use in TX pathHey Bernard, is the code below called directly from the driver’s
post_sendfunction? If so it must use atomic...I think.
Hey Steve,
Only a kernel TX thread executes the TX path. It is not executed directly from the drivers post_send() method, which only queues work for TX processing and wakes up the TX thread if it currently does not run. The single exception is TX processing
out of a user space application context, if no TX thread is currently running, but only for a small burst. In any case, all TX processing is done out of a non-atomic context.
Best,
Bernard.
Quoted 60 lines
Stevo
Quoted 1 line
On Sep 6, 2019, at 6:18 AM, Bernard Metzler <[email protected]>
Review
Quoted 11 lines · wrote:
Since the transmit path is never executed in an atomic context, we do not need
kmap_atomic()and can always use less demandingkmap().Signed-off-by Bernard Metzler <[email protected]>---
drivers/infiniband/sw/siw/siw_qp_tx.c| 12 +++++-------1 file changed, 5 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/drivers/infiniband/sw/siw/siw_qp_tx.cdrivers/infiniband/sw/siw/siw_qp_tx.c static int siw_try_1seg(struct siw_iwarp_tx
Quoted 4 lines
index
8e72f955921d..5d97bba0ce6d100644drivers/infiniband/sw/siw/siw_qp_tx.c +0
-0@@ -76,16 +76,15 @@ static int siw_try_1seg(struct siw_iwarp_tx
*c_tx, void *paddr)drivers/infiniband/sw/siw/siw_qp_tx.c static int siw_try_1seg(struct siw_iwarp_tx
Quoted 19 lines
drivers/infiniband/sw/siw/siw_qp_tx.c +2
-3if (unlikely (!p))return -EFAULT ; - buffer =kmap_atomic (p); + buffer =kmap (p);if (likely (PAGE_SIZE - off >= bytes)) {memcpy (paddr, buffer + off, bytes); -kunmap_atomic (buffer); }else {unsigned long part = bytes - (PAGE_SIZE - off);memcpy (paddr, buffer + off, part); -kunmap_atomic (buffer); +kunmap (p);if (!mem->is_pbl) p = siw_get_upage(mem->umem,@@ -97,11 +96,10 @@ static int siw_try_1seg(struct siw_iwarp_tx
*c_tx, void *paddr)Quoted 17 lines
drivers/infiniband/sw/siw/siw_qp_tx.c +3
-4if (unlikely (!p))return -EFAULT ; - buffer =kmap_atomic (p); -memcpy (paddr + part, buffer, - bytes - part); -kunmap_atomic (buffer); + buffer =kmap (p); +memcpy (paddr + part, buffer, bytes - part); } +kunmap (p); } }return (int )bytes;Signature · 1 line
2.17.2