Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp671107rwb; Wed, 28 Sep 2022 07:44:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4N8c9npmqMqZQ9JYu1lZsHvXagVbvuqqHCmL3hDJcVQ7eBi+SE/kb5m3IMOWk/jnUUAelP X-Received: by 2002:a05:6402:50cc:b0:451:bf26:8c51 with SMTP id h12-20020a05640250cc00b00451bf268c51mr34078367edb.336.1664376253253; Wed, 28 Sep 2022 07:44:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664376253; cv=none; d=google.com; s=arc-20160816; b=slTK88JlJ6xBxaViu26to1pAdJB+LF+25zcHxMOXl+xEEEgu9NalQZH+aUCPmOOP5s 7bU9jc4Ia+dPgu8GW1BJSyqaAcA3yiXN1Xao4vy3hTCH2N2zUc0SwtHBA+vNWN+RWna5 5CubRB+HgcaEq/518hzFtXFSZzih5rCGd7w5AsHVlad1d5FoVScgCwPQLYCaYjVLE4lC H1SrWYcK/JhER5IFe3JkPo6YGu1L0rSvGm/IgEdZXZq/xS3tTWCWQ5jXgrOXPuywnu1z HieYuzASNzNgB0mW3S/gDWxx6rcDrBrJbqZixkDzJkLhml4FIgHIydGtqbyTktVJbhDu zbKQ== 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=L8rHjI4Y5ey8w6pi+5uJXyR077yryob7XdCWe3RuR3A=; b=hABaG9pLqXcR0vKMQjTQZStCXHUVVzo0lQRQCbAklLTj0qLGTAI9tw6z0kH9kCad6z gBouUDI2JbBLpmI5D3Q+yhf7/GE6qBgc53sl8GGR5G9xyDhv4NEEli6zx+NTZ2yg687l ZTMo/9urtmqUSv+bUVjBHZljZkPAa+KtwKlcUWSlfF4qJEch1qPfaw+aS/VgaaM1c0pd 83qslpGUD8Wqkogjwx+jLK2ywKXb2VqOkil3qxc8bHbXahfAhOF/uXFc1/JM1aoo7ust r8XDNf++UdbCSOXxfjVaXt3ZIl5hzk0ztqud5ht4D0aaP/xjFrA3IesolBRPyyZGPpy4 jZLA== 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=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id go35-20020a1709070da300b007826f117d6asi4887287ejc.281.2022.09.28.07.43.44; Wed, 28 Sep 2022 07:44:13 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234050AbiI1OJE (ORCPT + 99 others); Wed, 28 Sep 2022 10:09:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234205AbiI1OJB (ORCPT ); Wed, 28 Sep 2022 10:09:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 71F009E0C5 for ; Wed, 28 Sep 2022 07:08:59 -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 8E5AA1595; Wed, 28 Sep 2022 07:09:05 -0700 (PDT) Received: from [10.1.197.78] (eglon.cambridge.arm.com [10.1.197.78]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 84C543F73D; Wed, 28 Sep 2022 07:08:57 -0700 (PDT) Message-ID: <7728c846-0077-a34d-7fdc-bab9743edc4f@arm.com> Date: Wed, 28 Sep 2022 15:08:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] x86/resctrl: Clear the staged configs when destroying schemata list Content-Language: en-GB To: Reinette Chatre , Shawn Wang , fenghua.yu@intel.com Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org References: <1664247269-41295-1-git-send-email-shawnwang@linux.alibaba.com> <80d6238b-223c-e60a-6930-24a981d9dd0c@arm.com> <2728c354-ac75-be4c-66ad-86ebd9c50248@intel.com> From: James Morse In-Reply-To: <2728c354-ac75-be4c-66ad-86ebd9c50248@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 27/09/2022 22:21, Reinette Chatre wrote: > On 9/27/2022 6:06 AM, James Morse wrote: >> On 27/09/2022 03:54, Shawn Wang wrote: >>> The problem can be reproduced by the following commands: >>> # A system with 16 usable closids and mba disabled >>> mount -t resctrl resctrl -o cdp /sys/fs/resctrl >>> mkdir /sys/fs/resctrl/p{1..7} >>> umount /sys/fs/resctrl/ >>> mount -t resctrl resctrl /sys/fs/resctrl >>> mkdir /sys/fs/resctrl/p{1..8} >> >> Thanks for the reproducer - but I don't see what could set have_new_ctrl in this sequence. >> You can't call apply_config() to set CPUs in the mask without that being set. >> >> Creating a new control group, (your mkdir step) shouldn't touch the hardware at all, as it >> should be left in its reset state from the last umount(), or setup. > > There is an attempt to configure the hardware in the mkdir path: > rdtgroup_mkdir()->rdtgroup_mkdir_ctrl_mon()->rdtgroup_init_alloc()->resctrl_arch_update_domains() Aha! I'm not sure why my grepping around didn't find this. This is a path that doesn't memset() the staged config first, so that explains it. [..] > What do you think about clearing the staged config within resctrl_arch_update_domains() > after the configuration is complete and there is no more need for it? That may reduce > complexity where each caller no longer need to remember to do so. > I see "staged_config" as a temporary storage and it my help to understand the code better > if it is treated as such. Yup, that would it with the idea of the value being consumed by resctrl_arch_update_domains(), which is how I think of it. Thanks, James