* [PATCH] nvme: Increase block size variable size to 32-bit [not found] <CGME20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c@eucas1p2.samsung.com> @ 2023-05-30 15:42 ` Daniel Gomez 2023-05-30 16:24 ` Luis Chamberlain ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Daniel Gomez @ 2023-05-30 15:42 UTC (permalink / raw) To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg Cc: Pankaj Raghav, mcgrof@kernel.org, Daniel Gomez, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org 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(-) 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; /* -- 2.40.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme: Increase block size variable size to 32-bit 2023-05-30 15:42 ` [PATCH] nvme: Increase block size variable size to 32-bit Daniel Gomez @ 2023-05-30 16:24 ` Luis Chamberlain 2023-05-30 17:27 ` Keith Busch 2023-05-31 13:03 ` Christoph Hellwig 2 siblings, 0 replies; 6+ messages in thread From: Luis Chamberlain @ 2023-05-30 16:24 UTC (permalink / raw) To: Daniel Gomez Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg, Pankaj Raghav, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme: Increase block size variable size to 32-bit 2023-05-30 15:42 ` [PATCH] nvme: Increase block size variable size to 32-bit Daniel Gomez 2023-05-30 16:24 ` Luis Chamberlain @ 2023-05-30 17:27 ` Keith Busch 2023-05-31 13:03 ` Christoph Hellwig 2 siblings, 0 replies; 6+ messages in thread From: Keith Busch @ 2023-05-30 17:27 UTC (permalink / raw) To: Daniel Gomez Cc: Jens Axboe, Christoph Hellwig, Sagi Grimberg, Pankaj Raghav, mcgrof@kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org 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> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme: Increase block size variable size to 32-bit 2023-05-30 15:42 ` [PATCH] nvme: Increase block size variable size to 32-bit Daniel Gomez 2023-05-30 16:24 ` Luis Chamberlain 2023-05-30 17:27 ` Keith Busch @ 2023-05-31 13:03 ` Christoph Hellwig 2023-06-01 10:28 ` David Laight 2023-06-01 17:10 ` Keith Busch 2 siblings, 2 replies; 6+ messages in thread From: Christoph Hellwig @ 2023-05-31 13:03 UTC (permalink / raw) To: Daniel Gomez Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg, Pankaj Raghav, mcgrof@kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.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> ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] nvme: Increase block size variable size to 32-bit 2023-05-31 13:03 ` Christoph Hellwig @ 2023-06-01 10:28 ` David Laight 2023-06-01 17:10 ` Keith Busch 1 sibling, 0 replies; 6+ messages in thread From: David Laight @ 2023-06-01 10:28 UTC (permalink / raw) To: 'Christoph Hellwig', Daniel Gomez Cc: Keith Busch, Jens Axboe, Sagi Grimberg, Pankaj Raghav, mcgrof@kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org 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) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme: Increase block size variable size to 32-bit 2023-05-31 13:03 ` Christoph Hellwig 2023-06-01 10:28 ` David Laight @ 2023-06-01 17:10 ` Keith Busch 1 sibling, 0 replies; 6+ messages in thread From: Keith Busch @ 2023-06-01 17:10 UTC (permalink / raw) To: Christoph Hellwig Cc: Daniel Gomez, Jens Axboe, Sagi Grimberg, Pankaj Raghav, mcgrof@kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Thanks, applied to 6.5 with the '1U' suggestion folded in. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-01 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20230530154254eucas1p241e57af99e4d4ee0e1a677904c3db68c@eucas1p2.samsung.com>
2023-05-30 15:42 ` [PATCH] nvme: Increase block size variable size to 32-bit Daniel Gomez
2023-05-30 16:24 ` Luis Chamberlain
2023-05-30 17:27 ` Keith Busch
2023-05-31 13:03 ` Christoph Hellwig
2023-06-01 10:28 ` David Laight
2023-06-01 17:10 ` Keith Busch
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox