Received: by 10.192.165.156 with SMTP id m28csp879986imm; Tue, 17 Apr 2018 23:17:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/BSsHP+my1b00OqNU89+F/EV7HopVnFrYR11XK0tBF+q04AYcJMwOWBbTgodSJT8RvQOIy X-Received: by 10.99.124.81 with SMTP id l17mr717044pgn.5.1524032272014; Tue, 17 Apr 2018 23:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524032271; cv=none; d=google.com; s=arc-20160816; b=jDtLJUrBv7smqILVb8VbJtTW8CU/+WLwZ18q3cGI32Rtg+wTWG6StB+xiybTaUV9do mQuycqgq7lN2ieyF2Aqbx26h9E/2MzJEOWUGBY4dtSo3yuG8V1C5uH+i4PFn+iMktMTG N0h5MlgQ710Xpns8FSO4kYwi3OeCd+H5bkgzdfSWb9Y3hyZMGDxbN1IftewGXcU3Z7FO gn3ClnFdYlfaky5RqFzYt9ZSU3uUoAmBgxu5w8E1lXj19ZQd5oXlRwlg/Fe1Q+2bQD19 8MnyOHYiWLCFKfwW/ZVF8/7g1y66KocazfNzhtO4FBzBEmAwx2xbDD8As/uJtWIILulT qPeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=V+f9Vd2oeoq8VwbKJKEi0HYvfC6eFmSQYaHzjlLbcKI=; b=YD/sFghJS7kieZAyqpNiVrdRYPAk10hbuodDjqHDYl8lFtTSyZFjPTTO+cpgm35zEF aogqsTwm8D6xF58PJNPEXqOBnvb8nrc0QriV1PHnx6FNffl8PVIeR31UdQrUjT6d1cus NAEZ102mzQaRPP2EfTniySibbS/EU6hVHdnNBPw9pqiO7sN7FFd2F3XqojjCw/dU6EP3 lMooR8LdkX8f9HCUKvzZRPUyFcY/WQHu501GXKE4OC8ZnQFRWudC6j0BzkjVio4IAYgZ aezHJAcrLeZIimHjT6j42h/TsYsKNV8gM4ee6CUiyL+P3swlID5WZXCqC4HN1JfR4Fd0 tJpA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si710902pli.324.2018.04.17.23.17.25; Tue, 17 Apr 2018 23:17:51 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752085AbeDRGPf convert rfc822-to-8bit (ORCPT + 99 others); Wed, 18 Apr 2018 02:15:35 -0400 Received: from mx01.hxt-semitech.com.96.203.223.in-addr.arpa ([223.203.96.7]:36408 "EHLO barracuda.hxt-semitech.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1750861AbeDRGPe (ORCPT ); Wed, 18 Apr 2018 02:15:34 -0400 X-ASG-Debug-ID: 1524031124-093b7e10b3b7e50001-xx1T2L Received: from HXTBJIDCEMVIW02.hxtcorp.net (localhost [10.128.0.15]) by barracuda.hxt-semitech.com with ESMTP id VYXOmbRAmL9jbNIO (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 18 Apr 2018 13:58:44 +0800 (CST) X-Barracuda-Envelope-From: shunyong.yang@hxt-semitech.com Received: from HXTBJIDCEMVIW01.hxtcorp.net (10.128.0.14) by HXTBJIDCEMVIW02.hxtcorp.net (10.128.0.15) with Microsoft SMTP Server (TLS) id 15.0.847.32; Wed, 18 Apr 2018 13:58:48 +0800 Received: from HXTBJIDCEMVIW01.hxtcorp.net ([fe80::f451:a443:c0b5:87d1]) by HXTBJIDCEMVIW01.hxtcorp.net ([fe80::f451:a443:c0b5:87d1%12]) with mapi id 15.00.0847.030; Wed, 18 Apr 2018 13:58:49 +0800 From: "Yang, Shunyong" To: "sohil.mehta@intel.com" , "gary.hook@amd.com" , "iommu@lists.linux-foundation.org" , "ghook@amd.com" CC: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 2/2] iommu/amd: Add basic debugfs infrastructure for AMD IOMMU Thread-Topic: [PATCH v3 2/2] iommu/amd: Add basic debugfs infrastructure for AMD IOMMU X-ASG-Orig-Subj: Re: [PATCH v3 2/2] iommu/amd: Add basic debugfs infrastructure for AMD IOMMU Thread-Index: AQHT1tpRJAZW59A4ZEqPfHlYD/OogA== Date: Wed, 18 Apr 2018 05:58:48 +0000 Message-ID: <1524031122.4031.5.camel@hxt-semitech.com> References: <152302042701.47565.17954813724758433858.stgit@sosxen2.amd.com> <152302067362.47565.628887796165116844.stgit@sosxen2.amd.com> <1523664612.2747.13.camel@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.64.6.80] Content-Type: text/plain; charset="iso-8859-15" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Barracuda-Connect: localhost[10.128.0.15] X-Barracuda-Start-Time: 1524031124 X-Barracuda-Encrypted: ECDHE-RSA-AES256-SHA X-Barracuda-URL: https://192.168.50.101:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at hxt-semitech.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.5132 1.0000 0.7500 X-Barracuda-Spam-Score: 0.75 X-Barracuda-Spam-Status: No, SCORE=0.75 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.50009 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Gary and Sohil, On Tue, 2018-04-17 at 13:38 -0400, Hook, Gary wrote: > On 4/13/2018 8:08 PM, Mehta, Sohil wrote: > > > > On Fri, 2018-04-06 at 08:17 -0500, Gary R Hook wrote: > > > > > > ?? > > > + > > > +void amd_iommu_debugfs_setup(struct amd_iommu *iommu) > > > +{ > > > + char name[MAX_NAME_LEN + 1]; > > > + struct dentry *d_top; > > > + > > > + if (!debugfs_initialized()) > > Probably not needed. > Right. When will this check is needed? IMO, this function is to check debugfs ready status before we want to use debugfs. I just want to understand when we should use debugfs_initialized(); Thanks. Shunyong. > > > > > > > > > > > + return; > > > + > > > + mutex_lock(&amd_iommu_debugfs_lock); > > > + if (!amd_iommu_debugfs) { > > > + d_top = iommu_debugfs_setup(); > > > + if (d_top) > > > + amd_iommu_debugfs = > > > debugfs_create_dir("amd", d_top); > > > + } > > > + mutex_unlock(&amd_iommu_debugfs_lock); > > > > You can do the above only once if you iterate over the IOMMUs here > > ??instead of doing it in?amd_iommu_init. > I'm not sure it matters, given the finite number of IOMMUs in a > system,? > and the fact that this work is done exactly once. However, removal of > a? > lock is fine thing, so I'll move this around. > > > > > > > > > > > + if (amd_iommu_debugfs) { > > > + snprintf(name, MAX_NAME_LEN, "iommu%02d", iommu- > > > > > > > > index); > > > + iommu->debugfs = debugfs_create_dir(name, > > > + ????amd_iommu_de > > > bugf > > > s); > > > + if (!iommu->debugfs) { > > > + debugfs_remove_recursive(amd_iommu_debug > > > fs); > > > + amd_iommu_debugfs = NULL; > > > + } > > > + } > > > +} > > -Sohil > > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu