Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3803355imm; Tue, 29 May 2018 14:05:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJhDUba05tDAJ0HQQJN2ySaohQG0oi82PznmdD7fIZOCKtoJJAYoYx74jtxZ7zNXawUPpat X-Received: by 2002:a17:902:bc4c:: with SMTP id t12-v6mr22159plz.177.1527627945875; Tue, 29 May 2018 14:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527627945; cv=none; d=google.com; s=arc-20160816; b=JoWWdI/ChlkI+u1zygaJU21a4KoGJW6yDo/Lq3xc4fDF4fRMgyurLu7zc0c0oCMYsL F19dLfMg2uvUfzaELY05AEA8Q8XryuTq1crBNZTcfB8qmFniWPqk3nXcjnYCYUe8AiuS ynoJMvAXYlAHy8DZhkTICk0Fy5OTPbpwLLTUm9JdMD54u2P9GKtmgWsngrY6RglsAvSt w3glh99T3yt09lzyHM3jorxJZ0cLaE1zqGxwK9qvRUrZzXyUe6IprpgHa+2tyLfWfMb/ GSFWEeWfIMaolERHQNn/xY+CX5xGBqBiUaWVoAqoN/s2k2eGUPbqswI4Kwn98YFzBS0C o+XQ== 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=G7Iyb25Vj9J1yNAa6emKjq4Q8LqZoV3kMcw8cvrnCY8=; b=D4wcsCoayyydn5PM9VtTL2PmTqy6fYyzm11re6jXUBaO4kyBiq60rVxCf6L4fvYys/ s4kJ28PNArPFW2MZ7Cc4cWtui454Jz8UrIK6dY+9FxFZ/j3AJnzmPJKCA2/8qoA8gba9 MuRE9ijGb+V9bo+tdqz2UnKNJpbjPvHreJoeWmq2M7UkIRSONpeSSo9Dlud0n39DvbsV cNrldGXvWdli1yXuvICoqKljqZ0MtnYRarhayWgiYb/+e6GW3bCVC0PwfRufv9Ki2QBt YS0l1tdvHyiTJVO3ldfJaCalzvK+Bgbl3b9EtCWpzYtp2Bz+k87bMGzfJErHeK9z9iK4 NOUw== 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 g3-v6si32326969pld.309.2018.05.29.14.05.31; Tue, 29 May 2018 14:05:45 -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 S937187AbeE2VBL (ORCPT + 99 others); Tue, 29 May 2018 17:01:11 -0400 Received: from mga14.intel.com ([192.55.52.115]:46453 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937109AbeE2VBF (ORCPT ); Tue, 29 May 2018 17:01:05 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2018 14:00:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,457,1520924400"; d="scan'208";a="60127766" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by orsmga001.jf.intel.com with ESMTP; 29 May 2018 14:00:55 -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 V5 32/38] x86/intel_rdt: Ensure RDT cleanup on exit Date: Tue, 29 May 2018 05:57:57 -0700 Message-Id: <72dee9c18ed095942783868eb1e299f13fefa3ff.1527593971.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.13.6 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 --- 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 24bfa63e86cf..35dca2187cdc 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c @@ -857,6 +857,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; @@ -878,6 +880,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); @@ -889,3 +892,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 0f8fb894db15..55a82f1a75d3 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -2773,3 +2773,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.13.6