Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1150515imm; Tue, 5 Jun 2018 09:49:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLcrINbWJhS7nHJilm1LJ6LcLIUrMfDqm/pf/I62VvZ+OwSSJAQM7oDCgNYgZeIgj3UsI13 X-Received: by 2002:a65:5bce:: with SMTP id o14-v6mr21515563pgr.449.1528217377963; Tue, 05 Jun 2018 09:49:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528217377; cv=none; d=google.com; s=arc-20160816; b=EdO3VV8Z2SCQK0SX1LwpiWE+6ye8GwkzqiYtbizVc0nbNMXxGlXeK44K0trCt5P+jJ osi5bNwdKvViYiIwViNZMIWqj/IM8ODgfcxRjDWHqqG5SslcDt8tc3HZEO59YCpgI9mY uooLCBvbMsCmuFJYH/ybnIjGRFMD5/YEQEAJ3T8PRnCKiLN++/r5B3okyNnmFJwAguvj vh3Q3noE3w2gU1vldJUovUg4rwWgdl2QyfXciUMLr6xJdGmng72sCgDJxbf4AWoNX3Jt enzJdv4dzhsSwhGw1T9/IgZqm/+s2kVFit7EB3f7DlvLexDoXjlpOK1ox6zHaV0MJR3o m2BA== 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=VRm941saSNYIOOFAuOafmC+H2c45VrEbB9BSaG1LvX8=; b=jp0CXwxoBt0hj3jokAQ+C8CM74Iaw8GoqCkOB0VfYcpJZgNgSjqQCxgb+T16dAeE3q WBXFBZ3l3no1P3WwL8Aogdt040JYAx/VLPmJe5qMWzd29+Vop+8SwiyJ3lqUaxgWgFab XSLrFCWCBZMcCTrdggBCE4BKEho3IVY5TaAPbLaRWWzxba+xMPGNZkNd+ET7O0hTqvhP E1pB9btvJYYeYHKQUW25527KZUvJ8CoMJnReZQDTS+7TZGOEW6J0qhQkFf4QHE+UXcW9 iJU19/I00g0YerOwN5XtShJGOke557VWN6b+Sn5n4dtPp/KvD5d2yXyGuIe7QfN8bBuq 1c0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=scbM5Mlz; 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 c14-v6si22902113pgw.478.2018.06.05.09.49.23; Tue, 05 Jun 2018 09:49:37 -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=scbM5Mlz; 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 S1751946AbeFEQsu (ORCPT + 99 others); Tue, 5 Jun 2018 12:48:50 -0400 Received: from mail-sn1nam01on0086.outbound.protection.outlook.com ([104.47.32.86]:33920 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751744AbeFEQss (ORCPT ); Tue, 5 Jun 2018 12:48:48 -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:X-MS-Exchange-SenderADCheck; bh=VRm941saSNYIOOFAuOafmC+H2c45VrEbB9BSaG1LvX8=; b=scbM5MlzPreIGfpoOU6i0KvvqGdIpCNgVxUvd9fqHD4YsCUObuUprkSYQAO6VRQ5VZItAq5gZA4l8v8uG+/e6SM+bysqNBvmxN0EVIHqsr5Wc9hRtm9kezZymK45ZNFufc/8XNq/VEe/Gatd4oQgqqY7T7QmUvyUgkCpKRu4l5k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.109.62] (165.204.78.1) by BN6PR12MB1442.namprd12.prod.outlook.com (2603:10b6:405:10::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.841.13; Tue, 5 Jun 2018 16:48:47 +0000 Subject: Re: [PATCH v7 1/2] iommu - Enable debugfs exposure of IOMMU driver internals To: Greg KH Cc: iommu@lists.linux-foundation.org, joro@8bytes.org, linux-kernel@vger.kernel.org References: <152631818082.18929.13970142119193316487.stgit@sosxen2.amd.com> <152631842046.18929.1205439632866632871.stgit@sosxen2.amd.com> <20180524091807.GA18148@kroah.com> From: Gary R Hook Message-ID: <68d7f040-fc7a-5eb3-342f-687fc6e591f2@amd.com> Date: Tue, 5 Jun 2018 11:48:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180524091807.GA18148@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN1PR12CA0087.namprd12.prod.outlook.com (2603:10b6:802:21::22) To BN6PR12MB1442.namprd12.prod.outlook.com (2603:10b6:405:10::19) 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:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1;BN6PR12MB1442;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hn0vaWVLqs7UZPntzHRfdl7JgSrIaLDEVbAm+8uNd4kRx1jNBoE5JsqMyLz3cqMaMy/ZwJhbWGnHGwY3vdLOZnsLsm9Ma6RLHsm5+AfIqwAdpNnv9/SgvPMfL2qiWdQTiVk7FqX4byYi1SEZEHU32Tzl2v8RNmwCQdUWZphUhhaJBVDVZZj7lPD9Rnm/LWb4it8XGrnZTVJP6SjUtu79AIPUybBitXA6M5KIjAWtivcjzb6Jf8Flbn0CgQcRaJJUz2lrOyMC0u9M+UAuLGqD84wd+GxSoK3ioEc4Gg9lsDx3zGRq+BB1BdHV3UoSq6EEBDX+b9w5EJTFmqhMeHSb8CPW5qF;4:hhxnhmFCtSDi0y6ObhqAbV/xgMrPZnUpI8mb+OgBiNkwiZFIhUQMDzMM4QPFjzuT37bCAcuUlqlLWnYhUKCj0XAErPnAXIeouDC7W1V+IVOt6qiwEkF2mZS+/l+dC80LC/IOdKBhwdEztHWgmDFAlxQKC/gmsBVcHRM1vMQARRfsf8r6Ia9AGkkSkK0pzj0aBruJAtR/sbrH/0j1PC9bmNf+6v79l768dvcHOVTIzIyGxiZXgRuLICTjX+wsqwni0r5E4lLwvScdC0256n5h5FXQZEHlCzCJr6ebJvPkV9lcUUAJDYPY7BXIf3VVZcUE4y6b69rwQ7RxbWTxLVOgyXZhfB1ibIVk/8Rfjxkl5L0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705)(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:BN6PR12MB1442;BCL:0;PCL:0;RULEID:;SRVR:BN6PR12MB1442; X-Forefront-PRVS: 0694C54398 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(346002)(376002)(39860400002)(366004)(39380400002)(396003)(189003)(199004)(2906002)(36756003)(16576012)(2616005)(476003)(58126008)(316002)(7736002)(53936002)(67846002)(956004)(6486002)(11346002)(446003)(486006)(52146003)(4326008)(52116002)(81156014)(8676002)(23676004)(2486003)(5660300001)(65826007)(76176011)(6916009)(53546011)(25786009)(6666003)(59450400001)(386003)(186003)(26005)(16526019)(6246003)(77096007)(305945005)(81166006)(8936002)(97736004)(50466002)(31686004)(575784001)(47776003)(31696002)(64126003)(68736007)(6116002)(3846002)(72206003)(478600001)(229853002)(65806001)(230700001)(86362001)(66066001)(65956001)(106356001)(105586002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR12MB1442;H:[10.236.109.62];FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxNDQyOzIzOm14MGtrUlIzakNjSnd0ellUOTlENjAycmFQ?= =?utf-8?B?NjlPb1luNDNKaW9jcURGaGh6akdVUEppMVdCZGNpT2VTeEtTS2hQMk1nK05Q?= =?utf-8?B?T0lXQVpqSGtYUndxSkV6a0pka2dkdW5xeUwrcnI3ZE9YUDVJUlg4VmVMMDJZ?= =?utf-8?B?bWlyazloM3NVaUMyODhvNTVrV3pLRWxHN1J1UUh5VWdPSnhOQnAyUkh1bTVn?= =?utf-8?B?RGtEM1EvWGwxM1BlT1B1eVVHZ1dhcC9LWVZjU1BEL1IyKzRLRmR5TUtzZ1Zw?= =?utf-8?B?aTNrNTBqNzZJaXNLVkEyTzd5Y2t4UmNkMHdVS1dKZFNXM2lGLzZkSkp6MTY1?= =?utf-8?B?a0ZkMXBtcnpNTUFnSXVIWFcrN0hFcXRINm5BRnNyUS9OM0J0RjhRNldjb3RH?= =?utf-8?B?WjYw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yfx3N/eInqW94bd+Fd7ZWW0WvZcbKQlDSNvhBZQUuFB3sTvSv0q8hvIoTaphjV0IeWquCenNWwHAgI/;20:6uoaWxk879aEsfH9EwRAY3xlKg3aRyBheLyYeY7hBSFKkbq85MKNxB1dWZHkWiOLVTxn+pxWiVLgXs3LKoNtikJyOX4HCVV7FRzhMyxI1Ej5P0N9hnUFVHWPxd6wC0PPsCWQNpSBxXTkaJBvaSX71c3S5J0eLNhApaxZAl1hnrnC9devR/A8iFLJ+oJSveQHLkDb6DfTJpBOYKR6+lHI1BfDdcyGIUe7jLVMH2GT0JLsRR0/JGWNWYmvK+lAAlua X-MS-Office365-Filtering-Correlation-Id: 00d3e9d4-ff1d-4baf-4cce-08d5cb043515 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2018 16:48:47.0866 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00d3e9d4-ff1d-4baf-4cce-08d5cb043515 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1442 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/24/2018 04:18 AM, Greg KH wrote: > On Mon, May 14, 2018 at 12:20:20PM -0500, Gary R Hook wrote: >> Provide base enablement for using debugfs to expose internal data of an >> IOMMU driver. When called, create the /sys/kernel/debug/iommu directory. >> >> Emit a strong warning at boot time to indicate that this feature is >> enabled. >> >> This function is called from iommu_init, and creates the initial DebugFS >> directory. Drivers may then call iommu_debugfs_new_driver_dir() to >> instantiate a device-specific directory to expose internal data. >> It will return a pointer to the new dentry structure created in >> /sys/kernel/debug/iommu, or NULL in the event of a failure. >> >> Since the IOMMU driver can not be removed from the running system, there >> is no need for an "off" function. >> >> Signed-off-by: Gary R Hook >> --- >> drivers/iommu/Kconfig | 10 ++++++ >> drivers/iommu/Makefile | 1 + >> drivers/iommu/iommu-debugfs.c | 72 +++++++++++++++++++++++++++++++++++++++++ >> drivers/iommu/iommu.c | 2 + >> include/linux/iommu.h | 11 ++++++ >> 5 files changed, 96 insertions(+) >> create mode 100644 drivers/iommu/iommu-debugfs.c >> >> diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig >> index f3a21343e636..2eab6a849a0a 100644 >> --- a/drivers/iommu/Kconfig >> +++ b/drivers/iommu/Kconfig >> @@ -60,6 +60,16 @@ config IOMMU_IO_PGTABLE_ARMV7S_SELFTEST >> >> endmenu >> >> +config IOMMU_DEBUGFS >> + bool "Export IOMMU internals in DebugFS" >> + depends on DEBUG_FS >> + help >> + Allows exposure of IOMMU device internals. This option enables >> + the use of debugfs by IOMMU drivers as required. Devices can, >> + at initialization time, cause the IOMMU code to create a top-level >> + debug/iommu directory, and then populate a subdirectory with >> + entries as required. > > You need a big "DO NOT ENABLE THIS OPTION UNLESS YOU REALLY REALLY KNOW > WHAT YOU ARE DOING!!!" line here. To match up with your crazy kernel > log warning. > > Otherwise distros will turn this on, I guarantee it. Apologies for not seeing this. Notes from Greg have been going to junk mail >:-( I will add this text to the Kconfig item. > >> + >> config IOMMU_IOVA >> tristate >> >> diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile >> index 1fb695854809..74cfbc392862 100644 >> --- a/drivers/iommu/Makefile >> +++ b/drivers/iommu/Makefile >> @@ -2,6 +2,7 @@ >> obj-$(CONFIG_IOMMU_API) += iommu.o >> obj-$(CONFIG_IOMMU_API) += iommu-traces.o >> obj-$(CONFIG_IOMMU_API) += iommu-sysfs.o >> +obj-$(CONFIG_IOMMU_DEBUGFS) += iommu-debugfs.o >> obj-$(CONFIG_IOMMU_DMA) += dma-iommu.o >> obj-$(CONFIG_IOMMU_IO_PGTABLE) += io-pgtable.o >> obj-$(CONFIG_IOMMU_IO_PGTABLE_ARMV7S) += io-pgtable-arm-v7s.o >> diff --git a/drivers/iommu/iommu-debugfs.c b/drivers/iommu/iommu-debugfs.c >> new file mode 100644 >> index 000000000000..bb1bf2d0ac51 >> --- /dev/null >> +++ b/drivers/iommu/iommu-debugfs.c >> @@ -0,0 +1,72 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * IOMMU debugfs core infrastructure >> + * >> + * Copyright (C) 2018 Advanced Micro Devices, Inc. >> + * >> + * Author: Gary R Hook >> + */ >> + >> +#include >> +#include >> +#include >> + >> +static struct dentry *iommu_debugfs_dir; >> + >> +/** >> + * iommu_debugfs_setup - create the top-level iommu directory in debugfs >> + * >> + * Provide base enablement for using debugfs to expose internal data of an >> + * IOMMU driver. When called, this function creates the >> + * /sys/kernel/debug/iommu directory. >> + * >> + * Emit a strong warning at boot time to indicate that this feature is >> + * enabled. >> + * >> + * This function is called from iommu_init; drivers may then call >> + * iommu_debugfs_new_driver_dir() to instantiate a vendor-specific >> + * directory to be used to expose internal data. >> + */ >> +void iommu_debugfs_setup(void) >> +{ >> + if (!iommu_debugfs_dir) { >> + iommu_debugfs_dir = debugfs_create_dir("iommu", NULL); >> + if (iommu_debugfs_dir) { > > No need to care about the return value, just keep going. Nothing you > should, or should not, do depending on the return value of a debugfs > call. Sorry. Some habits are hard to break. It just seemed that if there's no iommu debugfs directory, nothing else needed to be done. But plowing ahead works for me. Thank you. > >> + pr_warn("\n"); >> + pr_warn("*************************************************************\n"); >> + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); >> + pr_warn("** **\n"); >> + pr_warn("** IOMMU DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **\n"); >> + pr_warn("** **\n"); >> + pr_warn("** This means that this kernel is built to expose internal **\n"); >> + pr_warn("** IOMMU data structures, which may compromise security on **\n"); >> + pr_warn("** your system. **\n"); >> + pr_warn("** **\n"); >> + pr_warn("** If you see this message and you are not debugging the **\n"); >> + pr_warn("** kernel, report this immediately to your vendor! **\n"); >> + pr_warn("** **\n"); >> + pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n"); >> + pr_warn("*************************************************************\n"); >> + } >> + } >> +} >> + >> +/** >> + * iommu_debugfs_new_driver_dir - create a vendor directory under debugfs/iommu >> + * @vendor: name of the vendor-specific subdirectory to create >> + * >> + * This function is called by an IOMMU driver to create the top-level debugfs >> + * directory for that driver. >> + * >> + * Return: upon success, a pointer to the dentry for the new directory. >> + * NULL in case of failure. >> + */ >> +struct dentry *iommu_debugfs_new_driver_dir(const char *vendor) >> +{ >> + struct dentry *d_new; >> + >> + d_new = debugfs_create_dir(vendor, iommu_debugfs_dir); >> + >> + return d_new; > > This function can be reduced to 1 line. But really, why do you need it > at all? My intention was to not expose the base dentry. Which means that drivers need to call in to this file to create a vendor-specific subdirectory. At least, that was my take-away from the discussion. But you dislike this approach to the code, so I'm open to suggestions. At the very least, it's now a one liner.