Skip to content

Commit dedba46

Browse files
committed
Merge: Backport arm64 write combining support optimization to RHEL 9.5
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4672 JIRA: https://issues.redhat.com/browse/RHEL-43402 Note: I skipped one commit from the series: 2b7a5e1 net: hns3: Remove io_stop_wc() calls after __iowrite64_copy() because it exclusively touches code that has not yet been backported Signed-off-by: Charles Mirabile <cmirabil@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: Wander Lairson Costa <wander@redhat.com> Approved-by: Chris von Recklinghausen <crecklin@redhat.com> Approved-by: Mark Langsdorf <mlangsdo@redhat.com> Approved-by: Michal Schmidt <mschmidt@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 40bff8b + 7391a9b commit dedba46

File tree

2 files changed

+20
-5
lines changed
  • arch/x86/include/asm
  • drivers/infiniband/hw/mlx5

2 files changed

+20
-5
lines changed

arch/x86/include/asm/io.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,23 @@ void memset_io(volatile void __iomem *, int, size_t);
212212
#define memcpy_toio memcpy_toio
213213
#define memset_io memset_io
214214

215+
#ifdef CONFIG_X86_64
216+
/*
217+
* Commit 0f07496144c2 ("[PATCH] Add faster __iowrite32_copy routine for
218+
* x86_64") says that circa 2006 rep movsl is noticeably faster than a copy
219+
* loop.
220+
*/
221+
static inline void __iowrite32_copy(void __iomem *to, const void *from,
222+
size_t count)
223+
{
224+
asm volatile("rep ; movsl"
225+
: "=&c"(count), "=&D"(to), "=&S"(from)
226+
: "0"(count), "1"(to), "2"(from)
227+
: "memory");
228+
}
229+
#define __iowrite32_copy __iowrite32_copy
230+
#endif
231+
215232
#include <asm-generic/iomap.h>
216233

217234
#ifdef CONFIG_X86_64

drivers/infiniband/hw/mlx5/mem.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* SOFTWARE.
3131
*/
3232

33+
#include <linux/io.h>
3334
#include <rdma/ib_umem_odp.h>
3435
#include "mlx5_ib.h"
3536
#include <linux/jiffies.h>
@@ -108,7 +109,6 @@ static int post_send_nop(struct mlx5_ib_dev *dev, struct ib_qp *ibqp, u64 wr_id,
108109
__be32 mmio_wqe[16] = {};
109110
unsigned long flags;
110111
unsigned int idx;
111-
int i;
112112

113113
if (unlikely(dev->mdev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR))
114114
return -EIO;
@@ -148,10 +148,8 @@ static int post_send_nop(struct mlx5_ib_dev *dev, struct ib_qp *ibqp, u64 wr_id,
148148
* we hit doorbell
149149
*/
150150
wmb();
151-
for (i = 0; i < 8; i++)
152-
mlx5_write64(&mmio_wqe[i * 2],
153-
bf->bfreg->map + bf->offset + i * 8);
154-
io_stop_wc();
151+
__iowrite64_copy(bf->bfreg->map + bf->offset, mmio_wqe,
152+
sizeof(mmio_wqe) / 8);
155153

156154
bf->offset ^= bf->buf_size;
157155

0 commit comments

Comments
 (0)