Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7160178rwd; Tue, 6 Jun 2023 07:09:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZCZVhIpmDPMTvj8gdLUjK46XnP0hmKAK2IF9byenVjUZwQJS+0gPJJ55g7Dg05TeyOOV5 X-Received: by 2002:a05:620a:ec4:b0:75e:c212:780d with SMTP id x4-20020a05620a0ec400b0075ec212780dmr1817453qkm.20.1686060571362; Tue, 06 Jun 2023 07:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686060571; cv=none; d=google.com; s=arc-20160816; b=YLF/1wsVpUJ/ADJb65lYVsBc/ENKyOHb3F8MLQefSKP0afwvU4IEySAuCtw0/p9fHO +6vxkM4SYtmEISdMQuCXGicz5OoBljcfQ1PmVmM3VG3WeJYdGx7Kfgw5GQncv2wRL73u mZJP/uEfwnufkU1ewEuXwO8vur48TdC9dOtFuwJVPoiXqU6ISA7sd1RPfO0gBtgYgeFL fblv4EZQ8hnBJEUd5XfxlHaPpEKetBiVFG1LjcFgrZPh1lpTUCGkEqJEq1QvhdFZgV7F J+Fqn3RdvmrjBqCEu5GvJVuCsqX3d4uTPTXsgz0Z9xYu4bk2WGfKpFVqavcQAUmVfErJ WimA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=k3etSudPv0uwqZOoY7JLZCAsQLOTHgmOhNgM4w6wd+A=; b=OAul68XlPfjsnJpgPhiT0uDNPZxj99qc0v+r1R5fjVbOcvBg2JvyJn6n/FQnCTz6p9 VUDm9cjU/VtxUG+VMpWpZ0GcLs4J10XZwYfIlbF/om5XIsPnK/ofWVah+po/RPebSzlC SS2NxbLs/3ZysfCtKDfq2hbYE6KmJpeIZ/XOpKIOHcvyu9q0oUbH8jJmgl5XsyyPgT24 0MjPZhUJqCSEF7wWP/smiz2bpBowTZTtSRK9wKNH/BF693ymBGJFlE9NoIJAzWR09mKM CydDb3wjxSDDKwtXoujrAx4hcASRzuEh7guEGVrs7QTEhZgAXeuiaS+riNfXq+MmEEbS AVpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=BvnVdXFt; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m2-20020ae9f202000000b0075943884c57si5695329qkg.312.2023.06.06.07.09.15; Tue, 06 Jun 2023 07:09:31 -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; dkim=pass header.i=@google.com header.s=20221208 header.b=BvnVdXFt; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238005AbjFFNtM (ORCPT + 99 others); Tue, 6 Jun 2023 09:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238093AbjFFNtI (ORCPT ); Tue, 6 Jun 2023 09:49:08 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BB5310F8 for ; Tue, 6 Jun 2023 06:48:45 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-3f9a81da5d7so237931cf.0 for ; Tue, 06 Jun 2023 06:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686059324; x=1688651324; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=k3etSudPv0uwqZOoY7JLZCAsQLOTHgmOhNgM4w6wd+A=; b=BvnVdXFthGTIr6/P+iT+/1fKKqBwuL8xK7GHR/lDK16ez+mkL+PyQts9Gtn0y+XF0F uALY/YZY3ZUAvdPezr/Ib1MnhKWdwxAn86wi9yJdqQIOgco+N7mB2q2n2c0RlUOmx4uh FtxfV7SvN4HiCnbG+RZ8BmBoMQCPBn27+Mw4OM1u9rp7u6I0ia5QvSnWI7FD6CgFwlgW 8c/iBYode1/5JKHJdUa2Pmqx3A/aP7BpBVxhdcKUI75LN9TpB5Z++Fkxz9/1EEGl5B73 sP/a4Bl3mUgztagYoOJYRf7An6U1Ds5meELjhxs62ZDjURa2D3G49HF+W8Lx25CEeZKK oEvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686059324; x=1688651324; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k3etSudPv0uwqZOoY7JLZCAsQLOTHgmOhNgM4w6wd+A=; b=Njms3oV3Y+OHDgCUSTENXcUvv+vL9mHDAbP49z6duCBXKZ6I/Bhzeipfbmn7Z/0Qgj 7tHXSegCw780iavQfE1hO3ZAQ2d/5it7Uz08pJ/99ivKQpqSr2RSXWum7SEm9FX5/9lf C3zyKenWEkI7czeZ4ho1zD5S15FHK493KlJZ7V3HSfQnQqrGbp2oc2KR6dZ6MYDpdkrT S49dYgOxwVK6xcyMRY/5czWqooaXG7k5+9WFxVSiuZBqbxcRsqY/vfq+Z0wTVhaxHLlm FqarfZIO+21d3tqay+T2EEzE6uJ0lnYJO7/gisy6nH+nqLajdY5ic2IJd5nuPBPTqZbQ 8ejQ== X-Gm-Message-State: AC+VfDz21ZNBHkcE5Uswokh3tC97XPJxBPRQaJxYbcjWD6ff30Hq7hlC GF0w6RiA1N8j5H6jeabtguZ/JMgk3XLptLBA2O5rkSXociVVC54EwwU= X-Received: by 2002:ac8:5a81:0:b0:3f8:1db6:201c with SMTP id c1-20020ac85a81000000b003f81db6201cmr137840qtc.13.1686059324209; Tue, 06 Jun 2023 06:48:44 -0700 (PDT) MIME-Version: 1.0 References: <20230421141723.2405942-1-peternewman@google.com> <20230421141723.2405942-9-peternewman@google.com> In-Reply-To: <20230421141723.2405942-9-peternewman@google.com> From: Peter Newman Date: Tue, 6 Jun 2023 15:48:33 +0200 Message-ID: Subject: Re: [PATCH v1 8/9] x86/resctrl: Use mbm_update() to push soft RMID counts To: Fenghua Yu , Reinette Chatre Cc: Babu Moger , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Stephane Eranian , James Morse , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 On Fri, Apr 21, 2023 at 4:18=E2=80=AFPM Peter Newman wrote: > > __mon_event_count() only reads the current software count and does not > cause CPUs in the domain to flush. For mbm_update() to be effective in > preventing overflow in hardware counters with soft RMIDs, it needs to > flush the domain CPUs so that all of the HW RMIDs are read. > > When RMIDs are soft, mbm_update() is intended to push bandwidth counts > to the software counters rather than pulling the counts from hardware > when userspace reads event counts, as this is a lot more efficient when > the number of HW RMIDs is fixed. The low frequency with which the overflow handler is run would introduce too much error into bandwidth calculations and running it more frequently regardless of whether event count reads are being requested by the user is not a good use of CPU time. mon_event_read() needs to pull fresh event count values from hardware. > When RMIDs are soft, mbm_update() only calls mbm_flush_cpu_handler() on > each CPU in the domain rather than reading all RMIDs. I'll try going back to Stephane's original approach of rate-limiting how often domain CPUs need to be flushed and allowing the user to configure the time threshold. This will allow mbm_update() to read all of the RMIDs without triggering lots of redundant IPIs. (redundant because only the current RMID on each CPU can change when RMIDs are soft)