From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E2A1C433E0 for ; Tue, 19 Jan 2021 18:32:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EF2322D2A for ; Tue, 19 Jan 2021 18:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbhASScE (ORCPT ); Tue, 19 Jan 2021 13:32:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727078AbhASSaW (ORCPT ); Tue, 19 Jan 2021 13:30:22 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7FD5C061573 for ; Tue, 19 Jan 2021 10:29:41 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id f17so23016139ljg.12 for ; Tue, 19 Jan 2021 10:29:41 -0800 (PST) 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=JWWYuzWaghP5Q544uqJbXr3wVFNCkeCk1gyHHkDdQ/A=; b=xnRYIRj8nrXC1Xt9zSBJsXJhgrBfjtCh3CpB6YoNFq2VStdTH5p5X55ThbO9d1T1QX W4s3X+eaII0u/7aakfdFOHqfMiUcebQtCqGbU6qrTrTIw/bmaobbAmF5g8xQdlH+JcMm MwOW3qhK6j4IEuDDA9aUNzDZHWOBV902OvyIedTiWvaRgws3zCpOuRkUoF7aUpFxFq3D 40LMffLZW2m8ILnF63bEftJER/hfJVcH/wFwzdFaBuEzghmJBC93E7qNrD9P7KluZaeX XSeU0f3WfA72mJTI8MrG5TUXjTsupJjNWOUFcePRC+6ucYsae6rZqQivHGipbnhG0lhg MmZA== 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=JWWYuzWaghP5Q544uqJbXr3wVFNCkeCk1gyHHkDdQ/A=; b=SnB7oMP+IvYkuhxUlGH4daGMQZfPMz5v7sBHx+Y9eLYjpVhthSy9E9SHucbJi6deP2 GlXsZR0Za6Gfx5b3aEmWm8DSlG7qqsnj9z2X81PRXSI7baLpcVsKxtoZrkskMlhIltPk DktYiVoizdQS3KP378x8+U8SYX9slEyKGr3rPxRpEz05FNUtZIIWwpmvnC6+pGjqcP0t ydXEFYEJ3QI+aWYBThjqIglwzsTZmHjfFJ/WDZs8KqRq9uUYI191mIb/j76bhEBpsBO9 4spM8GQnf2fldx5iHaYCE1yD9SNsLJuxsLT6KEGOSEkYjH1NPLGx2T6gO+sRp701hQNS oT/A== X-Gm-Message-State: AOAM5326QWFzrRcqiGBxFMaNG8fNmQcTHsrw0c8SA14LumSBLL0+nEXA U8Sy2/m7H2gkybihMFPhtpTNG5m1uiw5sgLgoWvjqA== X-Google-Smtp-Source: ABdhPJyoOd3Tzkorx9mIjYO8VVetUnWwDqJgYwdoxP5M9bwFey7dBLq3et+JsaDPEcCzrb4F1+lPqF4gjUDlxQ1XCog= X-Received: by 2002:a05:651c:10e:: with SMTP id a14mr2543204ljb.128.1611080980220; Tue, 19 Jan 2021 10:29:40 -0800 (PST) MIME-Version: 1.0 References: <20210113012143.1201105-1-minchan@kernel.org> <20210113012143.1201105-5-minchan@kernel.org> In-Reply-To: <20210113012143.1201105-5-minchan@kernel.org> From: John Stultz Date: Tue, 19 Jan 2021 10:29:29 -0800 Message-ID: Subject: Re: [PATCH v3 4/4] dma-buf: heaps: add chunk heap to dmabuf heaps To: Minchan Kim Cc: Andrew Morton , linux-mm , LKML , Hyesoo Yu , david@redhat.com, Michal Hocko , Suren Baghdasaryan , KyongHo Cho , John Dias , Hridya Valsaraju , Sumit Semwal , linux-media , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Christoph Hellwig , Rob Herring , "moderated list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 12, 2021 at 5:22 PM Minchan Kim wrote: > > From: Hyesoo Yu > > This patch supports chunk heap that allocates the buffers that > arranged into a list a fixed size chunks taken from CMA. > > The chunk heap driver is bound directly to a reserved_memory > node by following Rob Herring's suggestion in [1]. > > [1] https://lore.kernel.org/lkml/20191025225009.50305-2-john.stultz@linaro.org/T/#m3dc63acd33fea269a584f43bb799a876f0b2b45d > > Signed-off-by: Hyesoo Yu > Signed-off-by: Hridya Valsaraju > Signed-off-by: Minchan Kim > --- ... > +static int register_chunk_heap(struct chunk_heap *chunk_heap_info) > +{ > + struct dma_heap_export_info exp_info; > + > + exp_info.name = cma_get_name(chunk_heap_info->cma); One potential issue here, you're setting the name to the same as the CMA name. Since the CMA heap uses the CMA name, if one chunk was registered as a chunk heap but also was the default CMA area, it might be registered twice. But since both would have the same name it would be an initialization race as to which one "wins". So maybe could you postfix the CMA name with "-chunk" or something? thanks -john From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E00DAC4332B for ; Tue, 19 Jan 2021 18:29:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 60B4E216FD for ; Tue, 19 Jan 2021 18:29:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 60B4E216FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F1C7E6B0036; Tue, 19 Jan 2021 13:29:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EF21F6B005D; Tue, 19 Jan 2021 13:29:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE28B6B006C; Tue, 19 Jan 2021 13:29:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id C27F46B0036 for ; Tue, 19 Jan 2021 13:29:47 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 7D6571EE6 for ; Tue, 19 Jan 2021 18:29:47 +0000 (UTC) X-FDA: 77723363214.22.nest78_4906b9327554 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 480A918038E67 for ; Tue, 19 Jan 2021 18:29:43 +0000 (UTC) X-HE-Tag: nest78_4906b9327554 X-Filterd-Recvd-Size: 4534 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Jan 2021 18:29:42 +0000 (UTC) Received: by mail-lj1-f177.google.com with SMTP id n11so23071186lji.5 for ; Tue, 19 Jan 2021 10:29:41 -0800 (PST) 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=JWWYuzWaghP5Q544uqJbXr3wVFNCkeCk1gyHHkDdQ/A=; b=xnRYIRj8nrXC1Xt9zSBJsXJhgrBfjtCh3CpB6YoNFq2VStdTH5p5X55ThbO9d1T1QX W4s3X+eaII0u/7aakfdFOHqfMiUcebQtCqGbU6qrTrTIw/bmaobbAmF5g8xQdlH+JcMm MwOW3qhK6j4IEuDDA9aUNzDZHWOBV902OvyIedTiWvaRgws3zCpOuRkUoF7aUpFxFq3D 40LMffLZW2m8ILnF63bEftJER/hfJVcH/wFwzdFaBuEzghmJBC93E7qNrD9P7KluZaeX XSeU0f3WfA72mJTI8MrG5TUXjTsupJjNWOUFcePRC+6ucYsae6rZqQivHGipbnhG0lhg MmZA== 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=JWWYuzWaghP5Q544uqJbXr3wVFNCkeCk1gyHHkDdQ/A=; b=aKdcKU/YlRSBXhMRrb1JTZcqneVEXRj4aalWdAB5ZmjKLSQILJ2nnUK68yh4FwO7Wt kvGvONUFypQCuXYEPf+bzlzRJKL1BQQi0BefXa5+vYSY12gCmi2iW/jVV9jPo52dbv2S n0amwch+ZWzDuOqYWRQjpGbNKIqVkfUvwZYWNx6arbsIfccVfnsFM9u1Li/5zbLewJs9 i0Qby7evIV6bhV+3q+MLMYAEaPFSBE6/BGFurDJrglDp1zAFjpm1qQ122uhNIY2hUZWU 5Vhh5vX+Fzpn4J4spiGrCJQzH/sy69dxYB9EkeKztq+6JvdKfy9F9ZxigT0gyZ5Ezc54 2x/g== X-Gm-Message-State: AOAM531dTnQiSL18dnOq/oeqpIHotFBqWI1o3krTp7rE4eP5mo/YYVSI vEgef0WVizOPn354eU32mguMW+W3/88nj8B24ddySQ== X-Google-Smtp-Source: ABdhPJyoOd3Tzkorx9mIjYO8VVetUnWwDqJgYwdoxP5M9bwFey7dBLq3et+JsaDPEcCzrb4F1+lPqF4gjUDlxQ1XCog= X-Received: by 2002:a05:651c:10e:: with SMTP id a14mr2543204ljb.128.1611080980220; Tue, 19 Jan 2021 10:29:40 -0800 (PST) MIME-Version: 1.0 References: <20210113012143.1201105-1-minchan@kernel.org> <20210113012143.1201105-5-minchan@kernel.org> In-Reply-To: <20210113012143.1201105-5-minchan@kernel.org> From: John Stultz Date: Tue, 19 Jan 2021 10:29:29 -0800 Message-ID: Subject: Re: [PATCH v3 4/4] dma-buf: heaps: add chunk heap to dmabuf heaps To: Minchan Kim Cc: Andrew Morton , linux-mm , LKML , Hyesoo Yu , david@redhat.com, Michal Hocko , Suren Baghdasaryan , KyongHo Cho , John Dias , Hridya Valsaraju , Sumit Semwal , linux-media , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Christoph Hellwig , Rob Herring , "moderated list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jan 12, 2021 at 5:22 PM Minchan Kim wrote: > > From: Hyesoo Yu > > This patch supports chunk heap that allocates the buffers that > arranged into a list a fixed size chunks taken from CMA. > > The chunk heap driver is bound directly to a reserved_memory > node by following Rob Herring's suggestion in [1]. > > [1] https://lore.kernel.org/lkml/20191025225009.50305-2-john.stultz@linaro.org/T/#m3dc63acd33fea269a584f43bb799a876f0b2b45d > > Signed-off-by: Hyesoo Yu > Signed-off-by: Hridya Valsaraju > Signed-off-by: Minchan Kim > --- ... > +static int register_chunk_heap(struct chunk_heap *chunk_heap_info) > +{ > + struct dma_heap_export_info exp_info; > + > + exp_info.name = cma_get_name(chunk_heap_info->cma); One potential issue here, you're setting the name to the same as the CMA name. Since the CMA heap uses the CMA name, if one chunk was registered as a chunk heap but also was the default CMA area, it might be registered twice. But since both would have the same name it would be an initialization race as to which one "wins". So maybe could you postfix the CMA name with "-chunk" or something? thanks -john