Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp317731ybn; Tue, 1 Oct 2019 21:42:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwKXq8amB+bUbDewAroU5BYvcijn14zzlwVVa2KXV9vYAC3efddW+WmG/7sx0QkhQb3x2A2 X-Received: by 2002:a17:906:1c5b:: with SMTP id l27mr1388358ejg.27.1569991331664; Tue, 01 Oct 2019 21:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569991331; cv=none; d=google.com; s=arc-20160816; b=AGN5po+vmiF51Rp0fGAFvrxCzmxItbDTTiy8qy7BxEuENG+G/ej5ABWpdNMw3R6DVO hgzWYWT6PQIspesd6fjVdMJjilVeLDBiIpdRliHdXmt24nKzfeHOEckuIds/qprzZGxY CUewKOaPGbSLq3IV6GO2uYz+rq9yqgHcCJwhFf7gXAVLw7u5Eu/Y+FWQMPMlrCU9ednA 0wd/p3QVuKpZ4P5KrkKu7kNTaDmXa+GC8ZariuFXpQxTptr3eroDPNOrqTX0mnKOVPbt alF5MA23g8TJG7AI+O+LW28t626HCcqobNA5shiASwycvxvtp/l3iQfDJkLKFJsrJGA6 ZO4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=JRJlSTe3enCBLAxogNySsJ9S73/uDChBELwRwUUTh7g=; b=mG1Rs/mu+hQw3yicFzDdbuo9vdRnDDdrgbpJ0WVkFFdIiCvnoEJ+xIPYGPujYs636L T+TeipxMzfdpBB7JJDG6ImdsnnsBGGIitrq3dlUsxNvy+dIS5Y/YZ1m3NCHTRaTMxMxE ClVtM7KkVJ1giquX2HpJtTt+zSZui7OeDOiHTuKZlkS3k3/oqFVZdmr+j9yLImOxgo1R Dfk4SyYZS3QxxnVPWK+4HZaFV2ce/EUE4cbkX4SdfTGwfPCizRYDKhWhJd/naT799HXQ srl6EPkZ1l38ZmgMeOgXb8bXyg15XxU3GKKLDrVK950NWoYvEDxbznjhPUdAdVpc4eeY CSjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iCza1vos; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22si9816231eja.178.2019.10.01.21.41.46; Tue, 01 Oct 2019 21:42:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iCza1vos; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727408AbfJAUvD (ORCPT + 99 others); Tue, 1 Oct 2019 16:51:03 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42113 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726097AbfJAUvC (ORCPT ); Tue, 1 Oct 2019 16:51:02 -0400 Received: by mail-wr1-f65.google.com with SMTP id n14so17095597wrw.9 for ; Tue, 01 Oct 2019 13:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JRJlSTe3enCBLAxogNySsJ9S73/uDChBELwRwUUTh7g=; b=iCza1vos46GxgzD39SFzwhy6cJ8W/5jzGl1xR5WccqvYz/DGYXMwcUUnjp+GqS+hfO qbOW/2DkVIQc/VFZsyZ3VwoEIMLApe67hXyTfOfZOQJDOG/PKPlAeJ/MAAfBZj8cJ/2t KBQICOrReINcXTyUV03nMA1WCgHSX3jyz6ulvGo/XF9PLKHVj7KeLuVUKgznL9qrnDAA u4Na5JSkQQa1p8JvA5nRG6Egf+k+iYsMDl4ky5ZnBcvrxv8M1VV2nFYD33MZsPVm1/Uv 1BySCXIX9wPohS/0j9xV4aOeWklskzDRAuP1h5uXc4VsHrOR3i1T9HL6BuzNRZzt0Uhj t+DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JRJlSTe3enCBLAxogNySsJ9S73/uDChBELwRwUUTh7g=; b=ifRgfjoW1WxyD/p4FFXY/A68GTLNLEtve/Ks5ChZ5HjPahFoVX7MD75Tx6kfQrdv4D 5Oz7Yor15xNe0Xd8vFbCwrGWuDFGVZF9ekuty9VrnWBe57FfF/K0PPtVowdRRa+sxUwy Ir1jAipkmkGwHEGFXczuhU6wtI3WzLHGlMKOOt6BPAdN4ohuTg9b+3Uut4GZdNa8VnWi yT0ZWfWmCp/TleE4Hyyu9+Rsd9cz79l5naNB2KIUcLkl7wGMLp+mp75oYy6vWeKPbojP KD61Amr61JMIdN0LasEE16mroTWf3znY0V5LHVOtkiWXJ5RHML6mxpWjgDVw62wFEjZr UY8w== X-Gm-Message-State: APjAAAUJWPrJD3jGhDOzg5UIC+7RXcur8pxY3MRfyXOMepHfhRMDvqIl YdxJ5B2186wLjiPiTzEgJ4hr/hzm0aDOjcXuvvrTQA== X-Received: by 2002:adf:f7c3:: with SMTP id a3mr20881280wrq.141.1569963060455; Tue, 01 Oct 2019 13:51:00 -0700 (PDT) MIME-Version: 1.0 References: <20190906184712.91980-1-john.stultz@linaro.org> <20190930074335.6636-1-hdanton@sina.com> In-Reply-To: <20190930074335.6636-1-hdanton@sina.com> From: John Stultz Date: Tue, 1 Oct 2019 13:50:45 -0700 Message-ID: Subject: Re: [RESEND][PATCH v8 3/5] dma-buf: heaps: Add system heap to dmabuf heaps To: Hillf Danton Cc: lkml , Laura Abbott , Benjamin Gaignard , Sumit Semwal , Liam Mark , Pratik Patel , Brian Starkey , Vincent Donnefort , Sudipto Paul , "Andrew F . Davis" , Christoph Hellwig , Chenbo Feng , Alistair Strachan , Hridya Valsaraju , dri-devel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 30, 2019 at 12:43 AM Hillf Danton wrote: > > > On Fri, 6 Sep 2019 18:47:09 +0000 John Stultz wrote: > > > > +static int system_heap_allocate(struct dma_heap *heap, > > + unsigned long len, > > + unsigned long fd_flags, > > + unsigned long heap_flags) > > +{ > > + struct heap_helper_buffer *helper_buffer; > > + struct dma_buf *dmabuf; > > + int ret = -ENOMEM; > > + pgoff_t pg; > > + > > + helper_buffer = kzalloc(sizeof(*helper_buffer), GFP_KERNEL); > > + if (!helper_buffer) > > + return -ENOMEM; > > + > > + init_heap_helper_buffer(helper_buffer, system_heap_free); > > + helper_buffer->flags = heap_flags; > > + helper_buffer->heap = heap; > > + helper_buffer->size = len; > > + > A couple of lines looks needed to handle len if it is not > PAGE_SIZE aligned. Hey! Thanks so much for the review! dma_heap_buffer_alloc() sets "len = PAGE_ALIGN(len);" before calling into the heap allocation hook. So hopefully this isn't a concern, or am I missing something? thanks -john