From patchwork Wed Jun 6 03:08:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 10449557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 435F360146 for ; Wed, 6 Jun 2018 03:08:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F52927CF3 for ; Wed, 6 Jun 2018 03:08:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02E2222380; Wed, 6 Jun 2018 03:08:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E554429AD5 for ; Wed, 6 Jun 2018 03:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752762AbeFFDIO (ORCPT ); Tue, 5 Jun 2018 23:08:14 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:47402 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752574AbeFFDIO (ORCPT ); Tue, 5 Jun 2018 23:08:14 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5636ciJ045996; Wed, 6 Jun 2018 03:08:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : subject : from : references : date : in-reply-to : message-id : mime-version : content-type; s=corp-2017-10-26; bh=7T1rDOqelREU4TSVEP4NVcvx6kxRPzh/ylnoex5y3xE=; b=K5jCZWxmv/TCdLA9ZX9ZDoHjIc/8/pkqfeRQvvptd8kEZ/7AH9UHr8xsBZ2i+N/Xr7wB g2q8HrUyD5oYxV1hwlTced+K4ys3baxTeloMWvqDEgh3mj1ywcXw6mN39NDJI27/efGR RGoKOqhJWnUvw3ypnR9X/Us/aLe3ih6H3YqYIki1P8gZntjPghO0KDWNRHgsbZg2uN7F W1b1620i+eIz1VkcUmr9uF/AxuQDUwDztRbSkhyc/CN1MW7Pcj8FgxBsZLnN6//QmTY1 JRGlu2kZ0hMCLIMOk6lvSJahzsMXEGVjvdHTVWpdrANeerfN6b8Z5sEIJBuztSxdnLrI GQ== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2jbvypasb0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 06 Jun 2018 03:08:04 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w56383SN021265 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 6 Jun 2018 03:08:03 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w56382UH006363; Wed, 6 Jun 2018 03:08:02 GMT Received: from ca-mkp.ca.oracle.com (/10.159.214.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Jun 2018 20:08:02 -0700 To: Christoph Anton Mitterer Cc: linux-scsi@vger.kernel.org Subject: Re: bogus optimal IO sizes for ASMedia ASM105x From: "Martin K. Petersen" Organization: Oracle Corporation References: Date: Tue, 05 Jun 2018 23:08:00 -0400 In-Reply-To: (Christoph Anton Mitterer's message of "Sat, 02 Jun 2018 21:23:27 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8915 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=842 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806060033 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Christoph, > Apparently the optimal IO sizes reported by the ASMedia ASM105x is > bogus. > > Not sure whether the kernel provides means to work around quirks at > this level, but in case it does it would be nice if some reasonable > value could be used to override the opt io of 33553920. We have had devices with bogus values before. The problem in this case is that 32M is a large, but not entirely unreasonable, stripe I/O width for a storage array. Does this fix it for you? diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 9421d9877730..4e2fdfa870c2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3126,12 +3126,13 @@ static int sd_revalidate_disk(struct gendisk *disk) /* * Determine the device's preferred I/O size for reads and writes - * unless the reported value is unreasonably small, large, or - * garbage. + * unless the reported value is unreasonably small, large, not a + * multiple of the physical block size, or simply garbage. */ if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max && sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS && + sdkp->opt_xfer_blocks & sdkp->physical_block_size - 1 != 0 && logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) { q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks); rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);