Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp71204rdh; Wed, 25 Oct 2023 16:42:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzrpPMMMHQcIFlNqu7NPqEII3K+bhaEwTdlT9xG49UoSJhelRen2DRijf35u0hNbaS4DHz X-Received: by 2002:a81:8443:0:b0:5a7:d73d:42cd with SMTP id u64-20020a818443000000b005a7d73d42cdmr17798609ywf.20.1698277336538; Wed, 25 Oct 2023 16:42:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698277336; cv=pass; d=google.com; s=arc-20160816; b=WFZ1Pgks8LkKleLmMP0MeO5hbmdQWZ9tLjz6fljyIkzIH2IuCcx3QSB6H+dePgktY0 PKJE5xEFsEEPErw7eA5PopLnvD2mvTE3MbrTFYe2DjO/k6CLRQgr07wX9C3BrrO8j6As qFQxq/BXDv+h1H7pErEpalEDiFR5RCpG6nDMyR+e4V37C/ZCNmewXVeyGFCLh3LdALPO AoZxmx9kHpd2BwG6syOIbZe8kJf/z81jCPWc5kVtdPKe6wcDiybKY/Yz6JgWQSNjJ/to cflIjTB81KZTLAgEVDGM7bF3AkseT0Km7G9AR4J+aRP7WOTum+wobbrXxdkS+AjKHsYR Xt0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject:reply-to :user-agent:date:message-id:dkim-signature; bh=zfI3Is2whQXCSWrqhZp0+ykGnrwvaG6n7aEyPh0ljGQ=; fh=nqurGdvtWXFujGVek3D/aG+GZ+fr+ChT+Vi1eQNop84=; b=LN6D8Ln3MNJ9z7B/4CdqeBMjgO80W/oLfzVpObkk91IkOEGWyz/A0pWEZq3qrmSvlo CyjnaNOT/pfApk3AMRynxvomk3o5eIuq9UtW/nd6KMCTaqH0w6fjZGHC0+401Z5Z3Lwc X7K3UdisTrUG0GCnYpJoS1sdBTmsB6YWpd2FQ+VeSCWLCwVDS6s417rT+8+FwpKrD13+ PzVt6kZp5bNMFXf5VoVjC/AotmbWVWTBlQO09YTFjl+u73eNTEsdHwRL8775BCk+KnBH Ij+70MRd/LD3G7r869IijCznVDiK3itYNuWFQzRPln42VNFByJCKy9u3sUi6ns8qH7/u Y8GQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4NF4Xkog; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id z3-20020a818903000000b005a7bab02efcsi12295440ywf.112.2023.10.25.16.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 16:42:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4NF4Xkog; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 88B2B8185979; Wed, 25 Oct 2023 16:42:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbjJYXmB (ORCPT + 99 others); Wed, 25 Oct 2023 19:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjJYXl7 (ORCPT ); Wed, 25 Oct 2023 19:41:59 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2069.outbound.protection.outlook.com [40.107.93.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 108D6182; Wed, 25 Oct 2023 16:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RoOCEq9u6TdixIhbeYWSl5+vsK6FkgRCozAXYujxUcS9deKEUSYJK8GbWewxwiKc8ZqWjzOBnqw20hc/jz/AgXkGRnC+qGXdjkpD4lWGjyUK85Ja3XjUuONRG60NrTEr1AzLHp7oXCYO0lo35PI+TEAOWCoxwRuW0urwmDbLKeAMulGhoczQ16R4MfgDj+etgo/0imsFtsQ8PXERWjdiqMPm6tKk4s2+/aimR5OIGMiyPAoqHgk8EJmIG13/o7tumJrrAuPxtVYkL5I0hDKCp/h8NSngVSjLSHHTE5AzLPdbLXWF/9HNxSMDiSX6VoNkr78yfKPNRe9n7lpqrX7HmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zfI3Is2whQXCSWrqhZp0+ykGnrwvaG6n7aEyPh0ljGQ=; b=acA3HQdXoQhOn8FSYnnxQzyrq70KmVJfznh2DrQ7fDtOi+FXnKkn07fvmb2UuL8CjW07ZKgXdRicuEWW62viFvoZxCiH3WFJEypnG7dcTxpPvpliISRDiUzVkskpkojlTcIGWNCdp1e7MiVg87ZYIHqtcng12xEz097mt88UQ2asCjkQyYCOAcI0dSF8UUhvPS4wsbqRoWUagtjaxCZ4b+gJn4K5iq48OHUWHVIMu/azpLxc2RwRvOJEnLOPiB+WszedfWJUqLp1MzDW0VDN7sy4Dedo6hzSaDSLwK9RtmMKqG1owrqD6DoIMlfd2gnw2xt0kPX55FieBDwVJhl3yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zfI3Is2whQXCSWrqhZp0+ykGnrwvaG6n7aEyPh0ljGQ=; b=4NF4XkogCfBQzu43MetFUrtD0B59IYeax0ZxDtN9EMoINIYEU+4bjR76cdLy8iQewlN2qwq4rcFewd4RHPw+dkZEwwSz9CGcsB8izqi9MSvrRYbeZRvdyXZOc5vEctcEfPqadgbhhHKNZzNwEwuIbswjxC3ZW4uFs5duUgmCdMY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MW3PR12MB4553.namprd12.prod.outlook.com (2603:10b6:303:2c::19) by MW4PR12MB6778.namprd12.prod.outlook.com (2603:10b6:303:1e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Wed, 25 Oct 2023 23:41:54 +0000 Received: from MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::1e4c:5da0:33ed:ff3a]) by MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::1e4c:5da0:33ed:ff3a%7]) with mapi id 15.20.6933.019; Wed, 25 Oct 2023 23:41:54 +0000 Message-ID: <88541b20-6745-28e3-6ba8-803a71554d6f@amd.com> Date: Wed, 25 Oct 2023 18:41:49 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Reply-To: babu.moger@amd.com Subject: Re: [PATCH] x86/resctrl: mba_MBps: Fall back to total b/w if local b/w unavailable Content-Language: en-US To: Tony Luck , "Moger, Babu" Cc: Peter Newman , Fenghua Yu , Reinette Chatre , Jonathan Corbet , Shuah Khan , x86@kernel.org, Shaopeng Tan , James Morse , Jamie Iles , Randy Dunlap , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev References: <20231024181600.8270-1-tony.luck@intel.com> From: "Moger, Babu" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BN0PR03CA0016.namprd03.prod.outlook.com (2603:10b6:408:e6::21) To MW3PR12MB4553.namprd12.prod.outlook.com (2603:10b6:303:2c::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PR12MB4553:EE_|MW4PR12MB6778:EE_ X-MS-Office365-Filtering-Correlation-Id: 2309f36c-b695-4445-efca-08dbd5b3f7d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6NLrLrmckvnceejGg/28CUajrNKh0tiX3KgaCxmtjJeJS2yEjUGZAltrCwHra3KuD+z5DrxxSDginBziFy0DduCN9OW1x7UznNwi8Gb+QaxiYITU7piCRVrAvauojyfBZWS2VkXikCY4fAJc5yHEqyTIC3cJEjX8ec/SNiyObub3rVEqPg9iF72VyabxqLQwHf9PtNw4uA4y17NXVBa46gRWozbUMrOdagMjUAHIXRpZQWierPMrkp1wmeHlssZREXMcpby9GMO0oX1OCjODLISfesOurYa9j4je/VD11XOA5GltYwxhMwakG5SKjHCevIQX1q2tORVXoOzBHIvhUehp+8Dd3ZU33AbGEz2m9pGqVXwt2IVvu5hM0xsm8iibjntRXtqFJ/OSs34Mm+/et1khPOnibiH65x9STwc+i6vo86mFzZFpbJBK3JWXbB5c2+qSLGl1oJFOBsoe4ksrQuqCBZepJ06HE9CTcM9vqWGByXGDmTCLpnZleOwxPioHQXnOBF+nP87gvTP8ZekhL2LvSmdHwOb1dB7AgqtsnqAaSwdOrsuRpsQW1IJANwgocmgbEr8VupNg38g1u1+uzrlmlqPyHdVe30Qd3VqubyozFuGxho2WpV7nvviV0T4wb7LVRnwQ4MbGXVufGfWlbw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR12MB4553.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(366004)(376002)(39860400002)(396003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(26005)(31686004)(31696002)(38100700002)(2906002)(7416002)(5660300002)(36756003)(4326008)(8936002)(8676002)(6636002)(110136005)(6486002)(2616005)(54906003)(41300700001)(66476007)(66556008)(316002)(478600001)(66946007)(6506007)(83380400001)(6512007)(53546011)(6666004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dUpMNU5sSEVlQXlCT0xUc29Ic1RRSzRKVEE2bU1Ya0Vpdm9paXhoWjRNYW1y?= =?utf-8?B?a0VqbndvSDY5L2t3aGYyTHB4N1plOTZkeHljOTlLSkkwV3d2UFIzNEtHTXZa?= =?utf-8?B?d2xJNXFCamUxb0NrU2U1YnpqMGJPcmhlcGpEcTBudkZRVTQ5RGdOTW53cDVD?= =?utf-8?B?d295YmlyV1BsYmI2b2JBd2dRdjlXZjNxRjMrNndxMGFsQ3U1RGE5SUw3Umly?= =?utf-8?B?bjRqVmllalA4UWFrRy9YRmk0RVYyNmc4QTBVQjdRYjU1U25ZeU1FUGVEL25r?= =?utf-8?B?NWdaMGxHNjg5WEZk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ZbC9qeTd1RFhad0ZCU3dZWjVJMVdYYmN4?= =?utf-8?Q?4ezw=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2309f36c-b695-4445-efca-08dbd5b3f7d2 X-MS-Exchange-CrossTenant-AuthSource: MW3PR12MB4553.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 23:41:53.8498 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gtwjWc83VyDs6/MjNqRD/4JvkLHnAw4znXbuW69xdqyEu9FwLZfZ6Dh8cXdx9RPE X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6778 X-Spam-Status: No, score=-4.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Wed, 25 Oct 2023 16:42:11 -0700 (PDT) Hi Tony, On 10/25/2023 3:52 PM, Tony Luck wrote: > On Wed, Oct 25, 2023 at 03:42:14PM -0500, Moger, Babu wrote: >> I meant, I was thinking bit different. >> >>> You need these changes in only two functions, mbm_bw_count and >>> update_mba_bw. You decide which event you want to use based on availability, >>> >>> Something like this. I updated mbm_bw_count. >>> >>> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c >>> b/arch/x86/kernel/cpu/resctrl/monitor.c >>> index 0ad23475fe16..302993e4fbc3 100644 >>> --- a/arch/x86/kernel/cpu/resctrl/monitor.c >>> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c >>> @@ -436,8 +436,16 @@ static int __mon_event_count(u32 rmid, struct >>> rmid_read *rr) >>> */ >>> static void mbm_bw_count(u32 rmid, struct rmid_read *rr) >>> { >>> - struct mbm_state *m = &rr->d->mbm_local[rmid]; >>> u64 cur_bw, bytes, cur_bytes; >>> + struct mbm_state *m; >>> + int evtid; >>> + >>> + if (is_mbm_local_enabled()) >>> + evtid = QOS_L3_MBM_LOCAL_EVENT_ID; >>> + else >>> + evtid = QOS_L3_MBM_TOTAL_EVENT_ID; >>> + >>> + m = get_mbm_state(rr->d, rmid, evtid); > Ok. Yes. That seems simpler. > > Maybe I should just set a global "mbm_evtid" at mount Lets not make it global yet. This is only affecting couple of functions when mba_MPps is enabled. > time. No need to check every time to see if is_mbm_local_enabled() > somehow changed and local b/w measurements were suddenly > available! What changed suddenly? Can you please elaborate. Thanks Babu