Skip to content

Commit 06917f7

Browse files
davejiangjonmason
authored andcommitted
NTB: Improve performance with write combining
Changing the memory window BAR mappings to write combining significantly boosts the performance. We will also use memcpy that uses non-temporal store, which showed performance improvement when doing non-cached memcpys. Signed-off-by: Dave Jiang <[email protected]> Signed-off-by: Jon Mason <[email protected]>
1 parent 0e041fb commit 06917f7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/ntb/ntb_transport.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#include <linux/pci.h>
5959
#include <linux/slab.h>
6060
#include <linux/types.h>
61+
#include <linux/uaccess.h>
6162
#include "linux/ntb.h"
6263
#include "linux/ntb_transport.h"
6364

@@ -993,7 +994,7 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
993994
if (rc)
994995
goto err1;
995996

996-
mw->vbase = ioremap(mw->phys_addr, mw->phys_size);
997+
mw->vbase = ioremap_wc(mw->phys_addr, mw->phys_size);
997998
if (!mw->vbase) {
998999
rc = -ENOMEM;
9991000
goto err1;
@@ -1375,7 +1376,15 @@ static void ntb_tx_copy_callback(void *data)
13751376

13761377
static void ntb_memcpy_tx(struct ntb_queue_entry *entry, void __iomem *offset)
13771378
{
1379+
#ifdef ARCH_HAS_NOCACHE_UACCESS
1380+
/*
1381+
* Using non-temporal mov to improve performance on non-cached
1382+
* writes, even though we aren't actually copying from user space.
1383+
*/
1384+
__copy_from_user_inatomic_nocache(offset, entry->buf, entry->len);
1385+
#else
13781386
memcpy_toio(offset, entry->buf, entry->len);
1387+
#endif
13791388

13801389
/* Ensure that the data is fully copied out before setting the flags */
13811390
wmb();

0 commit comments

Comments
 (0)