Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753843AbcLFSuO (ORCPT ); Tue, 6 Dec 2016 13:50:14 -0500 Received: from mail-co1nam03on0060.outbound.protection.outlook.com ([104.47.40.60]:52096 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751166AbcLFSuK (ORCPT ); Tue, 6 Dec 2016 13:50:10 -0500 X-Greylist: delayed 3562 seconds by postgrey-1.27 at vger.kernel.org; Tue, 06 Dec 2016 13:50:09 EST Authentication-Results: spf=fail (sender IP is 63.163.107.21) smtp.mailfrom=wdc.com; sharedspace.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none;sharedspace.mail.onmicrosoft.com; dmarc=none action=none header.from=hgst.com;sharedspace.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:3238;Count:18 X-AuditID: 0ac94369-5f3ff70000000b53-a3-5846f0a4f7b4 From: Adam Manzanares To: , , , , , , , , CC: , , , Adam Manzanares Subject: [PATCH v7 2/4] ata: Enabling ATA Command Priorities Date: Tue, 6 Dec 2016 09:18:03 -0800 Message-ID: <1481044685-2803-3-git-send-email-adam.manzanares@hgst.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481044685-2803-1-git-send-email-adam.manzanares@hgst.com> References: <1481044685-2803-1-git-send-email-adam.manzanares@hgst.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRmVeSWpSXmKPExsXCddJ5ke6yD24RBmffKFrcPrqDxWL13X42 i59XZrFZTJ96gdFiz6JJTBZ7b2lbHNvxiMni8q45bBbLj/9jslh/ZAOjxa6H39ktfi0/ymjx cMFmdgdej1kNvWweu3Y1snss3vOSyePy2VKPTas62Tw+Pr3F4vF+31U2j0tn21k8Np+u9vi8 SS6AK4rLJiU1J7MstUjfLoEr42/rX9aCWcYVWz/8YW9gXK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9MwCQ0O94sS8lMzibL3k/NxNjJDAjNzB+HSi+SFGJg5OqQbG2lMiFiuMGW13 vUn/OHNaq/Bfb5VPu6TrrQ6uWPz/1bGUpNW/or5yrGezd3+y7/VCx8w+/08ic0+82i+p1xZu 1LB/6sc7ev1XRRvPK7fuXx+1eP2a8JOOatM23L4ja3VY9k1R7NovzE4XJ1ywubybo1v95m3n ewsvHQjzWMkvLW8Zue9Rmq79HiWW4oxEQy3mouJEAN9m1/X8AQAA MIME-Version: 1.0 Content-Type: text/plain X-IncomingHeaderCount: 18 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:63.163.107.21;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(2270400002)(960300001)(8676002)(2950100002)(356003)(42882006)(6666003)(81166006)(81156014)(305945005)(5001770100001)(97736004)(39410400001)(189998001)(38730400001)(33646002)(5660300001)(36756003)(50226002)(77096006)(39450400002)(7846002)(8936002)(2201001)(39860400001)(39850400001)(39840400001)(85426001)(5003940100001)(626004)(47776003)(7416002)(106466001)(50986999)(4326007)(50466002)(48376002)(2906002)(68736007)(105606002)(69596002)(92566002)(76176999);DIR:OUT;SFP:1101;SCL:1;SRVR:BN1PR02MB054;H:milsmgep15.sandisk.com;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD048;1:k2dH90cnzlDRMR/6LEnAHlYalF1UMYvqwXRz8IHY3SGi0l+znT4epgMPlL+/x5AsppbXgZL6kxl5IPuLBRRcH1A0/C/xintr9vQBpJNrZPp9XvKDfdowM6DciPd5zWkSOAsxsE3zxYaDskJBilwWFz4JZBBA7V2KUFx7QvfsPb0Fp1doB+DplY3qDgDY5iuRNcJZslZh7gKpEbSQpXptyu6bRN4ZcJ/X6wlE7Y8iaKug7ezMJMuNnUsLeQR/N41NB2fQFX4k5usqQ5p2r1wYhRhftdsAp3znVBYbTSY1a/Dn/9yxtoeojSxQYRh+kwN6f8s3pi27ql761uw41IdK5gyuxLgzOnWCZpiBvMc/5Ln0d9jaYL/9AiSCYu6rpInS3MmWNKuvDgCg92ByZ6nMUHqCXo7oumAXf1Dlaf1XOy8xfN84QVI1wwJuNFlXWoNFXXUy3jIcrzU+YRWM+yEylga3EB0eIwaMDEfbr4W7NnFwO7KwB7hTNCBJREoETOm75CzPkdPbWdKnRmmCWmG8WCy5d7WiQ0b9o4TqAqC15bI8vopSAxZFhc1bUjMGZ8iinJYG95PouIPR1Jykg8qdTA== X-MS-Office365-Filtering-Correlation-Id: af108b73-af37-48d5-0ee7-08d41dfbe6cc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BN1PR02MB054; X-Microsoft-Exchange-Diagnostics: 1;BN1PR02MB054;3:jcgChUsTvqU2TDNeXDUGiGJVCQK6sdelMh75qem/yeClkMOLYkuvbcmn0e3qqIU9AdMnQCBgxs6WdM0Dp2CGiTJkcf48FzHdVE8mrIzmlkPW9P4QuY9lEqhRrSvl3jGRwvp/orT4Htqs6oTOIVKmFD3DzlJEdglypWZdwv60xLVi03fgXsZfU+B16daE5TNEqvXAm8q7qZBhtF/Xt+ZzjKQnIVF9kMRrS8fjv9pJMu6GBP5C2fKj8cV181CLDPDBVjSD/08xkMT7cogskuSqkxAdQ93cntEIUJO4gOz63tjLNXnkd42SaH2YiMwhxUMHOxl2ua2XjJG15iguBpUZ/zncwbyCDba/N59Yv6RdXKI645lbCO3Z4YxWDTrOMfRi X-Microsoft-Exchange-Diagnostics: 1;BN1PR02MB054;25:s/XIavLMQzDWwgusACG1XiUOsqvpJrGndgd5w+w/dMSr83GR9JUbgxlyXGtg46bw3LMrLf1T5DzdD/uh1nykEfWydN3QtGaJbhujXGjMucLQRcTT4m6/t89Wa/ZwkeuThiR/SRZw2sxWylgmussBh90VUsoz/0pMe/VyZ6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6jFgCHXkTTbSbG41NxBoeMnsXVhHtopLFHIY070+S/XxVRLbSVmoZUNhuPeGcelIxxtuaPrmXaFPIJBG452kle10MdIFB5Hdp4GAngbW0MKt/UrRwSdN49X5Ki1CQPjVGxF/+583irW4ijcuzur95hcOQDmfGnZekPkoCtAYV/uV+UBXZ4xegyx0hD4bbqaJiLPyzrWfneP9b0Zab0iO731H7N9uiD2X9gJ/+ZSDp5Q9tKf3GH2AYThPrZu+AigqpP1rl9K5V0GrPtWYixsoYmr5//cAeTm4Pzfn+T41jihz+ftyQMPkjEYfjoq8zcNT8+QKDSXR88BFUV6qGXFHSeEAqm94C9UgRUQNNAFv5vtaTVjIhK4XFAtuqVogG/aM1DRF7xFo2WTDgARdE7s+caNFMCz+JWrOkEEXZCM5NNlaR//2B7urK//VpAmN7JCordW+b4CnOBivPkJ04IYah/RNFg1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13016025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123562025)(20161123564025)(20161123555025)(6072148);SRVR:BN1PR02MB054;BCL:0;PCL:0;RULEID:;SRVR:BN1PR02MB054; X-Microsoft-Exchange-Diagnostics: 1;BN1PR02MB054;4:TAXire8aGTa35yafDYMpr7x1+BEaG6C0gpDWBikuJ6XIMhc7B9MSj6+TuGKaBKNgrrGPTsvzGK4ni+IpcaH8+pFuEFgICHZNGk7vbYOTk8QOoTqnq6Kq7tdc0o9UiIkeoYkF81PfCfv3xz0ub8brvbG3CWWsZ3AGAiumvHBcA0E8MKuP4lrqX5xlWy2BMN1TWT6JU2W2luVDClGcgLh57r1aSu1xUjh0p01o9mMd6oDVt/5qbkY8gvtJjHOHtmhFSoiAsK+7TyIQeuG+ATAeNwD9KkdZrgLODd2A6kj22o7nPD2yPbzRhlfjkCO3By2lnXPQUScO5nuCBJLfggW6Le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IYlwrlZ2Q==;20:zjJFcewcOSW1OpF0vRYlnhspPvIEPbBYmfsTMH+hNyHlg1XgofkxVFhVKZu2z2D1x0oRl+yDxKKAfeYusx6SnZnLDJxVLDbVgXkxFT8mcD4wInurxHy4ATC2CgKQJVvHYCM8xpeL4968omLVpKdXtXVTvHFq3dnvxRihxOtxdOn5QiLmEddUy3JZprYnefQqa/WPVq03hOJkLPWlDEYa0T88fc2d1WH5yfcRuKHtChzlHSsvBRGb6sQO0DsbgYVD X-OriginatorOrg: sandiskcorp.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2016 17:18:31.0964 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d;Ip=[63.163.107.21];Helo=[milsmgep15.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR02MB054 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6367 Lines: 185 From: Adam Manzanares This patch checks to see if an ATA device supports NCQ command priorities. If so and the user has specified an iocontext that indicates IO_PRIO_CLASS_RT then we build a tf with a high priority command. This is done to improve the tail latency of commands that are high priority by passing priority to the device. tj: Removed trivial ata_ncq_prio_enabled() and open-coded the test. Signed-off-by: Adam Manzanares --- drivers/ata/libata-core.c | 33 ++++++++++++++++++++++++++++++++- drivers/ata/libata-scsi.c | 6 +++++- drivers/ata/libata.h | 3 ++- include/linux/ata.h | 6 ++++++ include/linux/libata.h | 3 +++ 5 files changed, 48 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 223a770..5d16363 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -739,6 +739,7 @@ u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) * @n_block: Number of blocks * @tf_flags: RW/FUA etc... * @tag: tag + * @class: IO priority class * * LOCKING: * None. @@ -753,7 +754,7 @@ u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev) */ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags, - unsigned int tag) + unsigned int tag, int class) { tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf->flags |= tf_flags; @@ -785,6 +786,12 @@ int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, tf->device = ATA_LBA; if (tf->flags & ATA_TFLAG_FUA) tf->device |= 1 << 7; + + if (dev->flags & ATA_DFLAG_NCQ_PRIO) { + if (class == IOPRIO_CLASS_RT) + tf->hob_nsect |= ATA_PRIO_HIGH << + ATA_SHIFT_PRIO; + } } else if (dev->flags & ATA_DFLAG_LBA) { tf->flags |= ATA_TFLAG_LBA; @@ -2156,6 +2163,30 @@ static void ata_dev_config_ncq_non_data(struct ata_device *dev) } } +void ata_dev_config_ncq_prio(struct ata_device *dev) +{ + struct ata_port *ap = dev->link->ap; + unsigned int err_mask; + + err_mask = ata_read_log_page(dev, + ATA_LOG_SATA_ID_DEV_DATA, + ATA_LOG_SATA_SETTINGS, + ap->sector_buf, + 1); + if (err_mask) { + ata_dev_dbg(dev, + "failed to get Identify Device data, Emask 0x%x\n", + err_mask); + return; + } + + if (ap->sector_buf[ATA_LOG_NCQ_PRIO_OFFSET] & BIT(3)) + dev->flags |= ATA_DFLAG_NCQ_PRIO; + else + ata_dev_dbg(dev, "SATA page does not support priority\n"); + +} + static int ata_dev_config_ncq(struct ata_device *dev, char *desc, size_t desc_sz) { diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 9cceb4a..2bccc3c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "libata.h" #include "libata-transport.h" @@ -1755,6 +1756,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) { struct scsi_cmnd *scmd = qc->scsicmd; const u8 *cdb = scmd->cmnd; + struct request *rq = scmd->request; + int class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq)); unsigned int tf_flags = 0; u64 block; u32 n_block; @@ -1821,7 +1824,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) qc->nbytes = n_block * scmd->device->sector_size; rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags, - qc->tag); + qc->tag, class); + if (likely(rc == 0)) return 0; diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 3b301a4..03d0908 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -66,7 +66,7 @@ extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, u64 block, u32 n_block, unsigned int tf_flags, - unsigned int tag); + unsigned int tag, int class); extern u64 ata_tf_read_block(const struct ata_taskfile *tf, struct ata_device *dev); extern unsigned ata_exec_internal(struct ata_device *dev, @@ -85,6 +85,7 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags); extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class, unsigned int readid_flags); extern int ata_dev_configure(struct ata_device *dev); +extern void ata_dev_config_ncq_prio(struct ata_device *dev); extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit); extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); extern unsigned int ata_dev_set_feature(struct ata_device *dev, diff --git a/include/linux/ata.h b/include/linux/ata.h index fdb1803..af6859b 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h @@ -348,6 +348,7 @@ enum { ATA_LOG_DEVSLP_DETO = 0x01, ATA_LOG_DEVSLP_VALID = 0x07, ATA_LOG_DEVSLP_VALID_MASK = 0x80, + ATA_LOG_NCQ_PRIO_OFFSET = 0x09, /* NCQ send and receive log */ ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET = 0x00, @@ -940,6 +941,11 @@ static inline bool ata_id_has_ncq_non_data(const u16 *id) return id[ATA_ID_SATA_CAPABILITY_2] & BIT(5); } +static inline bool ata_id_has_ncq_prio(const u16 *id) +{ + return id[ATA_ID_SATA_CAPABILITY] & BIT(12); +} + static inline bool ata_id_has_trim(const u16 *id) { if (ata_id_major_version(id) >= 7 && diff --git a/include/linux/libata.h b/include/linux/libata.h index 616eef4..90b69a6 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -166,6 +166,7 @@ enum { ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */ ATA_DFLAG_UNLOCK_HPA = (1 << 18), /* unlock HPA */ ATA_DFLAG_NCQ_SEND_RECV = (1 << 19), /* device supports NCQ SEND and RECV */ + ATA_DFLAG_NCQ_PRIO = (1 << 20), /* device supports NCQ priority */ ATA_DFLAG_INIT_MASK = (1 << 24) - 1, ATA_DFLAG_DETACH = (1 << 24), @@ -342,7 +343,9 @@ enum { ATA_SHIFT_PIO = 0, ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES, ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES, + ATA_SHIFT_PRIO = 6, + ATA_PRIO_HIGH = 2, /* size of buffer to pad xfers ending on unaligned boundaries */ ATA_DMA_PAD_SZ = 4, -- 2.7.4