Received: by 10.223.176.5 with SMTP id f5csp832262wra; Sat, 3 Feb 2018 11:17:24 -0800 (PST) X-Google-Smtp-Source: AH8x226SfnmmPOr8Gj+LfxiJf8jJ6j2ySpdTaosePGnj+AG2msv1TYACvkLZCpNQC6PfaJil1hGx X-Received: by 2002:a17:902:9348:: with SMTP id g8-v6mr38132720plp.102.1517685444701; Sat, 03 Feb 2018 11:17:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517685444; cv=none; d=google.com; s=arc-20160816; b=G6Ew7uA0nmOQa9v7vBBXJVEU2crE3lPC5s8sp1Ds/e3xU8zQESC8m8npxHMHKd1dbs qgISeDJBiAlvPFOn1Z8A8yGglcdHCC73NXovmsgzjceE7LPaKf8ELWEZKleRnKW+79ef ic+gEfw3Q59sPAztpclP01GcIUyQMec5zpzdb1y9ENEAL5ZnoT0YYbDkFMzgCTSHpCK3 L5EmrpD2QrFTN1sMnteSXb07ffT9F8yxlDNfwN+i0p1WZ6lDuEmgaGAdzhU03d+S72nw cTJNZHTW1m1pp/T41bPUjP/Lfm7nlSWS0/li18UIbfmJ5zzRNgSKdE0/BfRXDdtbwMFl K/ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=+60SKaiPKgSJRuiD2EvphcHx10mE6W0wWc8Taf/aQ3c=; b=B2kMa0apooTXFQcWiffmVQO+mA78YPjdws/08Crulm6XMoBW+ptkKzdzzVhkiWAo1M K0SwVtqdVZ8tdrupEiH45FDSy4NjzxnnkKiS592PVFyyvZSAoldxniTeIK3yurqblNwa 8OOigRaGPuDbwcDo9WSx7RRIVzY5tuFUQvXXwbncVNJJqzvB1WA+/V/C5Tf/pCamBRHj 87ydOJEkP8GWVmdPpn9SJjzErqwaTYiIz91LZUHi7qTXnrdQ4ruDvwiPYRdfC21EcOgU /SnLECOosJSLlCgnpB5vhChxrlGq36yIyBShBh92NqxCkrU8wEzCH09oXePJvnHn7yLg 5UIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=N78gnfVQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si1476110pgs.86.2018.02.03.11.17.08; Sat, 03 Feb 2018 11:17:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=N78gnfVQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753215AbeBCSDQ (ORCPT + 99 others); Sat, 3 Feb 2018 13:03:16 -0500 Received: from mail-co1nam03on0122.outbound.protection.outlook.com ([104.47.40.122]:24267 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752236AbeBCSAk (ORCPT ); Sat, 3 Feb 2018 13:00:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=+60SKaiPKgSJRuiD2EvphcHx10mE6W0wWc8Taf/aQ3c=; b=N78gnfVQuKIFst1ZsDHtnzvtxrvleaN6ZADus+EuJc8xarL3Fm2YneNF6JKTBFeGAG/T+Ddnpn2QabHusKJhRRLIV6+kz3RIg+iPv7Lj8dE5cdtc2LU+QGD9cCF4omUPzOUVVIGfqc4ZFqTDd2UwJ9mX3lFpQ5wO4ChnXV00NDk= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB1043.namprd21.prod.outlook.com (52.132.24.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.506.3; Sat, 3 Feb 2018 18:00:32 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:00:32 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Keith Busch , Christoph Hellwig , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 009/110] nvme: check hw sectors before setting chunk sectors Thread-Topic: [PATCH AUTOSEL for 4.14 009/110] nvme: check hw sectors before setting chunk sectors Thread-Index: AQHTnRjhVrgVrD2KOk2Hd4UF6pnnSQ== Date: Sat, 3 Feb 2018 18:00:30 +0000 Message-ID: <20180203180015.29073-9-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BL0PR2101MB1043;7:5bgLBDA903h/l2gmpnP4Av85O5vNi+jq8e3dtHc3DpsxV4UZHaSagMnBR8whW0ePnOq2KY7c2OsWWiSY8de94xaSFoDKD09dWHtzBq+o0EiyADO6Qus8igQ5R1S4SJyVg50jNB1dSREDYMcKmZat4kuqHW+VJMOrZtfbW97ANf/1Qu/eYom63LWxn5joLZoJ3ld1YiNAYDJeLTHaorJya74juOlVL4I5kmLtQzr5O88DDD3pALrHcQ0Ugb4t3O59 x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3d2fa894-1e65-47fa-cb84-08d56b3004fa x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB1043; x-ms-traffictypediagnostic: BL0PR2101MB1043: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(146099531331640)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3231101)(2400082)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:BL0PR2101MB1043;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB1043; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(376002)(39860400002)(366004)(346002)(396003)(189003)(199004)(59450400001)(10290500003)(186003)(6486002)(14454004)(1076002)(102836004)(6506007)(76176011)(26005)(6346003)(66066001)(10090500001)(5250100002)(36756003)(6512007)(2501003)(110136005)(99286004)(54906003)(478600001)(53936002)(72206003)(6436002)(316002)(305945005)(7736002)(2950100002)(2906002)(5660300001)(4326008)(106356001)(86362001)(97736004)(25786009)(22452003)(2900100001)(3846002)(107886003)(8676002)(8936002)(6116002)(3280700002)(105586002)(81156014)(81166006)(3660700001)(86612001)(68736007)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB1043;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: reWFLhv1nzJeP6evGmsRFV4FnMuod7JBJUIxWTDI7AHvr/j/EBwnkNhI03Tu2VEBXMyDYrzzjB6rmCeX/Z6YgQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d2fa894-1e65-47fa-cb84-08d56b3004fa X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:00:30.5815 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB1043 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Keith Busch [ Upstream commit 249159c5f15812140fa216f9997d799ac0023a1f ] Some devices with IDs matching the "stripe" quirk don't actually have this quirk, and don't have an MDTS value. When MDTS is not set, the driver sets the max sectors to UINT_MAX, which is not a power of 2, hitting a BUG_ON from blk_queue_chunk_sectors. This patch skips setting chunk sectors for such devices. Signed-off-by: Keith Busch Reviewed-by: Martin K. Petersen Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 0655f45643d9..dd956311a85a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1515,7 +1515,8 @@ static void nvme_set_queue_limits(struct nvme_ctrl *c= trl, blk_queue_max_hw_sectors(q, ctrl->max_hw_sectors); blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX)); } - if (ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) + if ((ctrl->quirks & NVME_QUIRK_STRIPE_SIZE) && + is_power_of_2(ctrl->max_hw_sectors)) blk_queue_chunk_sectors(q, ctrl->max_hw_sectors); blk_queue_virt_boundary(q, ctrl->page_size - 1); if (ctrl->vwc & NVME_CTRL_VWC_PRESENT) --=20 2.11.0