Message ID | 20230530154231.8313-1-da.gomez@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2276722vqr; Tue, 30 May 2023 08:45:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6JJSo5TFwe7aG52Ffhesu/e+iLxQ253p+RBc6Xp4RpkQeiyMfD5YOiuilekQaxupvm+NRc X-Received: by 2002:a17:902:b18a:b0:1af:bae0:6be7 with SMTP id s10-20020a170902b18a00b001afbae06be7mr9641945plr.10.1685461544165; Tue, 30 May 2023 08:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685461544; cv=none; d=google.com; s=arc-20160816; b=HnU2PA7DgdYfp7g8Hb9MuXf6UnGjcFXTWUFOxbGWQs3Ds7cUcbpWZxnZCE2azeixib cJwvcifbf5rIzC1o7EBm6SfKjinQAflEZ4IYfKN3pkt2xfaitW9SWR1ebYDF38VyKe4x JAF05rHM1XqN3+ZLI0d0bPr5hg/l+aRKX074LgyHZn9yNzUQkm8OsymkoMDzmWmU+5Fv KuZthKzNqzCrfUVMlxyM0Z8/w5Sg9z8LSXkB7LJ0rBHhSLcy/f0X34SfBRCh/fv0Wdab 8jkYKpfNDuU+pyyjqIj3HLsA3Z1T+fOj3TnPSKL952kJiw54a9BByFkl/vEPtQ/R8FRx BFSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:mime-version :content-transfer-encoding:content-language:accept-language :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature:dkim-filter; bh=D9MPo121aL3nelbzhH23xAd4Mz9EDrpVEVg/G1e/LMQ=; b=P0xIa82lgYCnCefYaM9345fD7wBQxywPbGaZdXwDTrBQLaxB+EaXeWTu8UJ7U4eDWu pnwCZaCiUQc/8uPkxv0lB2LlFcxJDMHDO0RzORDThjTXYye+GImk5ZwpKpQUEeip26aM 397XA7Grn0ntALqz6Ej2C6qstxJ9HVbJo4KT8pUXIzSyBgYqHVB1zY2jvvkJTr/C19mJ eSUW/6/gufwadr6BuKKT8VOHtmY3xDlcOmrvCEw2kvvCCODjXrP9k6s0EZRrz8kUDCWH FbEgNwJhWMjBTY758UL5CQbmDWLkIc2ggIQxr8Zw45jNl7X7WgfBTuf0cEmCuvrdcZSp BG8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cJZ3hVfY; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jd3-20020a170903260300b001adcdac8969si1790810plb.463.2023.05.30.08.45.31; Tue, 30 May 2023 08:45:44 -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=pass header.i=@samsung.com header.s=mail20170921 header.b=cJZ3hVfY; 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=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231736AbjE3PnC (ORCPT <rfc822;andrewvogler123@gmail.com> + 99 others); Tue, 30 May 2023 11:43:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbjE3PnB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 30 May 2023 11:43:01 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27F5FE8 for <linux-kernel@vger.kernel.org>; Tue, 30 May 2023 08:42:58 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230530154255euoutp0255e0aae17554e1802ef9503fd3bf1560~j9jDNP1uU2029120291euoutp02e for <linux-kernel@vger.kernel.org>; Tue, 30 May 2023 15:42:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230530154255euoutp0255e0aae17554e1802ef9503fd3bf1560~j9jDNP1uU2029120291euoutp02e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685461375; bh=D9MPo121aL3nelbzhH23xAd4Mz9EDrpVEVg/G1e/LMQ=; h=From:To:CC:Subject:Date:References:From; b=cJZ3hVfYfSwPIYTYK4Y2mCnPRcJrrfnslK6s6q/cmX1JUx+OhcunqEDJ1T7YU63vz b5PE6i7vH4E1Iq8kli+d4Hu9oQ3cEXEwMykig4M+AKsoWN1JGRshZH/DjS8h3wdvWT 2lgALWOzInimbzb7ziVKJa77mdRdeU8XnWIXzxmw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230530154254eucas1p133f90b81c280e9e7ce3f0cf952804012~j9jCyYxPu3188231882eucas1p1B; Tue, 30 May 2023 15:42:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id F5.CC.42423.E7916746; Tue, 30 May 2023 16:42:54 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c~j9jCWB2xe1135211352eucas1p2e; Tue, 30 May 2023 15:42:54 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230530154254eusmtrp17d93ad1d405acff837c26834be3e08c4~j9jCQ1hXQ0860208602eusmtrp1w; Tue, 30 May 2023 15:42:53 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-18-6476197e63d7 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 5B.ED.14344.D7916746; Tue, 30 May 2023 16:42:53 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230530154253eusmtip13334881a5a0c7a3df7e8828dfe3195fe~j9jCAD65c0893008930eusmtip1s; Tue, 30 May 2023 15:42:53 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 30 May 2023 16:42:53 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Tue, 30 May 2023 16:42:53 +0100 From: Daniel Gomez <da.gomez@samsung.com> To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>, "Christoph Hellwig" <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me> CC: Pankaj Raghav <p.raghav@samsung.com>, "mcgrof@kernel.org" <mcgrof@kernel.org>, Daniel Gomez <da.gomez@samsung.com>, "linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: [PATCH] nvme: Increase block size variable size to 32-bit Thread-Topic: [PATCH] nvme: Increase block size variable size to 32-bit Thread-Index: AQHZkw1l1o9oL0yVTkSu68uk9vZQvw== Date: Tue, 30 May 2023 15:42:53 +0000 Message-ID: <20230530154231.8313-1-da.gomez@samsung.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [106.210.248.108] Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0hTYRjG+3aOZ8fF4nNKvq0bLbqotZIKTxejKw0qukoXiFzuYNGcsuOW RpRCWJlgmSkercyWOS0ru9kWRoYuLXNl5bKUNJem1ErtD1tqbsfC/37f+7zv8z68fDQhM/nI 6QO6eFavU2sVlIS8X91fP/foBKNmvvXqVKakOZ1izCVVIiaj8h1iGix5FHOp0ClmHGeciCnt dpErxKr6ltukqqHOoCorPkWp7piOqazvkyhVb9mUzdRuyTINqz1gZPXzlkdK9nd86EBxLknC n+99Pkmon05FvjTghZBSbCVTkYSW4SIEra9tYo8gw30IPvGJgtCLwJSSKvo34XL/oQThGoKs upvU/y576x1KGH+BwNUZIghmBF+Gnnp9KRwEFTVlYo8QgE8gqHZ/9D4IPIjA3ZtGerr88SrI sn9FHg7A68DhfOYjsBJyat3eOolnwKf0i8OhaFqKGeBPSz1lhCdDX3IJ4WECB0JT+6WR3H5Q kPuIEHg8DFpaKYHnQF1jOxJ4Pty7WkEKPB2cRU1iwUcJjvOZlMAhUHi52+sjHfasyWn3Xg/w A1+wF7cQnjyA10CracTTH7psd8UCT4Ln59JG/KPBVMqTZ1AwPyoqP2odP2odP2pdPiKLUSBr 4GKiWS5Uxx5ScuoYzqCLVkbFxpSh4Y/0fNDWU44udP1UViIRjSoR0IQiQBqu5jQyqUadeJjV x+7VG7QsV4km0qQiUBoSXhMlw9HqePYgy8ax+n+qiPaVJ4ki4xoe5U+PjDh5xLhRW/9qiZ2r GuJXdhxbI7XpiB/pYbb4BW2HruT/MnZapi6d2WxtoprTGm01t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dztu9L73ON/1fdvzqx5O6kF7ss1sip+z40qHeT 2b4kjE9t76/LgdlXVHfsmHZL98v1Jw+mu8zik1cQ/iRd8mlSnJ08c4ZY+lf7HeH6lxd9fdqh zN66PUjD4deMaysieGTNF2a8ZJNqLLM9s8z0VLnFlL43XC/eHPaZa3z1zQGJP19K0xo363gI ih040xA8UVuBMazz/D9Ved+rs60Zvl46u9AtSuh87bUvwmrrBV9nOrFazdp3plEs48hB++up v2367Pb/1FVbcuCn6iOVbwcMjj222WO928Eret9a6W8nT715eEbpcqaeWN2zpGcvjX9v1GBI SF+87FjnNdvu2tsH1pzhqr6knvjlJkvifiWW4oxEQy3mouJEAK5chmGdAwAA X-CMS-MailID: 20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c X-Msg-Generator: CA X-RootMTR: 20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c References: <CGME20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c@eucas1p2.samsung.com> X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767334523972405791?= X-GMAIL-MSGID: =?utf-8?q?1767334523972405791?= |
Series |
nvme: Increase block size variable size to 32-bit
|
|
Commit Message
Daniel Gomez
May 30, 2023, 3:42 p.m. UTC
Increase block size variable size to 32-bit unsigned to be able to
support block devices larger than 32k (starting from 64 KiB).
Physical and logical block size already support unsigned 32-bit.
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
While experimenting and doing code inspection for large block
devices, we found a limitation of a 32 KiB block size due to the bs
variable type. With that limitation and in combination with a large
block device, this results in a kernel BUG when the block layer
attempts to split a block size of 0 bytes.
Increasing the value to 32-bit unsigned, allows to support large block
devices starting from 64 KiB. In addition, this bs variable type
aligns with the queue_limits logical/physical_block_size types.
drivers/nvme/host/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.40.1
Comments
On Tue, May 30, 2023 at 03:42:53PM +0000, Daniel Gomez wrote: > Increase block size variable size to 32-bit unsigned to be able to > support block devices larger than 32k (starting from 64 KiB). > > Physical and logical block size already support unsigned 32-bit. > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Luis
On Tue, May 30, 2023 at 03:42:53PM +0000, Daniel Gomez wrote: > Increase block size variable size to 32-bit unsigned to be able to > support block devices larger than 32k (starting from 64 KiB). Looks good, Reviewed-by: Keith Busch <kbusch@kernel.org>
> + u32 bs = 1 << ns->lba_shift; Make that 1 a 1U so that we're not going to run into sign extension issues when using up all bits in the u32 :) Otherwise looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
From: Christoph Hellwig > Sent: 31 May 2023 14:03 > > > + u32 bs = 1 << ns->lba_shift; > > Make that 1 a 1U so that we're not going to run into sign extension > issues when using up all bits in the u32 :) Not 'sign extension' but obscure integer shift/conversion issues that really only affect 1's compliment and sign-overpunch cpu. I'm not even sure gcc/clang support any non 2's compliment systems. > Otherwise looks good: Probably improves the generated code as well. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Thanks, applied to 6.5 with the '1U' suggestion folded in.
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 151b23400ada..b4bc48f2a011 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1835,7 +1835,7 @@ static void nvme_update_disk_info(struct gendisk *disk, struct nvme_ns *ns, struct nvme_id_ns *id) { sector_t capacity = nvme_lba_to_sect(ns, le64_to_cpu(id->nsze)); - unsigned short bs = 1 << ns->lba_shift; + u32 bs = 1 << ns->lba_shift; u32 atomic_bs, phys_bs, io_opt = 0; /*