linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Michael Schmitz <schmitzmic@gmail.com>,
	Hannes Reinecke <hare@suse.de>,
	linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 6/6] esp_scsi: Optimize PIO loops
Date: Sun, 14 Oct 2018 17:12:00 +1100	[thread overview]
Message-ID: <83ae6c0a090dc46decf8e99c544cb6329b516ed1.1539497520.git.fthain@telegraphics.com.au> (raw)
In-Reply-To: <cover.1539497520.git.fthain@telegraphics.com.au>

Avoid function calls in the inner PIO loops. On a Centris 660av this
improves throughput for sequential read transfers by about 40% and
sequential write by about 10%.

Unfortunately it is not possible to have method calls like esp_write8()
placed inline so this is always going to be slow (even with LTO).

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Michael Schmitz <schmitzmic@gmail.com>
---
Changed since v1:
 - Don't touch the scsi_esp_cmd(esp, ESP_CMD_FLUSH) that's outside the loop.
---
 drivers/scsi/esp_scsi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 305a322ad13c..cdf55bd8562e 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2788,7 +2788,7 @@ static inline unsigned int esp_wait_for_fifo(struct esp *esp)
 		if (fbytes)
 			return fbytes;
 
-		udelay(2);
+		udelay(1);
 	} while (--i);
 
 	shost_printk(KERN_ERR, esp->host, "FIFO is empty (sreg %02x)\n",
@@ -2805,7 +2805,7 @@ static inline int esp_wait_for_intr(struct esp *esp)
 		if (esp->sreg & ESP_STAT_INTR)
 			return 0;
 
-		udelay(2);
+		udelay(1);
 	} while (--i);
 
 	shost_printk(KERN_ERR, esp->host, "IRQ timeout (sreg %02x)\n",
@@ -2833,7 +2833,7 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
 			if (!esp_wait_for_fifo(esp))
 				break;
 
-			*dst++ = esp_read8(ESP_FDATA);
+			*dst++ = readb(esp->fifo_reg);
 			--esp_count;
 
 			if (!esp_count)
@@ -2854,9 +2854,9 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
 			}
 
 			if (phase == ESP_MIP)
-				scsi_esp_cmd(esp, ESP_CMD_MOK);
+				esp_write8(ESP_CMD_MOK, ESP_CMD);
 
-			scsi_esp_cmd(esp, ESP_CMD_TI);
+			esp_write8(ESP_CMD_TI, ESP_CMD);
 		}
 	} else {
 		unsigned int n = ESP_FIFO_SIZE;
@@ -2896,7 +2896,7 @@ void esp_send_pio_cmd(struct esp *esp, u32 addr, u32 esp_count,
 			src += n;
 			esp_count -= n;
 
-			scsi_esp_cmd(esp, ESP_CMD_TI);
+			esp_write8(ESP_CMD_TI, ESP_CMD);
 		}
 	}
 
-- 
2.18.1


  parent reply	other threads:[~2018-10-14  6:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14  6:12 [PATCH v2 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements Finn Thain
2018-10-14  6:12 ` [PATCH v2 4/6] esp_scsi: Eliminate ESP_FLAG_DOING_SLOWCMD Finn Thain
2018-10-14  6:12 ` Finn Thain [this message]
2018-10-14  6:12 ` [PATCH v2 3/6] esp_scsi: Grant disconnect privilege for untagged commands Finn Thain
2018-10-14 15:47   ` Christoph Hellwig
2018-10-14 20:33     ` Michael Schmitz
2018-10-14 23:04       ` Finn Thain
2018-10-14 23:13     ` Finn Thain
2018-10-15  2:45       ` Finn Thain
2018-10-15  5:52       ` Christoph Hellwig
2018-10-14  6:12 ` [PATCH v2 5/6] esp_scsi: De-duplicate PIO routines Finn Thain
2018-10-14 10:55   ` Geert Uytterhoeven
2018-10-15  2:32     ` Finn Thain
2018-10-15  6:14   ` Hannes Reinecke
2018-10-15  6:25     ` Finn Thain
2018-10-15 10:58       ` Hannes Reinecke
2018-10-15 12:53         ` Christoph Hellwig
2018-10-15 23:52         ` Finn Thain
2018-10-17  8:08           ` Christoph Hellwig
2018-10-16  5:39         ` Finn Thain
2018-10-17  8:09           ` Christoph Hellwig
2018-10-17 23:01             ` Finn Thain
2018-10-14  6:12 ` [PATCH v2 1/6] zorro_esp: Limit DMA transfers to 65535 bytes Finn Thain
2018-10-14  7:35   ` Michael Schmitz
2018-10-14 10:55   ` Geert Uytterhoeven
2018-10-14 22:00     ` Finn Thain
2018-10-14  6:12 ` [PATCH v2 2/6] esp_scsi: Track residual for PIO transfers Finn Thain
2018-10-14 10:55   ` Geert Uytterhoeven
2018-10-14 22:14     ` Finn Thain
2018-10-18  1:40 ` [PATCH v2 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83ae6c0a090dc46decf8e99c544cb6329b516ed1.1539497520.git.fthain@telegraphics.com.au \
    --to=fthain@telegraphics.com.au \
    --cc=hare@suse.de \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=schmitzmic@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).