Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3241277rwb; Mon, 7 Aug 2023 10:12:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElp/op/mJSY98l0my4rQc0CyCAYhiOlB9cYusBSonWiK+PzOIreWeVvs8L+/GyboRa04Dn X-Received: by 2002:a17:902:cecf:b0:1bc:239:a7bd with SMTP id d15-20020a170902cecf00b001bc0239a7bdmr8993524plg.6.1691428356822; Mon, 07 Aug 2023 10:12:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691428356; cv=pass; d=google.com; s=arc-20160816; b=HrKXYopsjOC0iNX/Vaexy9+umCypU7inDCyLK8LCzlYNNTYpbS8YIoIfHP3Iyk4YFS 2KspH9hq0atjMLnf6LIF5+FiOWGwZVcAARCBoSxmYd6OqOq955E+QG/Qm56c4aryMFWW 3fxUz3mTs+7b4Ciq3sbJVBMbVP6LVTyDyPcfwxSljAHj4CgWZochTHNL3UxM5h1bC5lb yPBO51kGk6y/94di41lK/kJKkS0s/6dPM1bqU9ORX4jmboFOSPML1DyBJPa6aOuhLYQp dBxyvleqiKmRz0KKoGrO5Hxg1jfz4KaD3MgJy/dh5bczDLzmMu6ZCZqmhMUl/F71Pn8Y tgkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject:reply-to :user-agent:date:message-id:dkim-signature; bh=dyuCoYj8aa1WJtqqdBooRvy3Xn5kTyvGlnIXqR6LQlo=; fh=XPFL7/dn+rc4QvODfqClvcJhW9xVBnJx900baCh1t90=; b=ISUv1FJVC3ckSIng/NRAJXOkQo9uLr7dooMdhCCwG6gG4a76Xm5GPi10QDDytVgN32 xcOb4WMfBz3y0qrcCGZNdXRzZ7m75SQCJTNkpQ26Z/F+ALfC4pKe4wb6BtUfwnPmCL6w lfwb5pXEtLMkNXQ8Fi/el+zz/JZXn2U6AX++1+7NKgSz+Y0s2PuCJD/pPuknqJjnUW/j j5+KbbuvTmdmU/TKTMpdxeotH7b9AMi1sEfef5bNBA5fy60E5ANkE9DBgwS5z4Fdzt+1 aCfoZMK1E8iVekieJE9F02qNEPHJJ9WliRhipd6NlGIltTmYj011UpBgrs1Q3mtXV8RP wuVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TAVBJ2Ca; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a170902789600b001ab1d1a6802si3829899pll.1.2023.08.07.10.12.25; Mon, 07 Aug 2023 10:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TAVBJ2Ca; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbjHGQTf (ORCPT + 99 others); Mon, 7 Aug 2023 12:19:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231432AbjHGQTa (ORCPT ); Mon, 7 Aug 2023 12:19:30 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4812D171E; Mon, 7 Aug 2023 09:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kJfHELfIl0rWnG2JIj6MwS5S49OO8HAMc2uPSH+HibrKBzRhJ2hvu2SGoMbHbXydzgGs04C2UBN9URVpFwWFcO1SqdRv0qwKdhof7D0gzUR/OfW9kP28/79xNdytMmIRMybDkdbHSFagMBxFTtlguBV0UnqoMfw0RfAaXrHJhzroaf0CZTuXISPnrOGzb4mLpRZVD85lHueCFKWzNYDdV63cjM1uQNtRmxSJFoDHcQVVYcsHn9vC3KRCtSWko2/R60xYGQBp4alp+mn7Hj83tvV429rKilVMwXyrRKqUL0PuQG3B2hEdFFFHRGynKKHibMJnIwQgZwXqpG9JKwGoGA== 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=dyuCoYj8aa1WJtqqdBooRvy3Xn5kTyvGlnIXqR6LQlo=; b=KH5NaNf9MYA1oDVFRfLa9gFFkOi/5eHwnU/FCv1/KPTr2aGIdClmbWz2FCTZR7XOmPfFkONYX1NrqZ92yWUdXN6sSJtUviPVaaUWbEp6QBr+fXzMvojJsv2fTUM6BA5Fh8MYxsgzOACtO5hJ670W6DOdCmGTRxf1HEV1AOP7L0TaVgE11LxHtDr1wrngXy0GUz5R0/dIdA5KzrnButRp2ZopV+SE/U8/fgfWYIREcQJR1yr/i6zJvARbxLcfrH26tJdjA0LiV8x5JcTECL7C19IJZXqGuuLHlUx2YQc5Sdnq/8oZVLOqxySWcfDI/GCbPl4CTiJTUFm1cddphNnY/g== 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=dyuCoYj8aa1WJtqqdBooRvy3Xn5kTyvGlnIXqR6LQlo=; b=TAVBJ2CanluNiQAYFmi4jFDC2JzWqb8vRrwTMNfazb6ciA5Wg8TsDI7cltKJaK7TP4CVgKr/fhQ5xvS+UBEKGYPp4WtL0bmEJfVz/awx1z+HjESvSs2x/8iVStgu2lwkICrUxdsclrmkcbHC2p6Kb54y+vd10a90aY6Y+w1t0Qw= 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 IA1PR12MB7520.namprd12.prod.outlook.com (2603:10b6:208:42f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.25; Mon, 7 Aug 2023 16:19:25 +0000 Received: from MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::ae3b:f153:4d30:73a8]) by MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::ae3b:f153:4d30:73a8%7]) with mapi id 15.20.6652.026; Mon, 7 Aug 2023 16:19:21 +0000 Message-ID: Date: Mon, 7 Aug 2023 11:19:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Reply-To: babu.moger@amd.com Subject: Re: [PATCH v6 5/8] x86/resctrl: Unwind the errors inside rdt_enable_ctx Content-Language: en-US To: Reinette Chatre , corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de Cc: fenghua.yu@intel.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, paulmck@kernel.org, akpm@linux-foundation.org, quic_neeraju@quicinc.com, rdunlap@infradead.org, damien.lemoal@opensource.wdc.com, songmuchun@bytedance.com, peterz@infradead.org, jpoimboe@kernel.org, pbonzini@redhat.com, chang.seok.bae@intel.com, pawan.kumar.gupta@linux.intel.com, jmattson@google.com, daniel.sneddon@linux.intel.com, sandipan.das@amd.com, tony.luck@intel.com, james.morse@arm.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, bagasdotme@gmail.com, eranian@google.com, christophe.leroy@csgroup.eu, jarkko@kernel.org, adrian.hunter@intel.com, quic_jiles@quicinc.com, peternewman@google.com References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> <168980892326.1619861.2405779251348138586.stgit@bmoger-ubuntu> <9fd70ef3-ca90-65e3-4746-7d574bdd159b@intel.com> From: "Moger, Babu" In-Reply-To: <9fd70ef3-ca90-65e3-4746-7d574bdd159b@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SA0PR11CA0129.namprd11.prod.outlook.com (2603:10b6:806:131::14) To MW3PR12MB4553.namprd12.prod.outlook.com (2603:10b6:303:2c::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PR12MB4553:EE_|IA1PR12MB7520:EE_ X-MS-Office365-Filtering-Correlation-Id: 54417a61-0455-4154-7527-08db97620ede X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lmzQeq0css0azGeYCdZnEWwvVPWPOOS9b9oJgj77Sl228+zJ1x4ctnbeb+mtKW956aoPpXM1wNUw16sdvhQttMTtRpbfOkGvs7tx2WssmiHQWsYgm8/zh6vWanyoMlHl3qNfaofq3pmHICzX4xO6pAHacAicETM2DqhQgGQe82cT2ikUCPOQzRyx5bbdvZdd5C3DljQkm3Yl5MDMsD9AfDqDpTTPIP3ZjrjuIOseGxgeAedt4hsTk3J8nUDUSW0IvU09aGfZsCIWlRp8DlWTqvEZsmmyP/GP2P+izKPWZwFdAnvrzhcBFE2ExlUIKqxr0SVmV2g/IIpCXmSRgmoY/iojp6e3mu5Sk9HG04URt52TV6b8AQU2/N2wkHmfVzpd0aK39pctVWhKhpLCJkjRujBervY312kQM4FnAvP0Ph06IOeKlBWyRbpk4Gg5DJjIcMGANGEC3Zo6gJn9EUa5inR154rNxvOSXvkpzkiwVXOuk1XP52yeSVYzzNmwarmR4VwYR6cw+Ju+sp5XqoneeHCZyhYWvdwhq0TRxlAKkbaB2DO3LgRgsDP49HGmAYm24M7ljR8FXEc3GlLf6MsRUdw6T1efmg7xd6wCWwXUBhXqci8GJxeyppB9D7N9zxJrBf8Qmrja8BCNNtvXO+9yRw== 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:(13230028)(4636009)(396003)(376002)(39860400002)(346002)(366004)(136003)(451199021)(1800799003)(186006)(2616005)(6486002)(6512007)(478600001)(86362001)(31696002)(26005)(36756003)(6506007)(53546011)(41300700001)(316002)(7416002)(3450700001)(5660300002)(8676002)(8936002)(7406005)(38100700002)(4326008)(2906002)(66556008)(66476007)(66946007)(83380400001)(31686004)(66899021)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?anhUM0ZoaWJ4dit4ZlNTMGp2QVpVUUZ1amRvUGgxYzU5cktJbGc3OFVib21C?= =?utf-8?B?K2V3L0tJWE45ZkxTQXZsaWV0VGJrNVFNTmlSZTg0SGJickxVbzlxSGZKTStz?= =?utf-8?B?RmNZL0xEQWdPY1dKZnBpZExCRjZJd0l0N2MycFk3Z0UwWlRJVFdF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1E0cmt6OGVTWjFnNytSQm5GREk1cE1CZ1R2UHVDa1hhV0NtU0Y1aXZS?= =?utf-8?B?M1JpWlF5aXZLU2s2SnFabzdEZFR5QnN0a28xaDhjdUoyWDVCWklpVFBmUG1q?= =?utf-8?B?cXhwWWFDVEJCcnhMME5Jdm4zelpXNmkxV2VwSFN3SG1WZzE5MFEyRFB4WXd0?= =?utf-8?Q?E4Xk=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54417a61-0455-4154-7527-08db97620ede X-MS-Exchange-CrossTenant-AuthSource: MW3PR12MB4553.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 16:19:21.7370 (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: YkrTSv+AsZDz92DynA7qRWRn/3IuLDr8w9kMqeSNckCW1bft79dvonRPVCIGqU+E X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7520 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Reinette, On 8/4/23 15:41, Reinette Chatre wrote: > Hi Babu, > > On 7/19/2023 4:22 PM, Babu Moger wrote: >> rdt_enable_ctx() takes care of enabling the features provided during > > "rdt_enable_ctx() takes care of enabling" can just be "rdt_enable_ctx() > enables" Sure. > >> resctrl mount. The error unwinding of rdt_enable_ctx is done from the >> caller rdt_get_tree. This is not ideal and can cause some error unwinding >> to be omitted. >> > > Please consistently use () to indicate function names (in > changelog and subject). Sure. > > "This is not ideal and can cause some error unwinding to be omitted." > is a bit vague. How about (in a new paragraph): > "Additions to rdt_enable_ctx() are required to also modify error paths > of rdt_enable_ctx() callers to ensure correct unwinding if errors > are encountered after calling rdt_enable_ctx(). This is error prone." Sure. > >> Fix this by moving all the error unwinding inside rdt_enable_ctx. > > "Fix" creates expectation for a "fixes" tag which is not needed here. This > refactors code to simplify future additions. Sure. > > Even so, I do not think this solution addresses the stated problem (more > below). > >> >> Suggested-by: Reinette Chatre >> Signed-off-by: Babu Moger >> --- >> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 31 +++++++++++++++++++++++-------- >> 1 file changed, 23 insertions(+), 8 deletions(-) >> >> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> index 3010e3a1394d..9a7204f71d2d 100644 >> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> @@ -2381,15 +2381,31 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) >> { >> int ret = 0; >> >> - if (ctx->enable_cdpl2) >> + if (ctx->enable_cdpl2) { >> ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, true); >> + if (ret) >> + goto out; >> + } >> >> - if (!ret && ctx->enable_cdpl3) >> + if (ctx->enable_cdpl3) { >> ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); >> + if (ret) >> + goto out_cdpl2; >> + } >> >> - if (!ret && ctx->enable_mba_mbps) >> + if (ctx->enable_mba_mbps) { >> ret = set_mba_sc(true); >> + if (ret) >> + goto out_cdpl3; >> + } >> >> + return 0; >> + >> +out_cdpl3: >> + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); >> +out_cdpl2: >> + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); > > Be careful here. There is no dependency between L3 and L2 CDP ... > if L3 CDP was enabled it does not mean that L2 CDP was enabled also. > Similarly, if the software controller was enabled it does not mean that > CDP was also enabled. > Since resctrl_arch_set_cdp_enabled() does much more than just change > a flag value I think these should first check if it was enabled > before disabling the feature. Yes. Agree. > >> +out: >> return ret; >> } >> >> @@ -2497,13 +2513,13 @@ static int rdt_get_tree(struct fs_context *fc) >> } >> >> ret = rdt_enable_ctx(ctx); >> - if (ret < 0) >> - goto out_cdp; >> + if (ret) >> + goto out; >> >> ret = schemata_list_create(); >> if (ret) { >> schemata_list_destroy(); >> - goto out_mba; >> + goto out_ctx; >> } >> >> closid_init(); >> @@ -2562,10 +2578,9 @@ static int rdt_get_tree(struct fs_context *fc) >> kernfs_remove(kn_info); >> out_schemata_free: >> schemata_list_destroy(); >> -out_mba: >> +out_ctx: >> if (ctx->enable_mba_mbps) >> set_mba_sc(false); >> -out_cdp: >> cdp_disable_all(); >> out: >> rdt_last_cmd_clear(); >> > > The problem statement in the changelog was that rdt_get_tree() is > doing error unwinding of rdt_enable_ctx(). Looking at the above it > seems that the problem remains ... callers of rdt_enable_ctx() > still need to know all internals of that function to do error > unwind correctly. Could it perhaps be made simpler with a new > rdt_disable_ctx() that undoes rdt_enable_ctx()? New additions > to rdt_enable_ctx() would have more clarity where changes are > needed and callers only need to call a single rdt_disable_ctx(). > Yes. We can do that. -- Thanks Babu Moger