On Fri, Oct 15, 2021 at 09:58:49AM +0000, Dmitry Kozlyuk wrote: > > > > -----Original Message----- > > From: Olivier Matz <olivier.m...@6wind.com> > > Sent: 15 октября 2021 г. 12:43 > > To: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> > > Cc: Dmitry Kozlyuk <dkozl...@nvidia.com>; dev@dpdk.org; Matan Azrad > > <ma...@nvidia.com> > > Subject: Re: [PATCH v4 2/4] mempool: add non-IO flag > > > > External email: Use caution opening links or attachments > > > > > > On Fri, Oct 15, 2021 at 12:33:31PM +0300, Andrew Rybchenko wrote: > > > On 10/15/21 12:18 PM, Dmitry Kozlyuk wrote: > > > >> -----Original Message----- > > > >> From: Andrew Rybchenko <andrew.rybche...@oktetlabs.ru> [...] > > > >>> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c > > > >>> index 51c0ba2931..2204f140b3 100644 > > > >>> --- a/lib/mempool/rte_mempool.c > > > >>> +++ b/lib/mempool/rte_mempool.c > > > >>> @@ -371,6 +371,8 @@ rte_mempool_populate_iova(struct rte_mempool > > > >>> *mp, char *vaddr, > > > >>> > > > >>> STAILQ_INSERT_TAIL(&mp->mem_list, memhdr, next); > > > >>> mp->nb_mem_chunks++; > > > >>> + if (iova == RTE_BAD_IOVA) > > > >>> + mp->flags |= MEMPOOL_F_NON_IO; > > > >> > > > >> As I understand rte_mempool_populate_iova() may be called few times > > > >> for one mempool. The flag must be set if all invocations are done > > > >> with RTE_BAD_IOVA. So, it should be set by default and just removed > > > >> when iova != RTE_BAD_IOVA happens. > > > > > > > > I don't agree at all. If any object of the pool is unsuitable for > > > > IO, the pool cannot be considered suitable for IO. So if there's a > > > > single invocation with RTE_BAD_IOVA, the flag must be set forever. > > > > > > If so, some objects may be used for IO, some cannot be used. > > > What should happen if an application allocates an object which is > > > suitable for IO and try to use it this way? > > > > If the application can predict if the allocated object is usable for IO > > before allocating it, I would be surprised to have it used for IO. I agree > > with Dmitry here. > > The flag hints to components, PMDs before all, > that objects from this mempool will never be used for IO, > so that the component can save some memory mapping or DMA configuration. > If the flag is set when even a single object may be used for IO, > the consumer of the flag will not be ready for that. > Whatever a corner case it is, Andrew is correct. > There is a subtle difference between "pool is not usable" > (as described now) and "objects from this mempool will never be used" > (as stated above), I'll highlight it in the flag description.
OK, agreed, thanks.