From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 16 Apr 2019 15:31:30 +0200 From: Halil Pasic Subject: Re: [RFC PATCH 04/12] s390/cio: introduce cio DMA pool In-Reply-To: References: <20190404231622.52531-1-pasic@linux.ibm.com> <20190404231622.52531-5-pasic@linux.ibm.com> <20190412132010.3c74cb63@oc2783563651> <20190412173017.04b768bb@oc2783563651> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20190416153130.2b430744@oc2783563651> Sender: kvm-owner@vger.kernel.org List-Archive: List-Post: To: Sebastian Ott Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org, Cornelia Huck , Martin Schwidefsky , virtualization@lists.linux-foundation.org, Christian Borntraeger , Viktor Mihajlovski , Vasily Gorbik , Janosch Frank , Claudio Imbrenda , Farhan Ali , Eric Farman List-ID: On Tue, 16 Apr 2019 14:50:14 +0200 (CEST) Sebastian Ott wrote: > On Fri, 12 Apr 2019, Halil Pasic wrote: > > On Fri, 12 Apr 2019 14:12:31 +0200 (CEST) > > Sebastian Ott wrote: > > > On Fri, 12 Apr 2019, Halil Pasic wrote: > > > > On Thu, 11 Apr 2019 20:25:01 +0200 (CEST) > > > > Sebastian Ott wrote: > > > > > I don't think we should use this global DMA pool. I guess it's OK for > > > > > stuff like airq (where we don't have a struct device at hand) but for > > > > > CCW we should use the device we have. Yes, this way we waste some memory > > > > > but all dma memory a device uses should fit in a page - so the wastage > > > > > is not too much. > > > > Regarding the wastage. Let us do the math together in search for an > > upper (wastage) limit. > [...] > > Currently we need at least 224 bytes per device that is ~ 6% > > of a PAGE_SIZE. > > Yes, we basically waste the whole page. I'm ok with that if the benefit is > to play nice with the kernel APIs. > > > > For practical > > > matters: DMA debugging will complain about misuse of a specific device or > > > driver. > > > > > > > Do you mean CONFIG_DMA_API_DEBUG and CONFIG_DMA_API_DEBUG_SG? I've been > > running with those and did not see any complaints. Maybe we should > > clarify this one offline... > > I didn't mean to imply that there are bugs already - just that when used > as intended the DMA_DEBUG_API can complain about stuff like "your device > is gone but you have still DMA memory set up for it" which will not work > if you don't use the correct device... > Right. In fact the 'real' allocations happen using gen_pool, and the pool never shrinks. IMHO as so often in software engineering we have a trade-off here. I'm still not convinced I traded badly here, but I will take the request of yours to tie the dma allocations to a more the device requiring the dma as a maintainers request, and accommodate it in v1. Are you fine with having a similar gen_pool backed with dma_pages on a per struct io_subchannel_private basis? Based on our offline chat I think you are, but but better safe than sorry. Regards, Halil