Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1306390lql; Tue, 12 Mar 2024 13:07:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWWNJGbks+mOfFKqlCSKdAncljfpmJ1JGJEJUIZb272ZelFDcW3HALlUVepdu67u6Cs4XldUV/wCmUpsTIXbBADCQqu6PykSkAWE0IIyg== X-Google-Smtp-Source: AGHT+IEDnIn8ey2bi4XQ3aY6gWa/i0t/JnpPwdjnIPLsBHr5YE0q9T6yVTwgMTBL009Gvr3efR5u X-Received: by 2002:a05:6a20:f388:b0:1a1:1eb7:83e1 with SMTP id qr8-20020a056a20f38800b001a11eb783e1mr1400956pzb.46.1710274026601; Tue, 12 Mar 2024 13:07:06 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s1-20020a639e01000000b005dc352a5637si7793142pgd.323.2024.03.12.13.07.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 13:07:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Ktp3i1yI; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-100740-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100740-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 24532B23EAB for ; Tue, 12 Mar 2024 20:06:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 847CE1428E0; Tue, 12 Mar 2024 20:06:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Ktp3i1yI" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2069.outbound.protection.outlook.com [40.107.212.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C88CA7D406 for ; Tue, 12 Mar 2024 20:06:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.69 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710273999; cv=fail; b=Bqh1s11k5k54fDqTrF0DVGgDyk8pGnm64qW2x6MwqxaYg0PtcRDe0xBY9EeZcn6wH5kwVFqSlCbCbGz8c6nstYNYyDzTANRhlc540Tv2x3OgVaQLepwc4hbG3L2lO66ZH/4GlV8f2UO09fZ660xYsXbuEk2siz52ShSwG1u1Vy4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710273999; c=relaxed/simple; bh=3HW7Wd/1x31LCf0J7rz0zpPnLToLIRMRic4HvW+cju0=; h=Message-ID:Date:From:Subject:To:Cc:References:In-Reply-To: Content-Type:MIME-Version; b=p4C5vhLa/9bMIhkcpciE0oifAAFRs3T25OdvcbxGfqwVbfnxVP7bqyvaSf32AmZRvzAjRQcEhUAI+DyADYm0R4V/nypDDcMjgt6uOiRr6EshGsZGk74OLKxKW2hAcpn3tNqC3juRAXsD8Ok9K+CSBXudLPKcsXG4TOIZFC42jiI= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Ktp3i1yI; arc=fail smtp.client-ip=40.107.212.69 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SY95J5mKC8MNR++n6Ua326IQ20KfsQYsAl6BS9YcjwD7Xvny+qDgKuK4l5C7wYtiqznj9yLRWl+4fJv6XRoR/DTWTB6EHOi3WnMpLcPUP0+l8F1snDrFJ2lF5zy9s5pkXYdBK021zKGQAH3CzF46+TFkgL44/vsPKei/8DOCSp0L0mqtPtWZ7KcmXhoeS+04A0rPe1WmR3CmFjxPt/gu4pZem1d7Zo9SenY5aCKNvh6hmoPTNyDxZBZkCN5G3Ludzbs1QNcmth6BtZwxb4Yfx7xhFNg999pEpiIR6ACSLPAzg2WCbBaIgfDL6ZAZG+6gpj+OCpfwNC6erYTpscz9Jw== 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=Lv2mUEXg22dfQk9jonDyUZ5dHu2/GbaztwfWtt9J9aU=; b=GVCABwr/bWi6MueyAjrqNfC8LLU6156S5Se2PexzAjAEOftW9tZrgNPsajDBJ59X6DMg6/kcq5LgAos9XN7avauqGZM3A5REv93jafmYVYWWcUtqstBpsn+RDDC/82gaQ94+M40EAP/ls7+89TYkUrtBNvK2UEh+heHEX+SMKHkruAzOIPJd1jbAqX3294DUAB+mqXHuQZlTwDt1oMYWMDMyMzBWVhSkwP60OONrqidE1daJFq8WEbvrtQ6PtcgFe9E9vx/rqCSdg6SoI9n82DbYC6fyXiWNS6usqOHaiK4n6jpZsNZ1XuF/EiIVpU1kdmJrkUKVgvnhgwjCVKU4QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Lv2mUEXg22dfQk9jonDyUZ5dHu2/GbaztwfWtt9J9aU=; b=Ktp3i1yIl1z50Uu1o7e8AxvL1kEouCMxAfe5fVSrrMP4OvgI/phg58dectjN467+1dmkzRKXK1Oonk0jiM9HtKHBsPsryHxKtsTtkvmBQJe798FcPI6Sba6kOKWdO6ZDeHJF7kT7RA9fFrRzODMGlSsBeuuTsHBlKF4dTJxG9Vk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MW3PR12MB4553.namprd12.prod.outlook.com (2603:10b6:303:2c::19) by SA1PR12MB7410.namprd12.prod.outlook.com (2603:10b6:806:2b4::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Tue, 12 Mar 2024 20:06:34 +0000 Received: from MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::873e:e31:6eff:36a4]) by MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::873e:e31:6eff:36a4%5]) with mapi id 15.20.7362.035; Tue, 12 Mar 2024 20:06:34 +0000 Message-ID: <9fc33aee-8afd-4c8e-af83-74eb11a951b1@amd.com> Date: Tue, 12 Mar 2024 15:06:32 -0500 User-Agent: Mozilla Thunderbird From: "Moger, Babu" Subject: Re: [PATCH v5 1/2] x86/resctrl: Pass domain to target CPU Reply-To: babu.moger@amd.com To: Tony Luck , "Chatre, Reinette" , Borislav Petkov , James Morse Cc: Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org, "Yu, Fenghua" , Ingo Molnar , H Peter Anvin , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Maciej Wieczor-Retman References: <20240308213846.77075-1-tony.luck@intel.com> <20240308213846.77075-2-tony.luck@intel.com> Content-Language: en-US In-Reply-To: <20240308213846.77075-2-tony.luck@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SA9PR11CA0026.namprd11.prod.outlook.com (2603:10b6:806:6e::31) To MW3PR12MB4553.namprd12.prod.outlook.com (2603:10b6:303:2c::19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PR12MB4553:EE_|SA1PR12MB7410:EE_ X-MS-Office365-Filtering-Correlation-Id: f4a272bd-6395-4a50-b6d4-08dc42cfeaa9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LRwbvJO4ly/RH5SiOWIa+Nr6cB1zGDxtEVn3ZXkN7m3Zi03Z6uMLkxWqNa/dnhpiU7DdxtLHnKVTrCByOY/XumrP2nDxrwdebS6IZ/RkKzEatoRZBPnQzhnOEK82wDJpDLDyl2BIi4gUhyWEP/GL3Puu19wF2q29uDlAqgO70R77O61snf/ybU1g54vjHxnyaMV0vPqsd4OkAFydn76cH/JRuLfubrJrm75I2rFq3x+R83g2FtBewNCygyF5WLR/MKbXXR534A7aIM+/gYwrl7OcKktP6B12CY6b7dnQixDpTlCRETRMlQMyRr1yFiAQksJgVrcI1e1QOGJ40z75uKsgdncVwPROZ2GC05DKr4kyZanRnNdIckLlB/n8u3Lo0xdwXoD6AjIl6svON/oZRxohxEP4GnAcjLXCVNswX3gjyw08g+xPA1/d5AyucWF46atIDRZNgnj6Buca7s8gT5ut0Om3Ct+NKqKBn1wGWAxfVtmkg4O/N5zDCVCRCc1Wd2VV1jkkgldVFN3ofNe6TEO6mmD8n/WIG/IoBzXB/57+fIZEJX17KnAxlQcpyOu1U7TfIjibhzJQV6f7cht9nptwdWsX7hrPhbj0hDckSaeq9RuY94KfWHgFQmtzdMqps/r94Bw8HRtOta21cMJdbfFiBjpsgBgt0k7QvRQwfYw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR12MB4553.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VUVjWWd1bUd3Vjk3TWZyTFdDTnEvSU5nUVJBaTVxNWFJYVp3QkRtYUVpZnJ0?= =?utf-8?B?MDExUWNUK0RBMGszNXAzL2RYTU5DYkNSUjVwQUZVVjhyZVVzdjNDUjF5elpp?= =?utf-8?B?aGRsZnBvUTNtQzZJNThyT0pqSFdyYWZ1QXMyQWs4NWdBQUJxZkU2NVA3T25m?= =?utf-8?B?aGhYdTMyUmNlYXZISGQvWEVYTGQzNVZyejY0UmRyNG1mZnoyM0VoRlVSSEdE?= =?utf-8?B?UXQ5MGY2cmx1WkEyL0NYU2tnbXVQMGpDY2phK1dkRGlPL1A0SytSaXhVR3dZ?= =?utf-8?B?NjdHNHhoSWxBYTFicUYrc3dUWG04TVYrUU1wQjdkRmllcUhnelNFNlYrRUJR?= =?utf-8?B?R01waU5LNDhPUW5JNmlqNVlIaW50REJIbjljQThiSENnRGY2c0lTUnQxRGdT?= =?utf-8?B?Nkk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ource: MW3PR12MB4553.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Mar 2024 20:06:34.3527 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F/jkS5H4ZYM+QBBzgD1ZAInQngUR6T8tdBlwscF1/yAhHdvNhrHxYgG6smlMP2N5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7410 On 3/8/24 15:38, Tony Luck wrote: > reset_all_ctrls() and resctrl_arch_update_domains() use on_each_cpu_mask() > to call rdt_ctrl_update() on potentially one CPU from each domain. > > But this means rdt_ctrl_update() needs to figure out which domain to > apply changes to. Doing so requires a search of all domains in a resource, > which can only be done safely if cpus_lock is held. Both callers do hold > this lock, but there isn't a way for a function called on another CPU > via IPI to verify this. > > Commit c0d848fcb09d ("x86/resctrl: Remove lockdep annotation that triggers > false positive") removed the incorrect assertions. > > Add the target domain to the msr_param structure and > call rdt_ctrl_update() for each domain separately using > smp_call_function_single(). This means that rdt_ctrl_update() doesn't > need to search for the domain and get_domain_from_cpu() can safely assert > that the cpus_lock is held since the remaining callers do not use IPI. > > Signed-off-by: Tony Luck > Tested-by: Maciej Wieczor-Retman > Reviewed-by: Reinette Chatre > Reviewed-by: James Morse Reviewed-by: Babu Moger