Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp470756rdb; Thu, 5 Oct 2023 11:04:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHnMcdAY6lx54wtovrbxo5Sh+68hDL0UvyuUX4vChCbPAEeEIWgYeMqg27Mo6OjKtTznSe X-Received: by 2002:a05:6358:52c3:b0:13a:a094:737d with SMTP id z3-20020a05635852c300b0013aa094737dmr6512395rwz.18.1696529098194; Thu, 05 Oct 2023 11:04:58 -0700 (PDT) Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id d185-20020a6336c2000000b0057759a5b7c6si2072942pga.62.2023.10.05.11.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 11:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="WX4/UaZq"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id AE144807C868; Thu, 5 Oct 2023 11:04:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231179AbjJESEo (ORCPT + 99 others); Thu, 5 Oct 2023 14:04:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbjJESEh (ORCPT ); Thu, 5 Oct 2023 14:04:37 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F5D690 for ; Thu, 5 Oct 2023 11:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696529076; x=1728065076; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=wssx7RA1uFWjcwqFDvO1D3Ds5C9Kd4vcRcLkk1fYr6c=; b=WX4/UaZqIYnHquRtIrn8zavPZkE3PeNErhk3K/RxtmU+Som9fyrMbAGu PQqUmji9vOgRY17JgbXb2LOdxEWd/XyuO+T/HUt5orA13+nJLDoTQe+t6 8EVGj+O61SKuVFWceak3kXKbB6gl6zGFg7ciZTD06DvELPSh3Zo9XxMNO TWdsAEQAfocA64aDgA69DpfVktqZpqlxVfwF37/HAyqVH49P90ZW7wJqO 96iPrapskie6pp0PwCbZZYhgcHbkPQakz6ysSXEqq8QRX3ZJVImNuVK3C U3Hu9H1RSncrS0eKir068yknE6D32yayyVTtcPw/e25m6I7O330czxCMz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="469848825" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="469848825" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 11:04:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10854"; a="868007309" X-IronPort-AV: E=Sophos;i="6.03,203,1694761200"; d="scan'208";a="868007309" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga002.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Oct 2023 11:04:34 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 5 Oct 2023 11:04:33 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 5 Oct 2023 11:04:33 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Thu, 5 Oct 2023 11:04:33 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.46) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Thu, 5 Oct 2023 11:04:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kShSRF/92Wmf7Hh4Nr3e23BjvXMb99JiRW4Zq40QpCSGfdzyQqzCV6p3+0Bdjcl5fF05gI/gfcaXQ8ToeH9A5zkDU9zDPf6QD/FBOpojegfr3nx2C3Xn1R6iEtDHM0DLlfz6StzA537RC0ZiAr6LZoVP3cWe6hlINxNMbYrIvXuuoba6yO8J9Pin94+ZuhOTL6NS1gJ3LJzwoH5rbPAhjlz9CO182PtP+By/DSWpBKwyhoQtxMfinpxB1wT7p0ht1yvtno1IYtUovXPRTd2oeC/c+HnQYBRV3YqWiJdR6df0d8LTEvtQcDeR08Lcsfr+fTlLfdUxJhRSGGY7FG31zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vfsUoEM+YxRdzYyuBrdvBmFxn7KFD5fyhlCUZPluVx0=; b=X9bb5qh38w0/0gC+4lHfHXK7ionx0c5JBVVyn8mr7fvN1V3FSV+1htPHBqi9HABXwOzW0sXTkRX2UAUvsFiEpPLRxoXWsz0+i5s9aAnCSbbYB8Ymvujn1HsO5RvftWUHI+OqOPr7H9iymMg0gYPMAqiqfwfB/C2d/JIwCJ+x9+xLsyScjLsl+htxIAdjN2bToWOZXMDcH3swZU3uV58IqDY9wdvMJQguaQBmszcucRSMChjf6IT7WRb9J4y4zhTEuUSMJQG+xkgojkGwCyahZOJHSDRWnPfSqeU8WZgvwHxk6m1OiETBGl3KMhjYOyVqVHgKVDk6WbabSd3TNPNboA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from SJ2PR11MB7573.namprd11.prod.outlook.com (2603:10b6:a03:4d2::10) by DS0PR11MB7904.namprd11.prod.outlook.com (2603:10b6:8:f8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.31; Thu, 5 Oct 2023 18:04:31 +0000 Received: from SJ2PR11MB7573.namprd11.prod.outlook.com ([fe80::bd70:f215:4a97:c84e]) by SJ2PR11MB7573.namprd11.prod.outlook.com ([fe80::bd70:f215:4a97:c84e%6]) with mapi id 15.20.6838.033; Thu, 5 Oct 2023 18:04:30 +0000 Message-ID: <7b793937-ab79-48be-8f82-4bfcfc464045@intel.com> Date: Thu, 5 Oct 2023 11:04:27 -0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 02/24] x86/resctrl: kfree() rmid_ptrs from rdtgroup_exit() Content-Language: en-US To: James Morse , , CC: Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , , D Scott Phillips OS , , , , , , , Jamie Iles , Xin Hao , , , 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> From: Reinette Chatre In-Reply-To: <550fe399-8904-c515-f556-3536ebe2e9a3@arm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MW4PR04CA0184.namprd04.prod.outlook.com (2603:10b6:303:86::9) To SJ2PR11MB7573.namprd11.prod.outlook.com (2603:10b6:a03:4d2::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ2PR11MB7573:EE_|DS0PR11MB7904:EE_ X-MS-Office365-Filtering-Correlation-Id: 06f4a58c-6d83-40f5-3135-08dbc5cd85d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rCmUm7ug2px1BE1i0uQBoVCgc1eDGgEe8FPN4qZ7ebgAtBX+SUGDhzvRglCn4f4L2TiU9EjTiBF5iKctaZo8TppWY5iuhmEomabln4/mVl8DlSidiAjIX+yfz/qbZ6A0iDpREfsB3V8fg8QT/WRp5wLc5VMAPZK5s036JT+i/Gz82oWvd1hWwUBxn9D8+OJoMWukDJod0wh2QGKUFZRz5B02EdwXnHkaLO54esCzyP2RD4aSUjjIqffMUPLUUefGMDNCvelz1dnBY3cgJtS5kWCA95iPCkH8qo7M9nAlgk5sDZtldxFUVVW3h5fP7TYgr1jKsXF2hixdIq5l6iMt3m/jQNvuPFpLU14gj9AxHy17EBEJpbb+PCOAJz4wgZNsXu3ZCOji19qT2zWRZSdQ/uV7MYPd9rxFAmRQOhk/0w/aNX4r1ijLoVMzdHqMnG6CeboZOYXQwDZA1USu3JwwFwRkh/nasOF0wGnX07oCq7K372Um3DR0TkpclORfsjciNW4XI+OvFfB6GGMATa07UEpU7Z4pi+gWn0TWh/f7xGehE4W22R4l+cgq+LCn7BbUkn27qisg+pY27Q04krtSU1zEycJ8BgwDCCoIGbZTQhvHptNhiBwmCWtv7aJAzPELirjFon+rsst9KevLJH1t5g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ2PR11MB7573.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(396003)(39860400002)(366004)(346002)(376002)(230922051799003)(64100799003)(1800799009)(186009)(451199024)(2906002)(6486002)(6506007)(6666004)(53546011)(478600001)(83380400001)(6512007)(4326008)(2616005)(26005)(7416002)(41300700001)(5660300002)(316002)(8676002)(54906003)(66556008)(66946007)(66476007)(8936002)(44832011)(36756003)(31696002)(82960400001)(38100700002)(86362001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bnFpZmdVaTNCQVl6cStoSzgxWUorZW5ER2N4SklPYjFjOVFzeEtjTHdCTXVK?= =?utf-8?B?eFZWazVBTVZWU3lPVWJuQktnR2ZGMWw1dis0bHlqQjhId1RtMlgyUHE3SUtB?= =?utf-8?B?bHRFTnNFNDFKVi9nci9NQ0F1ZEVsODdUbzRLYXlYNHI3eVhXWnpyVHh0QUJW?= =?utf-8?B?NnAybFJOZVVWNWFXMElQcDR6TDZiUXpaTnVrSjh6cFNHUXFwZ2VDR2k3OW5I?= =?utf-8?B?UHdvdHNHbklTQ0szV3lxRmpsUmVVaDhhVk51QXVFQnFqM3lpMkJVZmk4dUFz?= =?utf-8?B?VGZFUXQwUWNPU3N4cTFhbnl3Z3RheDd4MGJwYUNhVmVMckpZWlVTTldWcDNx?= =?utf-8?B?ek1adGFnUGdNUk9VNzBaSExPWm5VYVR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?bXc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 06f4a58c-6d83-40f5-3135-08dbc5cd85d3 X-MS-Exchange-CrossTenant-AuthSource: SJ2PR11MB7573.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2023 18:04:30.8996 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zXeQSQuN5yuyy+mTyrQAwaby+NpZIl2T6ailgIeBrfPFOhW6QWwxM5CnOT8Ii36rkKvfxNJ9nBXjiOwDU1ki6J01F2rNekGwGcfLi5yQhas= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7904 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 05 Oct 2023 11:04:55 -0700 (PDT) Hi James, 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. 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. Reinette