Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6173716rwi; Sun, 23 Oct 2022 19:49:09 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6JoQwTeqXDa0m6oDSYU+1rvBN5URFHrN1nTUsjgsn9eQq85KUEDnpwmdXQzFM7K3ZJfhrJ X-Received: by 2002:a05:6402:268a:b0:45c:c38d:ed70 with SMTP id w10-20020a056402268a00b0045cc38ded70mr28673421edd.62.1666579748879; Sun, 23 Oct 2022 19:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666579748; cv=none; d=google.com; s=arc-20160816; b=dezbRV4TRdLew+lLsp+S2vjejPpjAJhXkDCJQDC6mhGAPOZdfSz40VTLgSU4rT1zP/ WS4hVeplgqqgbIjK0IxIPmOtGpjalJ0qIvEz42agVWAnKy9TwO7BW8z6Hy4xljqtj7XX u9+pcfRbcwAgbjjeDNKQzcbZgbv/ykVX4RE7pmx9A7D0p19ltlTgwFOmKEmhmtS05GGS Mf0+BRdcsCSqxs5g1Hv7nTp0qkt/GhMZG/y6lmdCnAXf/KWyt3NdDZkWC73034hhzVIt 9o3M5uwz5hnn6u6fgjxVJpJEMEzCEV1OoAxlapg1naV/KmbNcbsY6iCMbOYZ7FYaTu3J vfAQ== 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:cc:from :references:to:subject:user-agent:mime-version:date:message-id; bh=wJuqKs4gAQYUJFsY9A146Kz5XGqzFd4uBXqClhJQqlA=; b=tsdKtK2LPychBomsEI8H/qkdv54YHZJR99iGXBvkdbEaRH9CsHOENcwuz8CQPrKnPU poW4Ly6bDUYF3S2C0EGNKxvMmEY7mIQYceOCK6lQaFXZVXLqqrnlwFpdMSMOYcqG9vIH B4LSALfJQrfk2h1YXEThKBo+vfwQrXdeaiC6VmKoXMUCzT3j7fcWTU6j7ywwPrYNKqAO rgqVFqxFm2anRJOp8t0Qo3zbCNVZD0Ru4cNDtA5oOyi3l7+mRawiqSepY47w0aWMgrHO CGTbWYwCyLU85sn+4GlEhQyzA7hAimdtdXp7/NfhQqXB2wg5H1AJ6tcTkODwjQNvEQAK DWtA== ARC-Authentication-Results: i=1; mx.google.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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr16-20020a170906d55000b0078372cf516csi17919530ejc.229.2022.10.23.19.48.43; Sun, 23 Oct 2022 19:49:08 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbiJXCcH (ORCPT + 99 others); Sun, 23 Oct 2022 22:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbiJXCcG (ORCPT ); Sun, 23 Oct 2022 22:32:06 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EE4967153 for ; Sun, 23 Oct 2022 19:32:04 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R861e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=shawnwang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0VSrI8aC_1666578719; Received: from 30.97.48.136(mailfrom:shawnwang@linux.alibaba.com fp:SMTPD_---0VSrI8aC_1666578719) by smtp.aliyun-inc.com; Mon, 24 Oct 2022 10:32:00 +0800 Message-ID: <2cdfbe28-01cc-926d-2f6d-2a974a4c5a74@linux.alibaba.com> Date: Mon, 24 Oct 2022 10:31:56 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH v2] x86/resctrl: Clear the stale staged config after the configuration is completed To: Reinette Chatre , fenghua.yu@intel.com References: <1665304608-120466-1-git-send-email-shawnwang@linux.alibaba.com> <7fa6ed4e-abae-85fb-4e95-8c73755a4263@intel.com> <86fc22a2-e779-b7ab-67d6-a3aff975ae56@linux.alibaba.com> <30637459-7419-6497-6230-b13c73a947de@intel.com> From: Shawn Wang Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, James Morse , jamie@nuviainc.com, linux-kernel@vger.kernel.org In-Reply-To: <30637459-7419-6497-6230-b13c73a947de@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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 10/22/2022 2:05 AM, Reinette Chatre wrote: ... >> It may not be enough to just clear staged_config[] when >> resctrl_arch_update_domains() exits. I think the fix needs to make >> sure staged_config[] can be cleared where it is set. >> >> The modification of staged_config[] comes from two paths: >> >> Path 1: >> rdtgroup_schemata_write() { >>     ... >>     rdtgroup_parse_resource()     // set staged_config[] >>     ... >>     resctrl_arch_update_domains()     // clear staged_config[] >>     ... >> } >> >> Path 2: >> rdtgroup_init_alloc() { >>     ... >>     rdtgroup_init_mba()/rdtgroup_init_cat()    // set staged_config[] >>     ... >>     resctrl_arch_update_domains()        // clear staged_config[] >>     ... >> } >> >> If we clear staged_config[] in resctrl_arch_update_domains(), goto >> statement for error handling between setting staged_config[] and >> calling resctrl_arch_update_domains() will be ignored. This can still >> remain the stale staged_config[]. > ah - indeed. Thank you for catching that. > >> >> I think maybe it is better to put the clearing work where >> rdtgroup_schemata_write() and rdtgroup_init_alloc() exit. >> > > It may be more robust to let rdtgroup_init_alloc() follow > how rdtgroup_schemata_write() already ensures that it is > working with a clean state by clearing staged_config[] before > placing its staged config within. > I want to make sure, do you mean just ignore the stale value and place the clearing work before staged_config[] is used? If so, maybe the only thing the fix should do is to add memset() to rdtgroup_init_alloc(). Thanks, Shawn