Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1124399ioo; Sun, 22 May 2022 04:37:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCCljWvSIMm8oeaugddW4XK79/X0vtWmybmykasbXOkmkEyS1ohO9AiVfzNRd+1J6bwRLP X-Received: by 2002:a17:90b:3884:b0:1df:db8a:1fcf with SMTP id mu4-20020a17090b388400b001dfdb8a1fcfmr18197607pjb.217.1653219423980; Sun, 22 May 2022 04:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653219423; cv=none; d=google.com; s=arc-20160816; b=umdMbE8tsdLbnvzXAouafJUzc7P/LN8soUvYv8dgBlM/qlx8uFF1uzAAs3YRVpTq2t wt3kuPk4M+lkFAfdrLx3MoERXe9ASDcDlNgURO6CgnvuotYTaiKU9IUhXPCl0a70iKEt PQph4QRLyw1MoL/bmH6KT3LtoV1DMRdYa2u7zxsXIfbJSXfzukFgSjIKk0q2rvb5ZUBx rX8/YwFMRZ8tBmnI5xHDPgIxx4tqyT+jwPE+tRnlcsERsagBO6t8+tPE/PPBKW1Nmics UM72TmokZl2HwrtK9y7Qx2MLnrXh4soLd6l8lwa+e96QUGtFGL8jo6NZfHVCaSh47DdB ag4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=ush1N6UNyJAIPEutUbeBmEzd3r4bVoBiFTd7ZwQBL80=; b=JtGp/aJuZVqmoaRUr5lA2OSogoxdLJJ61uzpMwCFrPs/oz7Sz5dKbLXdM6nbnUKwMu Hn89cYC0lN1zwQvpK+OeyIjXTIfdjx+AKQdWVr4mwyp2B0IsjsKaXv8JM8Rc0cKmRySw 8uXOM170czXXUVWCyZ1B3stOXIS+6VEqZ+U6F5o38LvE2zsVJkNrHi9y9Jo2p5nyAis3 DnajuoPj171xXsa1eE8p+K7Jv7mj092aCBSY0NRQ+5fLR8B/VWk93VhXlu2AD/r8h77D XBwd1Tu1e2l1BAxqb4UzLrAl/2fMUL1zRCqVpZ+4Y/hXG4wOArHjsEKsMENdrz6W0J5+ h0XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=WU5QGbVX; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b="IAZfh2N/"; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h65-20020a62de44000000b005188836a38bsi4300860pfg.243.2022.05.22.04.36.53; Sun, 22 May 2022 04:37: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; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=WU5QGbVX; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b="IAZfh2N/"; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354163AbiETXeP (ORCPT + 99 others); Fri, 20 May 2022 19:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231439AbiETXeJ (ORCPT ); Fri, 20 May 2022 19:34:09 -0400 Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F32C81A7D2B for ; Fri, 20 May 2022 16:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1653089648; x=1684625648; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=cxD0WkTRuBGs7QMn33plUCWC3KT9kbapNpgQIUmBMA8=; b=WU5QGbVXgqoJSzhNmD0ZQxyYaacyb/Ed78b452a9wN95QxdWblf1U4RN C6yLFNm52sfJAzzO+yeoEuZL39zb+iLQE8GgXSP1nIH09XTVpEM0ILyfo WCByek4HZobNKbDysRkyAU0D/sCncSg70flQ2tGU2kYkdZw7p0nizW1lT 4TnZRnpAOXgjbfu2i57q77IKeTDRXsWx59Gj75CO5aqppWURkJbJL4IDS DvwJEarG0WhhoGHRVbo6p/soc1qATBAbHgcoT51CQ7wu1vgX0/GToGOEW 3wU4gk0X5fUQV5n39vVnDyNXi2O+83znuSUDcJvKyYBaQ1NsM8MH//oaU w==; X-IronPort-AV: E=Sophos;i="5.91,240,1647273600"; d="scan'208";a="200966409" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 21 May 2022 07:34:07 +0800 IronPort-SDR: Yc2OuQSEFpK0b/9UukqWftPoMtnutwETM2S5cpmH/9XHGc/K903w1x0JgM4P6AjUK4fXzyIsKD ZTWWo3J4tjB+KFLYfc61cj77JJ/4UGnH/B++ZGsa3s4Zdhi6tf3EtKdGdCxJut2/wktcEoxz54 xhy1DQnPXfiCcL8h+Tsa9H6Dgq5W9ZOWgujIhZPyAYQ6TTxaPt7GYW0xJ03vxvnNoi0155ZF9r fAoVlg1AXHWzS+vho2ERgnJW9LtWAp/nF7ysuC0vQsYcVkaD+i63BxFGMybofLbUlEqJ6S1mL8 u0ArP4pviGNgxxLrE9yYGHEJ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 May 2022 15:56:51 -0700 IronPort-SDR: kXTB591zHXOaGYjbc/XthMr+rNfXtv2v9xMZk2uWc6OIH7TC5dIXiH77S/oMvQtE3ZSjKKn3iC nlDF5tDf36Zl6pKMvtdV0bfNerQs2aYpbQ5zyprBbOq4IZDoBUcEy8JE2oHCc+Tx6KiUHGf9Ft a+nZMFcLDIggbGuA/CLpP/S9tTERgR34oEZ8YSO+R8pIn+Wq5MMKk/mm1tjxY7yfbmWETmIF0+ jQnW4/B9oxFG/3vkCqKgR60G58eK/5C/yg5i0A7W7bHnnqIVUUZ8L/1Hi9KWtF/jGmz+Qekylr FUk= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 20 May 2022 16:34:07 -0700 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4L4jjW0x04z1SVp7 for ; Fri, 20 May 2022 16:34:07 -0700 (PDT) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1653089646; x=1655681647; bh=cxD0WkTRuBGs7QMn33plUCWC3KT9kbapNpg QIUmBMA8=; b=IAZfh2N/A1jItIRu6RNK4GCq/n7NLG1+opKeFCVPmNoD3nU4SpR bC6akAQHrRKjwDRGh4NXwXV/FMrBCZ6GcNYZcuC2ARib1r2sjAHkGU9Ep1cDFwop mDfqvuMSQssge51ujkq7vQ5pCjovouoGBfDz3E5IaM9G2Qqp9uzAo46qFsID7yHl Vw6amvteVP/EJl7jEGH7Boh6b3YkUpvvr5IwG9eq9uJub53GSlGzOb852GLfBhb/ JW5MGlFzL5zQEqnjhAL3oRx/o0N9qjqNC1su+SaebsoCtTk5dX1J8MyoLkNh1FZr qCDdMdkk9R1i9CbzUDAwGjlwztQvrlS+5aw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id J_-CnV0JDusr for ; Fri, 20 May 2022 16:34:06 -0700 (PDT) Received: from [10.225.163.51] (unknown [10.225.163.51]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4L4jjS0PF4z1Rvlc; Fri, 20 May 2022 16:34:03 -0700 (PDT) Message-ID: <1a683059-d718-9536-e8fe-d7d47e25e935@opensource.wdc.com> Date: Sat, 21 May 2022 08:34:03 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 4/4] libata-scsi: Cap ata_device->max_sectors according to shost->max_sectors Content-Language: en-US To: John Garry , joro@8bytes.org, will@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, iommu@lists.linux-foundation.org, linux-scsi@vger.kernel.org, liyihang6@hisilicon.com, chenxiang66@hisilicon.com, thunder.leizhen@huawei.com References: <1653035003-70312-1-git-send-email-john.garry@huawei.com> <1653035003-70312-5-git-send-email-john.garry@huawei.com> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <1653035003-70312-5-git-send-email-john.garry@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 5/20/22 17:23, John Garry wrote: > ATA devices (struct ata_device) have a max_sectors field which is > configured internally in libata. This is then used to (re)configure the > associated sdev request queue max_sectors value from how it is earlier set > in __scsi_init_queue(). In __scsi_init_queue() the max_sectors value is set > according to shost limits, which includes host DMA mapping limits. > > Cap the ata_device max_sectors according to shost->max_sectors to respect > this shost limit. > > Signed-off-by: John Garry > --- > drivers/ata/libata-scsi.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c > index 06c9d90238d9..25fe89791641 100644 > --- a/drivers/ata/libata-scsi.c > +++ b/drivers/ata/libata-scsi.c > @@ -1036,6 +1036,7 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) > dev->flags |= ATA_DFLAG_NO_UNLOAD; > > /* configure max sectors */ > + dev->max_sectors = min(dev->max_sectors, sdev->host->max_sectors); > blk_queue_max_hw_sectors(q, dev->max_sectors); > > if (dev->class == ATA_DEV_ATAPI) { Acked-by: Damien Le Moal -- Damien Le Moal Western Digital Research