lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250423133939.GJ48485@unreal>
Date: Wed, 23 Apr 2025 16:39:39 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: Marek Szyprowski <m.szyprowski@...sung.com>,
	Jens Axboe <axboe@...nel.dk>, Keith Busch <kbusch@...nel.org>,
	Jake Edge <jake@....net>, Jonathan Corbet <corbet@....net>,
	Jason Gunthorpe <jgg@...pe.ca>, Zhu Yanjun <zyjzyj2000@...il.com>,
	Robin Murphy <robin.murphy@....com>, Joerg Roedel <joro@...tes.org>,
	Will Deacon <will@...nel.org>, Sagi Grimberg <sagi@...mberg.me>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Logan Gunthorpe <logang@...tatee.com>,
	Yishai Hadas <yishaih@...dia.com>,
	Shameer Kolothum <shameerali.kolothum.thodi@...wei.com>,
	Kevin Tian <kevin.tian@...el.com>,
	Alex Williamson <alex.williamson@...hat.com>,
	Jérôme Glisse <jglisse@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-block@...r.kernel.org, linux-rdma@...r.kernel.org,
	iommu@...ts.linux.dev, linux-nvme@...ts.infradead.org,
	linux-pci@...r.kernel.org, kvm@...r.kernel.org, linux-mm@...ck.org,
	Niklas Schnelle <schnelle@...ux.ibm.com>,
	Chuck Lever <chuck.lever@...cle.com>,
	Luis Chamberlain <mcgrof@...nel.org>,
	Matthew Wilcox <willy@...radead.org>,
	Dan Williams <dan.j.williams@...el.com>,
	Kanchan Joshi <joshi.k@...sung.com>,
	Chaitanya Kulkarni <kch@...dia.com>
Subject: Re: [PATCH v9 22/24] nvme-pci: use a better encoding for small prp
 pool allocations

On Wed, Apr 23, 2025 at 11:05:52AM +0200, Christoph Hellwig wrote:
> On Wed, Apr 23, 2025 at 11:13:13AM +0300, Leon Romanovsky wrote:
> > From: Christoph Hellwig <hch@....de>
> > 
> > There is plenty of unused space in the iod next to nr_descriptors.
> > Add a separate flag to encode that the transfer is using the full
> > page sized pool, and use a normal 0..n count for the number of
> > descriptors.
> > 
> > Signed-off-by: Christoph Hellwig <hch@....de>
> > Tested-by: Jens Axboe <axboe@...nel.dk>
> > [ Leon: changed original bool variable to be flag as was proposed by Kanchan ]
> > Signed-off-by: Kanchan Joshi <joshi.k@...sung.com>
> > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> > ---
> >  drivers/nvme/host/pci.c | 93 ++++++++++++++++++++---------------------
> >  1 file changed, 46 insertions(+), 47 deletions(-)
> > 
> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index 638e759b29ad..7e93536d01cb 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -44,6 +44,7 @@
> >  #define NVME_MAX_SEGS	128
> >  #define NVME_MAX_META_SEGS 15
> >  #define NVME_MAX_NR_DESCRIPTORS	5
> > +#define NVME_SMALL_DESCRIPTOR_SIZE 256
> >  
> >  static int use_threaded_interrupts;
> >  module_param(use_threaded_interrupts, int, 0444);
> > @@ -219,6 +220,10 @@ struct nvme_queue {
> >  	struct completion delete_done;
> >  };
> >  
> > +enum {
> > +	IOD_LARGE_DESCRIPTORS = 1, /* uses the full page sized descriptor pool */
> 
> This is used as a ORable flag, I'd make that explicit:
> 
> 	/* uses the full page sized descriptor pool */
> 	IOD_LARGE_DESCRIPTORS		= 1U << 0,
> 
> and similar for the next flag added in the next patch.
> 
> >  	struct nvme_request req;
> >  	struct nvme_command cmd;
> >  	bool aborted;
> > -	/* # of PRP/SGL descriptors: (0 for small pool) */
> > -	s8 nr_descriptors;
> > +	u8 nr_descriptors;	/* # of PRP/SGL descriptors */
> > +	unsigned int flags;
> 
> And this should be limited to a u16 to not bloat the structure.

I'll limit it to u8.

Thanks

> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ