Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2742371rda; Wed, 25 Oct 2023 10:57:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgeIf7ZM6SmUdqtCKwKphars0FxVbz/bxStHaxauBxL0xdGcqmFfvKaMqUQGOOOGaBZ37r X-Received: by 2002:a54:400c:0:b0:3ad:f6ad:b9d2 with SMTP id x12-20020a54400c000000b003adf6adb9d2mr16921890oie.16.1698256643322; Wed, 25 Oct 2023 10:57:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698256643; cv=none; d=google.com; s=arc-20160816; b=S8IodrDdpM5/P7nUw6oodInmJULYysAVQUkk1S+AQTLIyown0TnGif2rQjVMAj113q YgGIYVsJTNSklAmd/67WG/6XdUj0GTUOIkljavbdd+wKpFvTQ6JfKq90C9sPEu+YlLz2 wNcMgzrMrY6mPdku5+UYZJNK8bWwqvWakN8jbhKHl29Ok7XCA4Q8BqqmHl/s9C4z8BHf 1dHq/5O/V73lC/DfHjw7QQQqiJO70bTuVGx4eKT2OvbaLnpKYeW7TXFzWVGFgnUSZkiA yRYm56b0itdm9apNW1HwgTV4yf7qNUkd4OQpB54g7AF+y5S5gzdjpF4qfrlmlJqG4Mk4 DWzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=K/6T/RaShIPDi/62lQf/9196XVcL8/b5M8RelU7PEBA=; fh=VuurgKOz/iYGqMeXCSXbmd1sqeKGCB6wb7SlBMhYtIk=; b=qucQcZTga4hIz2QoYZl/uzDZEaPwpkteM6+x0i2uW2hSV8bT9j8RDy8SHxFoGJvDl8 bMXrvS2kgZ79udrxlST3Dt8n7dTZJ6zPxSU+04r7kmQHjYs19BuBMWG1hg1eFXVKNl3V y48Xg40OCshxGKbILR0OiU9N7cO7dXoKnx/sHpi5bsAD050YR+RuLvuS0c9JuCxnzieD PCkqSpaTAADqAW/rPon2zOSz6v7HTKmBlaU4NMUQGH/cxfanzX4PcohoJKQI0HD3a+fW Mk3sy90Dm9n1tgWSt93cYez7vtKAZNjkB1hxP3yXBx2wvORQLK7jKELRw/aAKlKCtFF2 lbew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j83-20020a255556000000b00da04292553fsi4455234ybb.78.2023.10.25.10.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 10:57:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3501B8023A11; Wed, 25 Oct 2023 10:57:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234479AbjJYR5L (ORCPT + 99 others); Wed, 25 Oct 2023 13:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbjJYR5J (ORCPT ); Wed, 25 Oct 2023 13:57:09 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AFA96187 for ; Wed, 25 Oct 2023 10:57:06 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D88FE1477; Wed, 25 Oct 2023 10:57:47 -0700 (PDT) Received: from [10.1.197.60] (eglon.cambridge.arm.com [10.1.197.60]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 95BC03F738; Wed, 25 Oct 2023 10:57:03 -0700 (PDT) Message-ID: <59133e87-33f1-8038-72be-ffbb441545b4@arm.com> Date: Wed, 25 Oct 2023 18:56:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v6 02/24] x86/resctrl: kfree() rmid_ptrs from rdtgroup_exit() Content-Language: en-GB To: Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com References: <20230914172138.11977-1-james.morse@arm.com> <20230914172138.11977-3-james.morse@arm.com> <9606020e-c322-fb6a-a6ca-96ade7aecf17@intel.com> <550fe399-8904-c515-f556-3536ebe2e9a3@arm.com> <7b793937-ab79-48be-8f82-4bfcfc464045@intel.com> From: James Morse In-Reply-To: <7b793937-ab79-48be-8f82-4bfcfc464045@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 10:57:19 -0700 (PDT) Hi Reinette, On 05/10/2023 19:04, Reinette Chatre wrote: > On 10/5/2023 10:05 AM, James Morse wrote: >> On 02/10/2023 18:00, Reinette Chatre wrote: >>> On 9/14/2023 10:21 AM, James Morse wrote: >>>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >>>> index 725344048f85..a2158c266e41 100644 >>>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c >>>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >>>> @@ -3867,6 +3867,11 @@ int __init rdtgroup_init(void) >>>> >>>> void __exit rdtgroup_exit(void) >>>> { >>>> + struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; >>>> + >>>> + if (r->mon_capable) >>>> + resctrl_exit_mon_l3_config(r); >>>> + >>>> debugfs_remove_recursive(debugfs_resctrl); >>>> unregister_filesystem(&rdt_fs_type); >>>> sysfs_remove_mount_point(fs_kobj, "resctrl"); >>> >>> You did not respond to me when I requested that this be done differently [1]. >>> Without a response letting me know the faults of my proposal or following the >>> recommendation I conclude that my feedback was ignored. >> >> Not so - I just trimmed the bits that didn't need a response. I can respond 'Yes' to each >> one if you prefer, but I find that adds more noise than signal. > > I do not expect a response to every review feedback but no response > is assumed to mean that you agree with the feedback. > >> >> This is my attempt at 'doing the cleanup properly', which is what you said your preference >> was. (no machine on the planet can ever run this code, the __exit section is always >> discarded by the linker). >> >> Reading through again, I missed that you wanted this called from resctrl_exit(). (The > > Right. And not responding to that created expectation that you agreed with the > request. > >> naming suggests I did this originally, but it didn't work out). >> I don't think this works as the code in resctrl_exit() remains part of the arch code after >> the move, but allocating rmid_ptrs[] stays part of the fs code. >> >> resctrl_exit() in core.c gets renamed as resctrl_arch_exit(), and rdtgroup_exit() takes on >> the name resctrl_exit() as its part of the exposed interface. > > I expect memory allocation/free to be symmetrical. Doing otherwise > complicates the code. Having this memory freed in rdtgroup_exit() only > seems appropriate if it is allocated from rdtgroup_init(). > Neither rmid_ptrs[] nor closid_num_dirty_rmid are allocated in > rdtgroup_init() so freeing it in rdtgroup_exit() is not appropriate. It probably makes more sense when you see how things get split up. I was trying to reduce the churn of adding something in one place, then moving it later. For now I've added all the functions to make this thing symmetric. James > If you are planning to move resctrl_exit() to be arch code then I expect > resctrl_late_init() to be split with the rmid_ptrs[]/closid_num_dirty_rmid > allocation moving to fs code. Freeing that memory can follow at that time.