Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp707108ybk; Fri, 15 May 2020 11:24:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHoA5iCaXKm5MdPqlvbad2NgkQYKr9FiMbDhZjBfWVztN+6LdzCS0tR6/y7ovCvPT1mlWj X-Received: by 2002:a50:b044:: with SMTP id i62mr4307572edd.214.1589567054142; Fri, 15 May 2020 11:24:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589567054; cv=none; d=google.com; s=arc-20160816; b=YlIHb5jTWIpKXSh+8VBwSwCR6Q07jslvLyIbcSLfKYcplJfKnueEVjnT+39Z32xpVz 4axkWIDapZ+GJpAqEVst/C6Q4YEH24TvV7U/xhJkHF7nUERQsvJcCDlIZ1h6Phjytuhz pS7suSQoMr2iYJKEfL02O7PFNFJKkmI+JmZcJ2PilwpqfqGmzdBO2gKKswvTf+xaoflQ tUyo88lkMNTulK0JpUEIYRmaCuS6MOd/ElnB2QEJqu3lMvrtPahcitECe03nlu5+8S03 dxfwiwsT2t75miQNIvjAFD5fGZ1WuHj0Qr2Ub2kk3cFaxyDR6bGuVY6SixFqNHwtYkS9 iEZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=y80XOaitNx0mE8lVexpYToEKMsuZo5V/cvY5XZXqd9E=; b=rlioTspP75nGQuEkwijpYfqBK4nQH7hPd4RIMO9+tqhArZ/6C94T5svfGdlVrR5iVJ 32A6Q7EVLgh1rA7tdk7ODR4Q9Mu7ps86SPDgbv4Ci4UfL9BrqRdVomMF32vCAGMtaplI 7EOuVJ+dMOdxzfA1hD5Ff/iqKPuhwMKajfUrCxlnL3o8xA0Ny3rINpcft5m116EQfo/u K9QecJxQ6hWuo9CSIRZhYlbG7I2l5j42hzqzgSTqtbX9xSV3KGiPb5h9Gv/VMmkacMul dOYcnsmWqJ2AB+EjKU7FKa/gwTIq7cSfKw+H18g6u8a/jFGnRIOOqWswDgWu3JeoCjbK 9WWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gu17si1753551ejb.26.2020.05.15.11.23.50; Fri, 15 May 2020 11:24:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbgEOSWK (ORCPT + 99 others); Fri, 15 May 2020 14:22:10 -0400 Received: from foss.arm.com ([217.140.110.172]:60726 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbgEOSWK (ORCPT ); Fri, 15 May 2020 14:22:10 -0400 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 EF2591063; Fri, 15 May 2020 11:22:07 -0700 (PDT) Received: from [192.168.0.14] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CB72E3F71E; Fri, 15 May 2020 11:22:06 -0700 (PDT) Subject: Re: [PATCH v2 09/10] x86/resctrl: Add arch_has_sparse_bitmaps to explain AMD/Intel CAT difference To: Babu Moger , Reinette Chatre Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin References: <20200430170400.21501-1-james.morse@arm.com> <20200430170400.21501-10-james.morse@arm.com> <8383ddd9-5849-d948-c391-aeb0cc927423@intel.com> <980a693a-b823-96e1-9b4f-d7bbf4f09714@amd.com> From: James Morse Message-ID: Date: Fri, 15 May 2020 19:21:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <980a693a-b823-96e1-9b4f-d7bbf4f09714@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi guys, On 13/05/2020 21:03, Babu Moger wrote: >> From: Reinette Chatre >> On 4/30/2020 10:03 AM, James Morse wrote: >>> Intel expects the cache bitmap provided by user-space to have on a >>> single span of 1s, whereas AMD can support bitmaps like 0xf00f. >>> Arm's MPAM support also allows sparse bitmaps. >>> >>> To move resctrl out to /fs/ we need to explain platform differences >>> like this. Add a resource property arch_has_sparse_bitmaps. Test this >>> around the 'non-consecutive' test in cbm_validate(). >>> >>> Merging the validate calls causes AMD top gain the min_cbm_bits test top -> to >>> needed for Haswell, but as it always sets this value to 1, it will >>> never match. >>> >>> CC: Babu Moger >>> Signed-off-by: James Morse >>> Reviewed-by: Reinette Chatre >> >> The Intel bits do indeed look good to me but we should check the AMD >> portion ... I peeked at the AMD spec [1] and found "If an L3_MASK_n >> register is programmed with all 0’s, that COS will be prevented from >> allocating any lines in the L3 cache" ... so AMD does allow bitmasks of >> all 0's (Intel does not). >> >> Does MPAM also allow all 0's? Perhaps "arch_has_sparse_bitmaps" can be >> used to indicate that also? It does... > That is right. AMD allows L3 mask be all 0s. I will be great if this > property can be indicated it here. Thanks Ah, this is a bug I didn't intend to introduce! Intel has: |       if (val == 0 || val > r->default_ctrl) { Whereas AMD: |       if (val > r->default_ctrl) { So this empty bitmap is permitted today with resctrl. (and, its another try-it-and-see). I'll add an 'arch_has_empty_bitmaps', I don't think overloading 'sparse' to mean 'sparse and empty' is a good idea. Thanks! James