Re: [PATCH] 2.6.34-rc3 v2 Disable R_OK (Early ACK) on SII 3726 PMP

From: Grant Grundler
Date: Tue Apr 20 2010 - 16:52:40 EST


ping? Can this patch please be applied?

I was assuming this will show up here:
http://git.kernel.org/?p=linux/kernel/git/jgarzik/libata-dev.git;a=shortlog;h=refs/heads/upstream-linus

thanks,
grant

On Wed, Apr 14, 2010 at 6:43 PM, Grant Grundler <grundler@xxxxxxxxxx> wrote:
> In 2009, While running "cache read" performance test of drives behind
> SII PMP we encountered a "all 5 drives" timeout on more than 30% of the
> machines under test. ÂThis patch reduces the rate by a factor of about 70.
> Low enough that we didn't care to further investigate the issue.
>
> Performance impact with any sort of "normal" use was ~2%+ CPU and less
> than 1% throughput degradation. ÂWorst case impact (cached read) was
> 6% IOPS reduction. This is with NCQ off (q=1) but I believe FIS based
> switching enabled in the SATA driver.
>
> The patch disables "Early ACK" in the 3726 port multiplier.
> "Early ACK" is issued when device sends a FIS to the host (via PMP)
> and the PMP sends an ACK immediately back to the device - well before
> the host gets the response. Under worst case IOPs load (cached read
> test) and more than 2 PMPs connected to a 4-port SATA controller,
> I suspect the time to service all of the PMPs is exceeding the PMPs
> ability to keep track of outstanding FIS it owes the Host. Reducing
> the number of PMPs to 2 (or 1) reduces the frequency by several orders
> of magnitude. Kudos to Gwendal for initial debugging of this issue.
> [Any errors in the description are mine, not his.]
>
> Patch is currently in production on Google servers.
>
> Signed-off-by: Grant Grundler <grundler@xxxxxxxxxx>
> Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxx>
> Acked-by: Tejun Heo <tj@xxxxxxxxxx>
>
> ---
>
> v2: dropped references to 4726 since I didn't test 4726,
> Â Âmoved register definition directly into libata-pmp.c, and
> Â Âexpanded the comment in the code to summarize the above description.
>
> Code below is white space mangled. Please use attached file.
>
> diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c
> index 00305f4..487227a 100644
> --- a/drivers/ata/libata-pmp.c
> +++ b/drivers/ata/libata-pmp.c
> @@ -231,10 +231,14 @@ static const char *sata_pmp_spec_rev_str(const u32 *gscr)
> Â Â Â Âreturn "<unknown>";
> Â}
>
> +#define PMP_GSCR_SII_POL 129
> +
> Âstatic int sata_pmp_configure(struct ata_device *dev, int print_info)
> Â{
> Â Â Â Âstruct ata_port *ap = dev->link->ap;
> Â Â Â Âu32 *gscr = dev->gscr;
> + Â Â Â u16 vendor = sata_pmp_gscr_vendor(gscr);
> + Â Â Â u16 devid = sata_pmp_gscr_devid(gscr);
> Â Â Â Âunsigned int err_mask = 0;
> Â Â Â Âconst char *reason;
> Â Â Â Âint nr_ports, rc;
> @@ -260,12 +264,34 @@ static int sata_pmp_configure(struct ata_device
> *dev, int print_info)
> Â Â Â Â Â Â Â Âgoto fail;
> Â Â Â Â}
>
> + Â Â Â /* Disable sending Early R_OK.
> + Â Â Â Â* With "cached read" HDD testing and multiple ports busy on a SATA
> + Â Â Â Â* host controller, 3726 PMP will very rarely drop a deferred
> + Â Â Â Â* R_OK that was intended for the host. Symptom will be all
> + Â Â Â Â* 5 drives under test will timeout, get reset, and recover.
> + Â Â Â Â*/
> + Â Â Â if (vendor == 0x1095 && devid == 0x3726) {
> + Â Â Â Â Â Â Â u32 reg;
> +
> + Â Â Â Â Â Â Â err_mask = sata_pmp_read(&ap->link, PMP_GSCR_SII_POL, &reg);
> + Â Â Â Â Â Â Â if (err_mask) {
> + Â Â Â Â Â Â Â Â Â Â Â rc = -EIO;
> + Â Â Â Â Â Â Â Â Â Â Â reason = "failed to read Sil3726 Private Register";
> + Â Â Â Â Â Â Â Â Â Â Â goto fail;
> + Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â reg &= ~0x1;
> + Â Â Â Â Â Â Â err_mask = sata_pmp_write(&ap->link, PMP_GSCR_SII_POL, reg);
> + Â Â Â Â Â Â Â if (err_mask) {
> + Â Â Â Â Â Â Â Â Â Â Â rc = -EIO;
> + Â Â Â Â Â Â Â Â Â Â Â reason = "failed to write Sil3726 Private Register";
> + Â Â Â Â Â Â Â Â Â Â Â goto fail;
> + Â Â Â Â Â Â Â }
> + Â Â Â }
> +
> Â Â Â Âif (print_info) {
> Â Â Â Â Â Â Â Âata_dev_printk(dev, KERN_INFO, "Port Multiplier %s, "
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â "0x%04x:0x%04x r%d, %d ports, feat 0x%x/0x%x\n",
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âsata_pmp_spec_rev_str(gscr),
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âsata_pmp_gscr_vendor(gscr),
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âsata_pmp_gscr_devid(gscr),
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âsata_pmp_spec_rev_str(gscr), vendor, devid,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â sata_pmp_gscr_rev(gscr),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â nr_ports, gscr[SATA_PMP_GSCR_FEAT_EN],
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â gscr[SATA_PMP_GSCR_FEAT]);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/