Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1909351imm; Sat, 23 Jun 2018 05:26:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLD5zVkkPU40VrkTDoeJidmUgMoqQSOs0O3SU5AAwFKxHsjaCFqM4xeSUthEVlGgdY8X7P1 X-Received: by 2002:a17:902:bb90:: with SMTP id m16-v6mr5424824pls.50.1529756763272; Sat, 23 Jun 2018 05:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529756763; cv=none; d=google.com; s=arc-20160816; b=pM0gcWmQWT32/SF7pG4NF2bA7EYpqvvC24RhDhNuCQNc4r91+rLeUnUtmr63WvfiRa OcpSIhu9RjnS30phXSANhz+KoW4qgm1QDBec0U3CTo8aQq5P6ntW7Cn1yjCT8p2Cnhoe V9pdJSuEwDvLraxJ3EBdNpikZUl0NTjkfT89WMRRhTJe8HgdI4zpUgfYzLyRfnS6krux 1NV15CG6b3lOz2WNB/3YStlEdVXv55E25wmmp5YqFn/CvO3wwcZspTqng2ZHWbFnMIPe MnsPaSg79PoVgc+FZWdKJFRgl1qH10s9sbPHt10aqmfavbxZbCI1bEn4ZDBrpVHckADO ydtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=69TJzC1eAyDhjBCJ98kU5xse8rWg0FTyBgD9W/9aHaU=; b=jbcGkij2JT630lRlofWp7adpvMrfQpM/u9kUKkDfeog6/LVQ/UoipO3o8W2Lz4vk8a 1Rd2YjA60TU/XpmdNBwUdKKbBAgkj9uLZ1tAD4QnIjAdHB6xId50CsCBH8Mavlbkwk6i fAUBiV/V4uqIiIFI/cfrbGy0HbFRQdOqSrgUfGJeucal2l9zmHBaVEaHs4k83UNlkE72 VXGUk5ijlvRPSGvYeRA+7/0chOmh3/az9rb121dpK2qyXWlS+FVpjhve+czb/gsy/JSI hVWuXpV+btIyGa8yDI/7DtjCX0u22nolz/58Li2XXc5ZA9/hh8CtZL0dzVJC/5/s+ZHD GCeA== 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 o10-v6si8194477pgq.545.2018.06.23.05.25.49; Sat, 23 Jun 2018 05:26:03 -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 S1751961AbeFWMYZ (ORCPT + 99 others); Sat, 23 Jun 2018 08:24:25 -0400 Received: from terminus.zytor.com ([198.137.202.136]:45287 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbeFWMYX (ORCPT ); Sat, 23 Jun 2018 08:24:23 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w5NCOIBs467085 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Jun 2018 05:24:18 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w5NCOIuc467082; Sat, 23 Jun 2018 05:24:18 -0700 Date: Sat, 23 Jun 2018 05:24:18 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Reinette Chatre Message-ID: Cc: hpa@zytor.com, tglx@linutronix.de, reinette.chatre@intel.com, mingo@kernel.org, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, reinette.chatre@intel.com, hpa@zytor.com, mingo@kernel.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cache] x86/intel_rdt: Ensure RDT cleanup on exit Git-Commit-ID: 0af6a48da481109affc4ea8295034f69993a91ef X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0af6a48da481109affc4ea8295034f69993a91ef Gitweb: https://git.kernel.org/tip/0af6a48da481109affc4ea8295034f69993a91ef Author: Reinette Chatre AuthorDate: Fri, 22 Jun 2018 15:42:24 -0700 Committer: Thomas Gleixner CommitDate: Sat, 23 Jun 2018 13:03:50 +0200 x86/intel_rdt: Ensure RDT cleanup on exit The RDT system's initialization does not have the corresponding exit handling to ensure everything initialized on load is cleaned up also. Introduce the cleanup routines that complement all initialization. This includes the removal of a duplicate rdtgroup_init() declaration. Signed-off-by: Reinette Chatre Signed-off-by: Thomas Gleixner Cc: fenghua.yu@intel.com Cc: tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com Cc: jithu.joseph@intel.com Cc: dave.hansen@intel.com Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/a9e3a2bbd731d13915d2d7bf05d4f675b4fa109b.1529706536.git.reinette.chatre@intel.com --- arch/x86/kernel/cpu/intel_rdt.c | 11 +++++++++++ arch/x86/kernel/cpu/intel_rdt.h | 3 +-- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 7 +++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index ec4754f81cbd..abb71ac70443 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c @@ -859,6 +859,8 @@ static __init bool get_rdt_resources(void) return (rdt_mon_capable || rdt_alloc_capable); } +static enum cpuhp_state rdt_online; + static int __init intel_rdt_late_init(void) { struct rdt_resource *r; @@ -880,6 +882,7 @@ static int __init intel_rdt_late_init(void) cpuhp_remove_state(state); return ret; } + rdt_online = state; for_each_alloc_capable_rdt_resource(r) pr_info("Intel RDT %s allocation detected\n", r->name); @@ -891,3 +894,11 @@ static int __init intel_rdt_late_init(void) } late_initcall(intel_rdt_late_init); + +static void __exit intel_rdt_exit(void) +{ + cpuhp_remove_state(rdt_online); + rdtgroup_exit(); +} + +__exitcall(intel_rdt_exit); diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index f245aaae514e..2b3f7619be48 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h @@ -209,6 +209,7 @@ extern struct list_head rdt_all_groups; extern int max_name_width, max_data_width; int __init rdtgroup_init(void); +void __exit rdtgroup_exit(void); /** * struct rftype - describe each file in the resctrl file system @@ -431,8 +432,6 @@ extern struct rdt_resource rdt_resources_all[]; extern struct rdtgroup rdtgroup_default; DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key); -int __init rdtgroup_init(void); - enum { RDT_RESOURCE_L3, RDT_RESOURCE_L3DATA, diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index f301919ae9b2..960066249374 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -2828,3 +2828,10 @@ cleanup_root: return ret; } + +void __exit rdtgroup_exit(void) +{ + unregister_filesystem(&rdt_fs_type); + sysfs_remove_mount_point(fs_kobj, "resctrl"); + kernfs_destroy_root(rdt_root); +}