All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for James Morse" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: James Morse <james.morse@arm.com>, Borislav Petkov <bp@suse.de>,
	Jamie Iles <quic_jiles@quicinc.com>,
	Shaopeng Tan <tan.shaopeng@fujitsu.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Xin Hao <xhao@linux.alibaba.com>,
	Cristian Marussi <cristian.marussi@arm.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/cache] x86/resctrl: Group struct rdt_hw_domain cleanup
Date: Fri, 23 Sep 2022 18:01:57 -0000	[thread overview]
Message-ID: <166395611790.401.175925430801977412.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20220902154829.30399-5-james.morse@arm.com>

The following commit has been merged into the x86/cache branch of tip:

Commit-ID:     7add3af4178d9e25afc8d990a7d1000ccb22b6a0
Gitweb:        https://git.kernel.org/tip/7add3af4178d9e25afc8d990a7d1000ccb22b6a0
Author:        James Morse <james.morse@arm.com>
AuthorDate:    Fri, 02 Sep 2022 15:48:12 
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Thu, 22 Sep 2022 15:27:15 +02:00

x86/resctrl: Group struct rdt_hw_domain cleanup

domain_add_cpu() and domain_remove_cpu() need to kfree() the child
arrays that were allocated by domain_setup_ctrlval().

As this memory is moved around, and new arrays are created, adjusting
the error handling cleanup code becomes noisier.

To simplify this, move all the kfree() calls into a domain_free() helper.
This depends on struct rdt_hw_domain being kzalloc()d, allowing it to
unconditionally kfree() all the child arrays.

Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Jamie Iles <quic_jiles@quicinc.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@fujitsu.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Xin Hao <xhao@linux.alibaba.com>
Tested-by: Shaopeng Tan <tan.shaopeng@fujitsu.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20220902154829.30399-5-james.morse@arm.com
---
 arch/x86/kernel/cpu/resctrl/core.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
index 25f3014..e37889f 100644
--- a/arch/x86/kernel/cpu/resctrl/core.c
+++ b/arch/x86/kernel/cpu/resctrl/core.c
@@ -414,6 +414,13 @@ void setup_default_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm)
 	}
 }
 
+static void domain_free(struct rdt_hw_domain *hw_dom)
+{
+	kfree(hw_dom->ctrl_val);
+	kfree(hw_dom->mbps_val);
+	kfree(hw_dom);
+}
+
 static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d)
 {
 	struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
@@ -488,7 +495,7 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
 	rdt_domain_reconfigure_cdp(r);
 
 	if (r->alloc_capable && domain_setup_ctrlval(r, d)) {
-		kfree(hw_dom);
+		domain_free(hw_dom);
 		return;
 	}
 
@@ -497,9 +504,7 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
 	err = resctrl_online_domain(r, d);
 	if (err) {
 		list_del(&d->list);
-		kfree(hw_dom->ctrl_val);
-		kfree(hw_dom->mbps_val);
-		kfree(hw_dom);
+		domain_free(hw_dom);
 	}
 }
 
@@ -547,12 +552,10 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
 		if (d->plr)
 			d->plr->d = NULL;
 
-		kfree(hw_dom->ctrl_val);
-		kfree(hw_dom->mbps_val);
 		bitmap_free(d->rmid_busy_llc);
 		kfree(d->mbm_total);
 		kfree(d->mbm_local);
-		kfree(hw_dom);
+		domain_free(hw_dom);
 		return;
 	}
 

  parent reply	other threads:[~2022-09-23 18:03 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 15:48 [PATCH v6 00/21] x86/resctrl: Make resctrl_arch_rmid_read() return values in bytes James Morse
2022-09-02 15:48 ` [PATCH v6 01/21] x86/resctrl: Kill off alloc_enabled James Morse
2022-09-23 18:02   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 02/21] x86/resctrl: Merge mon_capable and mon_enabled James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 03/21] x86/resctrl: Add domain online callback for resctrl work James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 04/21] x86/resctrl: Group struct rdt_hw_domain cleanup James Morse
2022-09-07  6:28   ` haoxin
2022-09-08 17:01     ` James Morse
2022-09-23 18:01   ` tip-bot2 for James Morse [this message]
2022-09-02 15:48 ` [PATCH v6 05/21] x86/resctrl: Add domain offline callback for resctrl work James Morse
2022-09-07  6:29   ` haoxin
2022-09-08 17:00     ` James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 06/21] x86/resctrl: Remove set_mba_sc()s control array re-initialisation James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 07/21] x86/resctrl: Abstract and use supports_mba_mbps() James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 08/21] x86/resctrl: Create mba_sc configuration in the rdt_domain James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 09/21] x86/resctrl: Switch over to the resctrl mbps_val list James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 10/21] x86/resctrl: Remove architecture copy of mbps_val James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 11/21] x86/resctrl: Allow update_mba_bw() to update controls directly James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 12/21] x86/resctrl: Calculate bandwidth from the previous __mon_event_count() chunks James Morse
2022-09-07  6:47   ` haoxin
2022-09-08 17:00     ` James Morse
2022-09-08 21:13       ` Reinette Chatre
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 13/21] x86/resctrl: Add per-rmid arch private storage for overflow and chunks James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 14/21] x86/resctrl: Allow per-rmid arch private storage to be reset James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 15/21] x86/resctrl: Abstract __rmid_read() James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 16/21] x86/resctrl: Pass the required parameters into resctrl_arch_rmid_read() James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 17/21] x86/resctrl: Move mbm_overflow_count() " James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 18/21] x86/resctrl: Move get_corrected_mbm_count() " James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 19/21] x86/resctrl: Rename and change the units of resctrl_cqm_threshold James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 20/21] x86/resctrl: Add resctrl_rmid_realloc_limit to abstract x86's boot_cpu_data James Morse
2022-09-07  6:26   ` haoxin
2022-09-08 17:01     ` James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-02 15:48 ` [PATCH v6 21/21] x86/resctrl: Make resctrl_arch_rmid_read() return values in bytes James Morse
2022-09-23 18:01   ` [tip: x86/cache] " tip-bot2 for James Morse
2022-09-13  1:00 ` [PATCH v6 00/21] " tan.shaopeng
2022-09-22  9:40   ` James Morse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=166395611790.401.175925430801977412.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@suse.de \
    --cc=cristian.marussi@arm.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=quic_jiles@quicinc.com \
    --cc=reinette.chatre@intel.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=x86@kernel.org \
    --cc=xhao@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.