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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 A9CA5C433ED for ; Wed, 28 Apr 2021 09:50:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 64FCF61001 for ; Wed, 28 Apr 2021 09:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238233AbhD1JvV (ORCPT ); Wed, 28 Apr 2021 05:51:21 -0400 Received: from foss.arm.com ([217.140.110.172]:38358 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbhD1JvU (ORCPT ); Wed, 28 Apr 2021 05:51:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EC27EED1; Wed, 28 Apr 2021 02:50:35 -0700 (PDT) Received: from [192.168.1.179] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 47C643F70D; Wed, 28 Apr 2021 02:50:29 -0700 (PDT) Subject: Re: [PATCH v5 05/16] swiotlb: Add restricted DMA pool initialization To: Claire Chang Cc: Joerg Roedel , Will Deacon , Frank Rowand , Konrad Rzeszutek Wilk , boris.ostrovsky@oracle.com, jgross@suse.com, Christoph Hellwig , Marek Szyprowski , benh@kernel.crashing.org, paulus@samba.org, "list@263.net:IOMMU DRIVERS" , sstabellini@kernel.org, Robin Murphy , grant.likely@arm.com, xypron.glpk@gmx.de, Thierry Reding , mingo@kernel.org, bauerman@linux.ibm.com, peterz@infradead.org, Greg KH , Saravana Kannan , "Rafael J . Wysocki" , heikki.krogerus@linux.intel.com, Andy Shevchenko , Randy Dunlap , Dan Williams , Bartosz Golaszewski , linux-devicetree , lkml , linuxppc-dev@lists.ozlabs.org, xen-devel@lists.xenproject.org, Nicolas Boichat , Jim Quinlan , Tomasz Figa , bskeggs@redhat.com, Bjorn Helgaas , chris@chris-wilson.co.uk, Daniel Vetter , airlied@linux.ie, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com, Jianxiong Gao , joonas.lahtinen@linux.intel.com, linux-pci@vger.kernel.org, maarten.lankhorst@linux.intel.com, matthew.auld@intel.com, nouveau@lists.freedesktop.org, rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com References: <20210422081508.3942748-1-tientzu@chromium.org> <20210422081508.3942748-6-tientzu@chromium.org> From: Steven Price Message-ID: <64137d13-cfa2-5f72-94c1-19b367489c78@arm.com> Date: Wed, 28 Apr 2021 10:50:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 26/04/2021 17:37, Claire Chang wrote: > On Fri, Apr 23, 2021 at 7:34 PM Steven Price wrote: [...] >> >> But even then if it's not and we have the situation where debugfs==NULL >> then the debugfs_create_dir() here will cause a subsequent attempt in >> swiotlb_create_debugfs() to fail (directory already exists) leading to >> mem->debugfs being assigned an error value. I suspect the creation of >> the debugfs directory needs to be separated from io_tlb_default_mem >> being set. > > debugfs creation should move into the if (!mem) {...} above to avoid > duplication. > I think having a separated struct dentry pointer for the default > debugfs should be enough? > > if (!debugfs) > debugfs = debugfs_create_dir("swiotlb", NULL); > swiotlb_create_debugfs(mem, rmem->name, debugfs); Yes that looks like a good solution to me. Although I'd name the variable something a bit more descriptive than just "debugfs" e.g. "debugfs_dir" or "debugfs_root". Thanks, Steve