Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp21617rdb; Mon, 22 Jan 2024 10:34:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtX0egtrvhf2XjW6Q2+CjPYwcQj1ND7q0EDJpOTPdFyknFrbOyuLejjdDXtOIRYkxsKbhn X-Received: by 2002:ac8:5a10:0:b0:42a:39df:aa84 with SMTP id n16-20020ac85a10000000b0042a39dfaa84mr4155513qta.22.1705948456931; Mon, 22 Jan 2024 10:34:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705948456; cv=pass; d=google.com; s=arc-20160816; b=cKJEeqyCbHVSpyulzCV7w8UCwCHDQvEjew9pOGJbeNvzHPq0ZGzVXAuqtaQ0pfvCjH y5dJ2PGjcH3os3WTv8HT5t7eoAi7zWLsDp4dMloOdJ5jQHzJUZFoYOT7M22d0EmsY985 yHSRlPErhWIih4sRIgMBgYDWNcmzHI5+Xlr8rsjfPP/k8+1jKjH7cvnmlX1cVhRoxa5m bB81cmVeZe9dEB80Fa5GP9VjTjw96uj5YqAm7c4YqL+kF2aUS+bbXHxoBvEcTNo8Ts0j GnI9lYwHoFZCbLNMr3NAiqwAU7yc8zPti82U18u8vJ7Q7FzEu/nZiRtsPiCkbK9RdQio S//A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Pi4h6swE+i8pYTDukMHiZgPIdJvq2y30molNGDLekRk=; fh=HBNJCb1O5m4cQgWGcwqoKY3KTbKsr5rANYvH6uVWzvA=; b=kqfvRTYrooPVzfNU2KkvQpnIdR46QmeUIV8XL0E1B+EXxUiYlxIxigaeeObqSA6bD1 ofH37yq7scDRl9xbrm4FwRLL8hEyAMnrRQNUuyvCXm63KePdMFphv/IZkdV3fOLjuq6G NQGqgZRxHHdj4UwYsLfNquLe7Qp09sxqfbhG2Em1W+6GqpWjx844CeZ3dBSw13cJ8Sm6 sekPe9i3KXX/Ls4lvDAf2IgFba4ZFMpCmyGT7gKjSLm++L/XLpvxvuNLNOxFWzoJZ39f ZYKFjOvwElWxZovpRj6G4/EO0EzdAHgNtOfpwLZbgFa+iYz2kepoZmBGePdYb3L0LyVq k9eA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-33901-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33901-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id k11-20020a05622a03cb00b0042a2380f296si6256848qtx.529.2024.01.22.10.34.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:34:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33901-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-33901-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33901-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A45911C28BB4 for ; Mon, 22 Jan 2024 18:34:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E9A2D5F84A; Mon, 22 Jan 2024 18:06:25 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11FB55EE9D for ; Mon, 22 Jan 2024 18:06:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705946785; cv=none; b=IQoWi2gF+5bEqPVPnMnV1n6PJlWJkE9dWnduW9v8DExr3xDxw4A0zwTUdsicGORU5kOpFXc1sIL0AKas6J4J2jOaLxp4Bem29tWvrYAFwNZSIUIr51vYl2TA39oKzivj8E9ZxYrbXIXBZaxuqcOTyzm/V3eSu/l9+Yl2eF3mmYU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705946785; c=relaxed/simple; bh=Pi4h6swE+i8pYTDukMHiZgPIdJvq2y30molNGDLekRk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Snl53cFx9dLxE78Zi0BR5NNCMtvMQ5vNMMs1HD6d+pG/eNtl/771vUjJUWKZ59TpbaYNad6wHN9orAcWP/dHSRnH/tqiT50amKz3PwqCfbMzvrZj4Zw3meAdMK3iHofwkIrf39Q7NMLsKPd4u16m4zzRyvt7FXgUR+b9KX53B3I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 7E4C9143D; Mon, 22 Jan 2024 10:07:08 -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 DB4913F5A1; Mon, 22 Jan 2024 10:06:19 -0800 (PST) Message-ID: <93c86af6-7eaa-4cd5-3599-34f2f033a1f5@arm.com> Date: Mon, 22 Jan 2024 18:06:18 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v8 13/24] x86/resctrl: Queue mon_event_read() instead of sending an IPI 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: <20231215174343.13872-1-james.morse@arm.com> <20231215174343.13872-14-james.morse@arm.com> From: James Morse In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Babu, On 03/01/2024 19:43, Moger, Babu wrote: > On 12/15/23 11:43, James Morse wrote: >> Intel is blessed with an abundance of monitors, one per RMID, that can be >> read from any CPU in the domain. MPAMs monitors reside in the MMIO MSC, >> the number implemented is up to the manufacturer. This means when there are >> fewer monitors than needed, they need to be allocated and freed. >> >> MPAM's CSU monitors are used to back the 'llc_occupancy' monitor file. The >> CSU counter is allowed to return 'not ready' for a small number of >> micro-seconds after programming. To allow one CSU hardware monitor to be >> used for multiple control or monitor groups, the CPU accessing the >> monitor needs to be able to block when configuring and reading the >> counter. >> >> Worse, the domain may be broken up into slices, and the MMIO accesses >> for each slice may need performing from different CPUs. >> >> These two details mean MPAMs monitor code needs to be able to sleep, and >> IPI another CPU in the domain to read from a resource that has been sliced. >> >> mon_event_read() already invokes mon_event_count() via IPI, which means >> this isn't possible. On systems using nohz-full, some CPUs need to be >> interrupted to run kernel work as they otherwise stay in user-space >> running realtime workloads. Interrupting these CPUs should be avoided, >> and scheduling work on them may never complete. >> >> Change mon_event_read() to pick a housekeeping CPU, (one that is not using >> nohz_full) and schedule mon_event_count() and wait. If all the CPUs >> in a domain are using nohz-full, then an IPI is used as the fallback. >> >> This function is only used in response to a user-space filesystem request >> (not the timing sensitive overflow code). >> >> This allows MPAM to hide the slice behaviour from resctrl, and to keep >> the monitor-allocation in monitor.c. When the IPI fallback is used on >> machines where MPAM needs to make an access on multiple CPUs, the counter >> read will always fail. > Reviewed-by: Babu Moger Thanks! James