Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-05-11 Thread Don Dutile
On 4/8/21 1:01 PM, Logan Gunthorpe wrote: dma_map_sg() either returns a positive number indicating the number of entries mapped or zero indicating that resources were not available to create the mapping. When zero is returned, it is always safe to retry the mapping later once resources have been

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-05-03 Thread Logan Gunthorpe
On 2021-05-03 12:28 p.m., Christoph Hellwig wrote: > On Tue, Apr 27, 2021 at 08:01:13PM -0300, Jason Gunthorpe wrote: >> At a high level I'm OK with it. dma_map_sg_attrs() is the extra >> extended version of dma_map_sg(), it already has a different >> signature, a different return code is not ou

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-05-03 Thread Christoph Hellwig
On Tue, Apr 27, 2021 at 08:01:13PM -0300, Jason Gunthorpe wrote: > At a high level I'm OK with it. dma_map_sg_attrs() is the extra > extended version of dma_map_sg(), it already has a different > signature, a different return code is not out of the question. > > dma_map_sg() is just the simple eas

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-05-03 Thread Logan Gunthorpe
On 2021-05-02 3:23 p.m., John Hubbard wrote: > On 4/8/21 10:01 AM, Logan Gunthorpe wrote: >> dma_map_sg() either returns a positive number indicating the number >> of entries mapped or zero indicating that resources were not available >> to create the mapping. When zero is returned, it is always

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-05-02 Thread John Hubbard
On 4/8/21 10:01 AM, Logan Gunthorpe wrote: dma_map_sg() either returns a positive number indicating the number of entries mapped or zero indicating that resources were not available to create the mapping. When zero is returned, it is always safe to retry the mapping later once resources have been

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-04-27 Thread Jason Gunthorpe
On Tue, Apr 27, 2021 at 04:55:45PM -0600, Logan Gunthorpe wrote: > > Also, I see only 8 users of this function. How about just fix them all > > to support negative returns and use this as the p2p API instead of > > adding new API? > > Well there might be 8 users of dma_map_sg_attrs() but there ar

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-04-27 Thread Logan Gunthorpe
On 2021-04-27 1:31 p.m., Jason Gunthorpe wrote: > On Thu, Apr 08, 2021 at 11:01:12AM -0600, Logan Gunthorpe wrote: >> +/* >> + * dma_maps_sg_attrs returns 0 on error and > 0 on success. >> + * It should never return a value < 0. >> + */ > > Also it is weird a function that can't return 0 is ret

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-04-27 Thread Logan Gunthorpe
On 2021-04-27 1:22 p.m., Jason Gunthorpe wrote: > On Thu, Apr 08, 2021 at 11:01:12AM -0600, Logan Gunthorpe wrote: >> dma_map_sg() either returns a positive number indicating the number >> of entries mapped or zero indicating that resources were not available >> to create the mapping. When zero

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-04-27 Thread Jason Gunthorpe
On Thu, Apr 08, 2021 at 11:01:12AM -0600, Logan Gunthorpe wrote: > +/* > + * dma_maps_sg_attrs returns 0 on error and > 0 on success. > + * It should never return a value < 0. > + */ Also it is weird a function that can't return 0 is returning an int type > +int dma_map_sg_attrs(struct device *de

Re: [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-04-27 Thread Jason Gunthorpe
On Thu, Apr 08, 2021 at 11:01:12AM -0600, Logan Gunthorpe wrote: > dma_map_sg() either returns a positive number indicating the number > of entries mapped or zero indicating that resources were not available > to create the mapping. When zero is returned, it is always safe to retry > the mapping la

[PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma()

2021-04-08 Thread Logan Gunthorpe
dma_map_sg() either returns a positive number indicating the number of entries mapped or zero indicating that resources were not available to create the mapping. When zero is returned, it is always safe to retry the mapping later once resources have been freed. Once P2PDMA pages are mixed into the