Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4970424rwb; Wed, 17 Aug 2022 08:53:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR7XRoSp424iFyOEV3CPer+4TXf7OnfmwkXPJmtCPvw+BO5SZntCNqnKiAOUBIK8KqTlGbNq X-Received: by 2002:a17:907:7207:b0:731:248d:bb94 with SMTP id dr7-20020a170907720700b00731248dbb94mr16969276ejc.713.1660751583502; Wed, 17 Aug 2022 08:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660751583; cv=none; d=google.com; s=arc-20160816; b=lIf9UX/T5hDLWoE4fhAL3xJBOwxXB/DIhf7h5ComkJNsLDECLx9qpYSngmfvsVkDYO ZfLP7tjyAIZZIhecl/nQfTAvOCh7z7K2LEmAOsSR57Dhy7lgzMXllaI45gD/Be3/mGNj u/WJuchLvzbVWdCIKj2VkhkoFSwAOGM+TextNX47lwONi2uAD22NdWFOvJl482paiwJO NcDmsYV9B0/cy6tyBCpATS4KGRXS2p2g0DU0J7a/5obD2lHEusSyM2V0aWjNXyKd/yTP 2KN1lTV5xuimgRXu/TH2n73s47B1dhGmTfLdqTYHWu64yxFh6VReXuq9dZ0W1vcTZUwZ U2eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=W34q62wnbcEPW0duNEY5kXGGBOUhTfu7N75owEwZnY4=; b=ao96ZVSoL+9O7CBOKFpyMc42AM65J3HiOGlHC931GxG2vwbNsKBQNgB4bD/bCPdrYW 0pkNr0O1gSnkMczL5KVun4PmcCs8fNyBWAiGyoTEXuh25Tb1rDlDFqEiooWdNCxAnJeZ HjvtXiYiVKBHY4MpTvjjRX6THIAK7bn1IOumfLB9goBEF2Snb7j3sLIGGGwiwFYl+h+4 xRPXErks6d3SZbC4VcpJcjGynaeLDVXsYxnQ/z8xxobuqS16H4B2Ot1yWkrsYQCx9gGf QvDAhSKo8GM+TBLsfT/o/Uk08pAijiSGSWNv2zGSiUnMTO9VRy0iQl4YifVgzGxaw5GR jFfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a056402274400b0043df391fc57si14895914edd.542.2022.08.17.08.52.37; Wed, 17 Aug 2022 08:53:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240173AbiHQP0d (ORCPT + 99 others); Wed, 17 Aug 2022 11:26:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235568AbiHQP0c (ORCPT ); Wed, 17 Aug 2022 11:26:32 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCA315EDC2; Wed, 17 Aug 2022 08:26:30 -0700 (PDT) Received: from fraeml739-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4M7BZ61jJJz67Hfl; Wed, 17 Aug 2022 23:21:34 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml739-chm.china.huawei.com (10.206.15.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 17 Aug 2022 17:26:28 +0200 Received: from localhost.localdomain (10.69.192.58) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 17 Aug 2022 16:26:26 +0100 From: John Garry To: , CC: , , , , , John Garry Subject: [RFT PATCH] ata: libata: Set __ATA_BASE_SHT max_sectors Date: Wed, 17 Aug 2022 23:20:08 +0800 Message-ID: <1660749608-62897-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.58] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 0568e6122574 ("ata: libata-scsi: cap ata_device->max_sectors according to shost->max_sectors") inadvertently capped the max_sectors value for some SATA disks to a value which is lower than we would want. For a device which supports LBA48, we would previously have request queue max_sectors_kb and max_hw_sectors_kb values of 1280 and 32767 respectively. For AHCI controllers, the value chosen for shost max sectors comes from the minimum of the SCSI host default max sectors in SCSI_DEFAULT_MAX_SECTORS (1024) and the shost DMA device mapping limit. This means that we would now set the max_sectors_kb and max_hw_sectors_kb values for a disk which supports LBA48 at 512, ignoring DMA mapping limit. As report by Oliver at [0], this caused a performance regression. Fix by picking a large enough max sectors value for ATA host controllers such that we don't needlessly reduce max_sectors_kb for LBA48 disks. [0] https://lore.kernel.org/linux-ide/YvsGbidf3na5FpGb@xsang-OptiPlex-9020/T/#m22d9fc5ad15af66066dd9fecf3d50f1b1ef11da3 Fixes: 0568e6122574 ("ata: libata-scsi: cap ata_device->max_sectors according to shost->max_sectors") Reported-by: Oliver Sang Signed-off-by: John Garry diff --git a/include/linux/libata.h b/include/linux/libata.h index 0269ff114f5a..698032e5ef2d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1382,7 +1382,8 @@ extern const struct attribute_group *ata_common_sdev_groups[]; .proc_name = drv_name, \ .slave_destroy = ata_scsi_slave_destroy, \ .bios_param = ata_std_bios_param, \ - .unlock_native_capacity = ata_scsi_unlock_native_capacity + .unlock_native_capacity = ata_scsi_unlock_native_capacity,\ + .max_sectors = ATA_MAX_SECTORS_LBA48 #define ATA_SUBBASE_SHT(drv_name) \ __ATA_BASE_SHT(drv_name), \ -- 2.35.3