linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Finn Thain <fthain@telegraphics.com.au>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Hannes Reinecke <hare@suse.de>,
	linux-scsi@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] esp_scsi: Optimize PIO loops
Date: Sat, 13 Oct 2018 17:18:59 +1300	[thread overview]
Message-ID: <5b95b717-d9e8-8c8c-aa42-47f847bec5be@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.21.1810131505230.375@nippy.intranet>

Hi Finn,

Am 13.10.2018 um 17:09 schrieb Finn Thain:
> On Sat, 13 Oct 2018, Michael Schmitz wrote:
>
>> Hi Finn,
>>
>> Am 13.10.2018 um 13:51 schrieb Finn Thain:
>>> 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>
>>> ---
>>>  drivers/scsi/esp_scsi.c | 14 +++++++-------
>>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
>>> index 646701fc22a4..9f0e68cd0e99 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);
>>>
>>>  	pr_err("FIFO is empty (sreg %02x)\n", esp_read8(ESP_STATUS));
>>> @@ -2804,7 +2804,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);
>>>
>>>  	pr_err("IRQ timeout (sreg %02x)\n", esp->sreg);
>>> @@ -2831,7 +2831,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)
>>> @@ -2852,15 +2852,15 @@ 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);
>>
>> You're no longer logging this command with this patch. (That'll be the reason
>> for the speedup you saw ...)
>>
>>>
>>> -			scsi_esp_cmd(esp, ESP_CMD_TI);
>>> +			esp_write8(ESP_CMD_TI, ESP_CMD);
>>
>> Same here..
>>
>>>  		}
>>>  	} else {
>>>  		unsigned int n = ESP_FIFO_SIZE;
>>>  		u8 *src = (u8 *)addr;
>>>
>>> -		scsi_esp_cmd(esp, ESP_CMD_FLUSH);
>>> +		esp_write8(ESP_CMD_FLUSH, ESP_CMD);
>>
>> here..
>>
>>>
>>>  		if (n > esp_count)
>>>  			n = esp_count;
>>> @@ -2894,7 +2894,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);
>>
>> and here.
>>
>
> Yes, it's deliberate.

I'm sure it was... and I wasn't objecting to that.

>> The burst of ESP_CMD_TI's in the log was quite useful to spot what went
>> wrong during PIO.
>
> I don't think it's as useful as you seem to think. Compare
> mac_esp_send_pdma_cmd().
>
>> Maybe mention in the changelog that commands during PIO are no longer
>> logged? Or introduce a new ESP_EVENT_PIO and log that at the start of
>> PIO?
>>
>
> Yes, and I did leave a scsi_esp_cmd(esp, cmd) call at the start of PIO.

Which I missed from just looking at the patch, sorry.

> That should be sufficient, right?

It would indeed. Thanks for clarifying.

Cheers,

	Michael

  reply	other threads:[~2018-10-13  4:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-13  0:51 [PATCH 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements Finn Thain
2018-10-13  0:51 ` [PATCH 3/6] esp_scsi: Grant disconnect privilege for untagged commands Finn Thain
2018-10-13  0:51 ` [PATCH 2/6] esp_scsi: Track residual for PIO transfers Finn Thain
2018-10-13  0:51 ` [PATCH 1/6] zorro_esp: Limit DMA transfers to 65535 bytes Finn Thain
2018-10-13  0:51 ` [PATCH 5/6] esp_scsi: De-duplicate PIO routines Finn Thain
2018-10-13  7:05   ` Christoph Hellwig
2018-10-13  7:22     ` Finn Thain
2018-10-13  7:52       ` Christoph Hellwig
2018-10-15  5:54   ` Hannes Reinecke
2018-10-15  6:17     ` Finn Thain
2018-10-13  0:51 ` [PATCH 6/6] esp_scsi: Optimize PIO loops Finn Thain
2018-10-13  4:02   ` Michael Schmitz
2018-10-13  4:09     ` Finn Thain
2018-10-13  4:18       ` Michael Schmitz [this message]
2018-10-13  0:51 ` [PATCH 4/6] esp_scsi: Eliminate ESP_FLAG_DOING_SLOWCMD Finn Thain
2018-10-14  1:36 ` [PATCH 0/6] mac_esp, zorro_esp, esp_scsi: Various improvements Michael Schmitz

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=5b95b717-d9e8-8c8c-aa42-47f847bec5be@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=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 \
    /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).