Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5918880rdb; Thu, 14 Dec 2023 03:37:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9R6fMzoYx0hhK5ebSXiXa4VMMOG54YdB8ecYsAdTYVr8H/OfJksid+dFFR/OoWPaee4ao X-Received: by 2002:a17:902:820b:b0:1d0:8fad:f18d with SMTP id x11-20020a170902820b00b001d08fadf18dmr9577857pln.95.1702553878546; Thu, 14 Dec 2023 03:37:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702553878; cv=none; d=google.com; s=arc-20160816; b=XJZc7shDK0uAfW32Yo5JJFx3wa45viktkTMjyEh6PBGZJ9sH0fW9TLYCvmMxNhyHbO 2NSwCWfD8qtm5eS3x3l4AovBGaFzw6NA60Qo7OghtlPvVe6+46pn+5eU/PUbK3h0cMU8 6NjMTHw9K1NuWdsl7rwls/vZ0mmU5Dm4ixNg+ntQo1G+5nuS5kh/eQYy6p5tJ0slSQTW oCfkRPYp/YbVvJ5iFpiq/gb+PfTrPmTRezMphthw4o+6DOJvxa1w164bRrk5ccnlZeTq EFvDxQ9aOA/DZSeyJra36bqhUDKA0buDfj51B82tQD4DvnMrvrpsb2DZ3M0UYrCAIAJs QE4w== 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=Fh/lUkfpLXuGaQ5SeYar7/ffwdbrWkUD2A+QsmhdB0A=; fh=HBNJCb1O5m4cQgWGcwqoKY3KTbKsr5rANYvH6uVWzvA=; b=zw7/RnZKeokx1rAM6w4QaAJfenv/Ax2H5tEeVORrRg5Ve2afm5bLNX2uZKAlVE8Swq n2+3V1X+NrJcRBpMCstECKX5Z/8thja222bKQL51jS8HMW6Nm/bHJAqHH+dYq7u9Fbsk r76i3qLpQ2ZXSdeKRy7VpBz4wVv8u8fnUOZcXdpGGGDKk/99To7D60gOSQhE2Rt6tr0i yLpEfd5GDs7/IUs2Gc9ISLIubbS1VUK9CtuammvAU9Dj6QLGYAKEdWfn1vnjWfNNaCtQ IkLB+BQh1BCIEjGvPkOS7QdTmakjErHPNQqeT/ORvr1Qn7PRHGCI/BfUyEP6yJxmrvrC aHVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id q7-20020a17090311c700b001d0d3795b3fsi11324252plh.284.2023.12.14.03.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 03:37:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 023828106F46; Thu, 14 Dec 2023 03:37:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1444027AbjLNLhZ (ORCPT + 99 others); Thu, 14 Dec 2023 06:37:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444030AbjLNLhS (ORCPT ); Thu, 14 Dec 2023 06:37:18 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 89AEBBD for ; Thu, 14 Dec 2023 03:37:24 -0800 (PST) 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 D29DAC15; Thu, 14 Dec 2023 03:38:09 -0800 (PST) Received: from [10.1.197.60] (eglon.cambridge.arm.com [10.1.197.60]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4C25D3F738; Thu, 14 Dec 2023 03:37:21 -0800 (PST) Message-ID: <9356e696-f88d-a797-c0b3-0249635902fd@arm.com> Date: Thu, 14 Dec 2023 11:37:19 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v7 11/24] x86/resctrl: Move CLOSID/RMID matching and setting to use helpers Content-Language: en-GB To: babu.moger@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , 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 References: <20231025180345.28061-1-james.morse@arm.com> <20231025180345.28061-12-james.morse@arm.com> <9ea2218e-3f0c-4e62-97f7-1d0b1f57b46d@amd.com> From: James Morse In-Reply-To: <9ea2218e-3f0c-4e62-97f7-1d0b1f57b46d@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Thu, 14 Dec 2023 03:37:55 -0800 (PST) Hi Babu, On 09/11/2023 20:39, Moger, Babu wrote: > On 10/25/23 13:03, James Morse wrote: >> When switching tasks, the CLOSID and RMID that the new task should >> use are stored in struct task_struct. For x86 the CLOSID known by resctrl, >> the value in task_struct, and the value written to the CPU register are >> all the same thing. >> >> MPAM's CPU interface has two different PARTID's one for data accesses >> the other for instruction fetch. Storing resctrl's CLOSID value in >> struct task_struct implies the arch code knows whether resctrl is using >> CDP. >> >> Move the matching and setting of the struct task_struct properties >> to use helpers. This allows arm64 to store the hardware format of >> the register, instead of having to convert it each time. >> >> __rdtgroup_move_task()s use of READ_ONCE()/WRITE_ONCE() ensures torn >> values aren't seen as another CPU may schedule the task being moved >> while the value is being changed. MPAM has an additional corner-case >> here as the PMG bits extend the PARTID space. If the scheduler sees a >> new-CLOSID but old-RMID, the task will dirty an RMID that the limbo code >> is not watching causing an inaccurate count. x86's RMID are independent >> values, so the limbo code will still be watching the old-RMID in this >> circumstance. >> To avoid this, arm64 needs both the CLOSID/RMID WRITE_ONCE()d together. >> Both values must be provided together. >> >> Because MPAM's RMID values are not unique, the CLOSID must be provided >> when matching the RMID. > Reviewed-by: Babu Moger Thanks! James