Received: by 10.192.165.148 with SMTP id m20csp4162021imm; Mon, 30 Apr 2018 12:58:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpDyLZInh+PpR41dWs1lTqccZaaXMwjzSc+AHVt3trrYHmou/1pBv3pSocmjVeakzcE2Nx2 X-Received: by 2002:a17:902:688c:: with SMTP id i12-v6mr13475601plk.166.1525118316945; Mon, 30 Apr 2018 12:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525118316; cv=none; d=google.com; s=arc-20160816; b=Lx2TwRQEjrd1U7h0LOpa5SBHNY0satlpE9gm5PtHetzymua9VpGMMZwPLSVoGBhLFk 7TJJ0XiVP7G8ATB06LgR9CO8BgXKimDZeLZdJRO/D7FEllZtuP/xq4K0v4pZBs4Q2m+a bvBM/w5gMk7446IE9Oii30a/sfGIRxECAthLwBxETV7+eKsio/IY65lRxibRA5oGoYfA 7fbCaAykGxezAQojI7R7Do9BhnTS8gyaLkKSpPDAvp5sYp6Nf+EBZQ0h3L4y9Ztxt/yU JMecYiapQIqCmd3ZqNAFMRvnr1q4s/+e5VMnDGGZ9AuGqCSiJORGem/6ENdUlez8JtXv s1vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=8xIYzbgMwsZ1EHc+QPqwvyiiFmP3R8pKrHEK2uSvKzA=; b=Qvl6Ca2GX6UenWx6lEW+YbJFVRny/m2blVqQSijbdv0lBgSFq011eu0kr/hvKOQrbP t/Hh7vdck453MJvTV0YmxH5OJxYZvmNteh3MJgktFKcYBmLPoC/zrpN1N9ssrr6wWgpD egLhsJsQ5QR72BRcTUSpnLZ1J5AdhSsSNRQUBjXeiyfuBvXNXkGiWJmjHFWDIwpK0BU0 TNvoYXNO+5leKjC826e0pcCCNKeMPbofWhYtMMmuYgaVPCGtfgj7RYgpzxGNpKbQPUT/ 2SwciMUiUE03n1DPKfvfh7B9fYxjPNRLGvR6CCikHGVwp4quNlMqG6usH9qTxg0GleX4 yeig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=TvitIToE; 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 d9-v6si6686779pga.192.2018.04.30.12.58.20; Mon, 30 Apr 2018 12:58:36 -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=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=TvitIToE; 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 S1756124AbeD3T6N (ORCPT + 99 others); Mon, 30 Apr 2018 15:58:13 -0400 Received: from mail-sn1nam01on0042.outbound.protection.outlook.com ([104.47.32.42]:65344 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756082AbeD3T6J (ORCPT ); Mon, 30 Apr 2018 15:58:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=8xIYzbgMwsZ1EHc+QPqwvyiiFmP3R8pKrHEK2uSvKzA=; b=TvitIToEcbvHi2apv2FrxDgLcYOzGXtRt3YdfejeTXOuTTi8r00hqgjNAD8bRTcxNSF1nImpp2SL7uAmdp+QiEWY4WkAV6TEtmx/eyPgFh4Vvi/+Vlri1iDZ/ZPgtXxaibsFgtdBOjtAm5yvzKSYFbJ2tJ/8vu9QgFr1R9oqS24= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.109.62] (165.204.78.1) by BLUPR12MB0689.namprd12.prod.outlook.com (2a01:111:e400:5950::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.715.18; Mon, 30 Apr 2018 19:58:07 +0000 Subject: Re: [PATCH v3 2/2] iommu/amd: Add basic debugfs infrastructure for AMD IOMMU To: "Hook, Gary" , "Mehta, Sohil" , "iommu@lists.linux-foundation.org" Cc: "linux-kernel@vger.kernel.org" References: <152302042701.47565.17954813724758433858.stgit@sosxen2.amd.com> <152302067362.47565.628887796165116844.stgit@sosxen2.amd.com> <1523664612.2747.13.camel@intel.com> From: Gary R Hook Message-ID: Date: Mon, 30 Apr 2018 14:57:58 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN2PR01CA0037.prod.exchangelabs.com (2603:10b6:804:2::47) To BLUPR12MB0689.namprd12.prod.outlook.com (2a01:111:e400:5950::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BLUPR12MB0689; X-Microsoft-Exchange-Diagnostics: 1;BLUPR12MB0689;3:M3OFSMLgd5kUIFZiMbTQVHT2Q9vj7xbwu/qagTKe13kvX3ZSUlJ735slvg8CNt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ER1CZldrcRPXc27Bm/W0SGgQzSjf+iZ9rjJIVcNUBst+jDuEuYda8vMx3nSQWOW6y8/jx7b4828ykQnz/5P+rVroa2GHO2fup2jKoPaoQcnOZ3YMEzs4np+83iuqwXm5m3jBzAHANTbN7fOGCF43+eunt5WvnTebOMSj9pOksJs9FjCykZe4zHTpT5mCuy3gT7Jjg0JbThSPEo7CuJKEVjsKNIbgoeucVGo0YVrTDvNPOKAVxSG3MRM/ngw8OtL8Z+uSXL8qv5KB0afeexolYE/;4:qGINyahNpNqs8J0JOhO01OAsfFJS4rNYYCnBH3wQ0HcX4uM6Q4aL6HPC5qD4i85bo9nmQY6EB3ZUTLSVur9BjRgBHAU7Fb5qeA0ZwekR8L+8dTDmo2hectSAe6775ccUFuOV2qYP3GbIPanv1xmUOKIrfS0XRJ8hoN7hiCPVVpLve78rL6la5AnqUGa58PansxFGSjhpklw4AEepUb2ptXTZ0lSRVDrdP8oAbQD/h6QZXIJ6MjLYDmT+zUWKXz7YnaL/0j7BGaIG0TGPchrfBA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231254)(944501410)(52105095)(10201501046)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011);SRVR:BLUPR12MB0689;BCL:0;PCL:0;RULEID:;SRVR:BLUPR12MB0689; X-Forefront-PRVS: 0658BAF71F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(376002)(346002)(366004)(39860400002)(39380400002)(396003)(377424004)(199004)(189003)(36756003)(67846002)(76176011)(2616005)(53546011)(59450400001)(110136005)(72206003)(65826007)(956004)(23676004)(52116002)(2501003)(2486003)(52146003)(16526019)(26005)(86362001)(186003)(446003)(58126008)(476003)(11346002)(5660300001)(478600001)(16576012)(6246003)(31696002)(486006)(386003)(53936002)(77096007)(4326008)(316002)(25786009)(2870700001)(305945005)(2906002)(64126003)(50466002)(31686004)(6116002)(105586002)(106356001)(3846002)(6666003)(229853002)(65956001)(6486002)(68736007)(8676002)(8936002)(97736004)(93886005)(65806001)(81156014)(66066001)(7736002)(81166006)(47776003);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR12MB0689;H:[10.236.109.62];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTFVQUjEyTUIwNjg5OzIzOlhxUTRmWkFRbnVwSjIycENkbXptUWF6MFN3?= =?utf-8?B?RnZmUlRqYkczdXkxa2daS2k3NjdIdFovZXRKSUhyM3psNWtGRVZ0eDI5Q3Bo?= =?utf-8?B?TkhtbkRtUVV3QUVESjdoZ1VBaGY3UmovMU4xbWhCSU5CNUhaOGdKdWlPZDFh?= =?utf-8?B?SFRzOU1LYmY1VkdOZ1BaMXQzY25xdHpOTndkdTNJWTR5cGxRR0VXNFdWRFg1?= =?utf-8?B?WS9QbWNJNC9acjl4bTBESnVlMHZFcjhJcGk4S3UxN0xUSmh6WWZjSkQ0NXhN?= =?utf-8?B?Um1tbTJjemtnYS9yODhVSnZrWGtnZm5nYk9UWmNqYUo3Y3pCQS80M21KWnhO?= =?utf-8?B?cGhkaE03MWdMMkFZQ1d5OWZ1QnZsVFBQbnFVWlo4RHVhdmFrK0tMNnRmRFQy?= =?utf-8?B?SWFkalBWSUVSazh4dXZiUUQwQjlhODI0N0pRSTRLajhMeTFLZ0kyZkdXb0o1?= =?utf-8?B?RFhHejY5eDVjRXU1SHNUMy9xTzhobGd0ME1YS2o1bmtvSGxBZzJORklNWTRa?= =?utf-8?B?TDlRQ3c2aENRazdBaWdaQWhJZFhRVHBiQ24rL3dtY0ppTC9NdlYxaVZ5U0hD?= =?utf-8?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axwIbdniz+gKAoVVNiKyzZjobEcekXj+d6De3Jw9FoKUSYdQVPShUNFSh6cL/JaW2+U5kMVOW8nlKaRxgFpRq0kEhpCw/aZjzgmckz5/3qIzh0mjHQvTYMSt/50qr4yDEw/T6iEQlq51aQ3DetVPPhn1daaz1aYSvbcf4B2NO/+o1uja+DX4rnY3du94tYBmROiyBjP+E8qpO1IJovcHCZSAajshGGnh X-MS-Office365-Filtering-Correlation-Id: 8d6c1d0b-5fa5-49ae-1eda-08d5aed4b195 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2018 19:58:07.5230 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d6c1d0b-5fa5-49ae-1eda-08d5aed4b195 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0689 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/17/2018 12:38 PM, 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: >>> + >>> + >>> +    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. After thinking about this, and looking at the code, I've decided to leave this alone. v4 is on its way.