Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1372858imm; Fri, 22 Jun 2018 15:44:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKILdV1V8UjNGSSVajQ6B7b0XBtIjiXl1h477oeFSJ+qsr8IXxqXA+tvCH/KEUMT1K+DwYqI X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr3463374plt.162.1529707445578; Fri, 22 Jun 2018 15:44:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529707445; cv=none; d=google.com; s=arc-20160816; b=rFEJ0hafYz313826pPs4y2pwG4KOphWSia6TLL4r0U05ix19i01WT0HAunkjvz9+1T 6SGLzxTY206g6eOIw1b5YfJHvQ/D3406UETJLyuj0IA4SdxUi0IxXoAOtQLFJp4JEthx tROmRvAkOFKiOEzuIMTs0+JGRlSx6z0uIWo6d48z+Qesfa0uFmeNOoGUOu5tk6uKl+yl Z/4UHzlo66lexyv/MvZ2JvAgqZN/dXK6vfReY7jl0Fw78gePNC8qCiv8bIvnkWEqtnDN 0dQiGcCA3XLNZudQMVDCmHm7rPnOHG0pT0ud1d5hlg8PJCSz77J4sqExFE2K16m8ZYw3 lEMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=f77aezRXN84SsWozAdlLRlEhCF/NSbO+fcDdFySjCkA=; b=tMlazEiRfDq3wutRsWr4X5uzoftzM6n1+7USS4UciEko+gPcliAWvFQ+m3CBgB51jD /OKHruICwc7bg9mfnCpDVjcr+yh7viTC42u+9CkOlXRRn4l3bKQi23hjEEU8id/Q4h1I 1GTSztinNHsZ/ixbroIvW0Ojd336khMrw8uE+YdJqe4fmhiv6IFiZfjbi2g6dVwnYURB YL8vsei85xIao5zHvQ2JTQbigNnnAq/Rhmvv++d12BQ1lJ15tLBpWa6fMBulwO45Ne37 a6kgtZr/6yH4JuUNUMP4E0qkF04s40Z8CvQAv2TopVSN9enWaYwzeH5rTu2/JIHJdkDG +9XA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 135-v6si78158pfz.334.2018.06.22.15.43.51; Fri, 22 Jun 2018 15:44:05 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934175AbeFVWnD (ORCPT + 99 others); Fri, 22 Jun 2018 18:43:03 -0400 Received: from mga02.intel.com ([134.134.136.20]:22311 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933953AbeFVWmz (ORCPT ); Fri, 22 Jun 2018 18:42:55 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jun 2018 15:42:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,259,1526367600"; d="scan'208";a="234843448" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by orsmga005.jf.intel.com with ESMTP; 22 Jun 2018 15:42:48 -0700 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com, vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com, jithu.joseph@intel.com, dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [PATCH V7 33/41] x86/intel_rdt: Ensure RDT cleanup on exit Date: Fri, 22 Jun 2018 15:42:24 -0700 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/72dee9c18ed095942783868eb1e299f13fefa3ff.1527593971.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 886cd28b305f..c948266d59c8 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 cecf26e63e2c..75fe5f2719be 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -2837,3 +2837,10 @@ int __init rdtgroup_init(void) return ret; } + +void __exit rdtgroup_exit(void) +{ + unregister_filesystem(&rdt_fs_type); + sysfs_remove_mount_point(fs_kobj, "resctrl"); + kernfs_destroy_root(rdt_root); +} -- 2.17.0