From patchwork Tue Dec 20 16:41:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Newman X-Patchwork-Id: 35148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3068092wrn; Tue, 20 Dec 2022 08:48:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXtEVpOkoTam9Y5RDXPnrq/FO1F2bZ6q7bukUi29x0fM3WtJsTCkyX4VS45WX0/VH/tZwY5i X-Received: by 2002:a17:906:4c94:b0:7b5:860d:7039 with SMTP id q20-20020a1709064c9400b007b5860d7039mr4219968eju.10.1671554930395; Tue, 20 Dec 2022 08:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671554930; cv=none; d=google.com; s=arc-20160816; b=dz+09rcOVjCDXOOJoPfu9nnlQM9A3Cn5AcBPZ6r3+2Os9ijLLrwGtYrpX+L2U5UX6/ WW3n6n21Pa11jq6XjsFpeEujjrje8KjwWMfEt2SHfw149j3mT8ho+4BFAOwmw5LK+cHc cgFnHrD8nzjahh/F4yQ6jKxRLpBDl0hAUzk3UYkL949l3gzpP/WDKSYB4SPsplyQTo28 NXp/m/kw4JUg1OVzF7hCDUO5rF9B1KVnH9oUOmTR4TaBmmtwNGkVxqZmfleiK6SwaCW0 3nzWe1hUHnmnXXbk09gteOc0ay/BzXO4xzd3L0V4E8ZBxG54vqq66OmtKVpiDiMj4jgD eDqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=OTNceY23AA38a0nnsKzPgPMXfy0S7X52/MJzcro4EXc=; b=kbvWVvIj/lQ9ZjwrffrKdZ0e2YVOiOba+jbO609rD6hgUiq4f9WE3BKMxa5aMFPGhC bx5MQyYcfeYOZg/dB+4frmn25M7WR1+3iRk+wQiHq4TVnQOa13TfNQxm8V/pmAoChz9F WOHX/ZWczK5kKXpwwMzbzAS0zzSE2nBqApUxyInyQ67F2lITEmLWdF0SKvAJF3/nmTWm 0KaxcoJdJqMuRLoWPHkQUqEAMG2hN5HAs6vmTw00wCBoTUDlW+S+gusnSiwcnIsbCzS7 HUZGah1TlkJRwNMWHT4gHlodZJSMiZ0cNCsYWIRbEe8oShfvykGvDgI5G8X7r8hhyi+o GeEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="MP6A5o/s"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg4-20020a1709072cc400b007d97d797c8dsi9653891ejc.215.2022.12.20.08.48.27; Tue, 20 Dec 2022 08:48:50 -0800 (PST) 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=20210112 header.b="MP6A5o/s"; 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 S233890AbiLTQmN (ORCPT + 99 others); Tue, 20 Dec 2022 11:42:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229560AbiLTQlq (ORCPT ); Tue, 20 Dec 2022 11:41:46 -0500 Received: from mail-wm1-x349.google.com (mail-wm1-x349.google.com [IPv6:2a00:1450:4864:20::349]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 211081581B for ; Tue, 20 Dec 2022 08:41:45 -0800 (PST) Received: by mail-wm1-x349.google.com with SMTP id o5-20020a05600c510500b003cfca1a327fso6785986wms.8 for ; Tue, 20 Dec 2022 08:41:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=OTNceY23AA38a0nnsKzPgPMXfy0S7X52/MJzcro4EXc=; b=MP6A5o/sswJ8AVbWgBG0Qiw5G/Sd/4XmeRK871/E+itWC425/UWTA+3yF6kdSm+y8V CVIMwkHnWvHBP02oJEBGOusy/IimIHMH20oQcvGdaucSMpckrK/S1d18048ion+N8iMa 0L94kAXC18YKiQ1kbAkxVDSUlL5i+GLOmkR3U5kBpqz5wgDaVzfdvX74/Ev+/FSQ3+fu AS8gSxVy1gYemsu0YepZKSSWc2l4dQOL0XoIdA5XUnCT9xGssF2Oq5ETLvKC66AkYE1d jH9zjD39wPvfcrfb2JO6psmcYWc150l8BXEMxmIKSKdyi65HIhm1CSan7e6Uto3SlRhH ZwrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OTNceY23AA38a0nnsKzPgPMXfy0S7X52/MJzcro4EXc=; b=ZAzIQG/SrCPGtYuHQYlONjtZadaL79i14MYUhhP1SuendJgjhG65QGzM4b1IbkukeJ IxLmbPBpNKX2HKcu/Q50sNI85n9llFxX+CKvT6X5UNcIynRasDwx/RC/8X2xxKMPT3k/ AnZ51rcZeSb71rDUy5rjdim2pUwKpZeaDLF0MIqwQMG2xOlhIpjkgo2SLO67px2gIYfq AW6XtpD0aN5lQJiCi9TVWRktFW4tRocBZyJAv0w95rSVATOxjA+4+54O6w927fkeClzB NQg0z0YtimKwbpUSAVC2AiVOovkd6JwTabGQJAL+J4MPZ8D+7tF/1M4Y9SM2aXxeYiWf jq8Q== X-Gm-Message-State: AFqh2kpj/NtagKpWeUNKlpm0hJuM8fMuyPEPpmWed1zXDA/OKNxsIPOj CkYdwDk3XpHjW/HtETLPi1yEYdzfGiOlcpoJlw== X-Received: from peternewman10.zrh.corp.google.com ([2a00:79e0:9d:6:8175:5362:6754:c66d]) (user=peternewman job=sendgmr) by 2002:a05:600c:3553:b0:3cf:6f23:a3e3 with SMTP id i19-20020a05600c355300b003cf6f23a3e3mr56813wmq.1.1671554503082; Tue, 20 Dec 2022 08:41:43 -0800 (PST) Date: Tue, 20 Dec 2022 17:41:31 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221220164132.443083-1-peternewman@google.com> Subject: [PATCH v3 1/2] x86/resctrl: Fix event counts regression in reused RMIDs From: Peter Newman To: reinette.chatre@intel.com, fenghua.yu@intel.com Cc: Babu.Moger@amd.com, bp@alien8.de, dave.hansen@linux.intel.com, eranian@google.com, hpa@zytor.com, james.morse@arm.com, linux-kernel@vger.kernel.org, mingo@redhat.com, quic_jiles@quicinc.com, tan.shaopeng@fujitsu.com, tglx@linutronix.de, x86@kernel.org, Peter Newman , stable@vger.kernel.org X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752752382697241786?= X-GMAIL-MSGID: =?utf-8?q?1752752382697241786?= When creating a new monitoring group, the RMID allocated for it may have been used by a group which was previously removed. In this case, the hardware counters will have non-zero values which should be deducted from what is reported in the new group's counts. resctrl_arch_reset_rmid() initializes the prev_msr value for counters to 0, causing the initial count to be charged to the new group. Resurrect __rmid_read() and use it to initialize prev_msr correctly. Unlike before, __rmid_read() checks for error bits in the MSR read so that callers don't need to. Fixes: 1d81d15db39c ("x86/resctrl: Move mbm_overflow_count() into resctrl_arch_rmid_read()") Signed-off-by: Peter Newman Reviewed-by: Reinette Chatre Cc: stable@vger.kernel.org Tested-by: Babu Moger prev_msr); + } } static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr, unsigned int width) @@ -191,25 +219,14 @@ int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d, struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); struct arch_mbm_state *am; u64 msr_val, chunks; + int ret; if (!cpumask_test_cpu(smp_processor_id(), &d->cpu_mask)) return -EINVAL; - /* - * As per the SDM, when IA32_QM_EVTSEL.EvtID (bits 7:0) is configured - * with a valid event code for supported resource type and the bits - * IA32_QM_EVTSEL.RMID (bits 41:32) are configured with valid RMID, - * IA32_QM_CTR.data (bits 61:0) reports the monitored data. - * IA32_QM_CTR.Error (bit 63) and IA32_QM_CTR.Unavailable (bit 62) - * are error bits. - */ - wrmsr(MSR_IA32_QM_EVTSEL, eventid, rmid); - rdmsrl(MSR_IA32_QM_CTR, msr_val); - - if (msr_val & RMID_VAL_ERROR) - return -EIO; - if (msr_val & RMID_VAL_UNAVAIL) - return -EINVAL; + ret = __rmid_read(rmid, eventid, &msr_val); + if (ret) + return ret; am = get_arch_mbm_state(hw_dom, rmid, eventid); if (am) { From patchwork Tue Dec 20 16:41:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Newman X-Patchwork-Id: 35147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3067844wrn; Tue, 20 Dec 2022 08:48:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf565OR0PtEQVF3GBBLq0Vx/lwsL4VnreykUS7UqZ0tiMnA3QQ3E7i+lu2jpXUdQRSZMBP2a X-Received: by 2002:a17:907:a4c1:b0:7c0:a350:9d29 with SMTP id vq1-20020a170907a4c100b007c0a3509d29mr38810456ejc.18.1671554892499; Tue, 20 Dec 2022 08:48:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671554892; cv=none; d=google.com; s=arc-20160816; b=X1Nn2TJdE89DHGPWRC8zzYvdqCJj69RGtQG9Tgkn9fxjFZZaOVOWTsb7PkeZ99HvPc +O3IjZjGOI8/jZSqXQ2s/4nlGXXLMXKN1WMPsm8/HUeNlN8x4kTJHP6glvVSfhBrbNZ0 3d31gbXRqSKNejKxnPbliFKbQ2dwR+2F+vRdjSiLNYpF3sD0teOQnvpt6gdkVyqoj8Kh tmTIb/FTKFfg+/WR44XSJUyR81EsApxSGnXrmyxZxmu+NY+Whj+dGcqs6cXRDDAsmjYf ZgIb6+n1usQn8H7/yGrvIjXtNzCVwm7yIB+A+/utcc+mJKjzItViuGwW1wS/FrtNU2uq ARBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=Ddxu02Fh985Hkv+dloyjYYVxCvgT54odhdsQPfp8+qk=; b=FdX4xkbCHU6opuGnMgobKx91HS5VahTeGPdDvzR1tf4utYNZBl4PGBrAuEmVK0gscN yBO1+tdfqEMVSJynxTGQ96kIhzEw+vNG5RRtioFRZkkEA5RKB8yfeNCZR2llWOeNvgQb aiHW3oa2GulencrvPGyNpkKRsJGfDZCPJnNVGLlo406EP7ZBNhZBZ8mv1SzA/yDLFnoV gmzSVXylKbAPhDKmqqhPcLzSVVt2r6I99bXYxuxxdXmcEYwFgQdtgzeGuDXt6QNk3bPA Dx1KvxoD2HaodqkAjuJEh7kcZx9PEudtOFDm/CYK1mP+vAmMbCqGykUIJMf1Tz+Sf58I EAJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dtZ2FoIE; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vr3-20020a170907a50300b007d11af995b2si10784489ejc.680.2022.12.20.08.47.49; Tue, 20 Dec 2022 08:48:12 -0800 (PST) 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=20210112 header.b=dtZ2FoIE; 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 S230506AbiLTQmI (ORCPT + 99 others); Tue, 20 Dec 2022 11:42:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbiLTQly (ORCPT ); Tue, 20 Dec 2022 11:41:54 -0500 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 577B76348 for ; Tue, 20 Dec 2022 08:41:53 -0800 (PST) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-3b5da1b3130so147447767b3.5 for ; Tue, 20 Dec 2022 08:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Ddxu02Fh985Hkv+dloyjYYVxCvgT54odhdsQPfp8+qk=; b=dtZ2FoIE8vSOyMFWa4Ib2Ngomw3+orv/5Y7dkDgPUC3bNOs0ezgSwkeSn3FhzekFi5 +gfuVW12SQftxn7Y2p8SU2QoFzuMboKd9662L8TlqhdYPbal3kndZYKlSL8Lm3Pt48C3 jSk7Qn8qVjZK1npJX+olXvODzx4FFWIouP9vnCTrPUsEO72yhmY3hlujrTOPG4peRewT QtwOu9q8wR161mcr23qO/wVn1d9JMnB1g4Axt95/xCAoIQXYmiad6QEDsW9BZ46N/W72 80kxTHh6SIvmVvEB8CGQXcUU4M4KuQFWz9xUo3FyqMKIraiN9tpfY4N89eA6Illhxt7F fpfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ddxu02Fh985Hkv+dloyjYYVxCvgT54odhdsQPfp8+qk=; b=fMOevg2Yu3CMPTbktfQbPgaIOG/iVSE3jFDJJnaw1chpyCbiYPJntFOJm82tRz99VP lY1qArxLO4+zJOgOj1KX3U9C0rDtQHqYVbov33cj9bIhbzgnQoq7n3OVjq1SZXp09JyQ PeqpDU4u1xZBVqMaCiG5HUW60g+5dThreiq8w1of11HIdFTyhnoOXjX2R5oCHGFfIgQO aWEvEzPwMQfGfy3G2FGHITcheASEZhNAG193GWVobRmF7cQ6rV/YKp7H0P2aZsxgo+Gc nJO2YAkuUw3t8hLLM75ckbvMG2mUtEJZ9sS9am6cK1m6kog/dxNURRKWj/nJfMMf+8Tw 36EQ== X-Gm-Message-State: AFqh2krD8ogSVz9xi8WK3CnNExzq6rKXy4fLJPj+gzf/DnBTPrG7dkDp biPMKkNXwaaN6n9bSkaLTfUTVxp+V3JLsD+gRw== X-Received: from peternewman10.zrh.corp.google.com ([2a00:79e0:9d:6:8175:5362:6754:c66d]) (user=peternewman job=sendgmr) by 2002:a0d:e24b:0:b0:3d7:28d5:1c6f with SMTP id l72-20020a0de24b000000b003d728d51c6fmr1552006ywe.227.1671554512615; Tue, 20 Dec 2022 08:41:52 -0800 (PST) Date: Tue, 20 Dec 2022 17:41:32 +0100 In-Reply-To: <20221220164132.443083-1-peternewman@google.com> Mime-Version: 1.0 References: <20221220164132.443083-1-peternewman@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20221220164132.443083-2-peternewman@google.com> Subject: [PATCH v3 2/2] x86/resctrl: Avoid redundant counter read in __mon_event_count() From: Peter Newman To: reinette.chatre@intel.com, fenghua.yu@intel.com Cc: Babu.Moger@amd.com, bp@alien8.de, dave.hansen@linux.intel.com, eranian@google.com, hpa@zytor.com, james.morse@arm.com, linux-kernel@vger.kernel.org, mingo@redhat.com, quic_jiles@quicinc.com, tan.shaopeng@fujitsu.com, tglx@linutronix.de, x86@kernel.org, Peter Newman X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752752343169334846?= X-GMAIL-MSGID: =?utf-8?q?1752752343169334846?= __mon_event_count() does the per-RMID, per-domain work for user-initiated event count reads and the initialization of new monitor groups. In the initialization case, after resctrl_arch_reset_rmid() calls __rmid_read() to record an initial count for a new monitor group, it immediately calls resctrl_arch_rmid_read(). This re-read of the hardware counter is unnecessary and the following computations are ignored by the caller during initialization. Following return from resctrl_arch_reset_rmid(), just clear the mbm_state and return. This involves moving the mbm_state lookup into the rr->first case, as it's not needed for regular event count reads: the QOS_L3_OCCUP_EVENT_ID case was redundant with the accumulating logic at the end of the function. Signed-off-by: Peter Newman Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- v3: - changelog clarifications suggested by Reinette v2: (patch introduced) v2: https://lore.kernel.org/lkml/20221214160856.2164207-2-peternewman@google.com/ --- arch/x86/kernel/cpu/resctrl/monitor.c | 43 ++++++++++++--------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 77538abeb72a..e708df478077 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -366,41 +366,36 @@ void free_rmid(u32 rmid) list_add_tail(&entry->list, &rmid_free_lru); } +static struct mbm_state *get_mbm_state(struct rdt_domain *d, u32 rmid, + enum resctrl_event_id evtid) +{ + switch (evtid) { + case QOS_L3_MBM_TOTAL_EVENT_ID: + return &d->mbm_total[rmid]; + case QOS_L3_MBM_LOCAL_EVENT_ID: + return &d->mbm_local[rmid]; + default: + return NULL; + } +} + static int __mon_event_count(u32 rmid, struct rmid_read *rr) { struct mbm_state *m; u64 tval = 0; - if (rr->first) + if (rr->first) { resctrl_arch_reset_rmid(rr->r, rr->d, rmid, rr->evtid); + m = get_mbm_state(rr->d, rmid, rr->evtid); + if (m) + memset(m, 0, sizeof(struct mbm_state)); + return 0; + } rr->err = resctrl_arch_rmid_read(rr->r, rr->d, rmid, rr->evtid, &tval); if (rr->err) return rr->err; - switch (rr->evtid) { - case QOS_L3_OCCUP_EVENT_ID: - rr->val += tval; - return 0; - case QOS_L3_MBM_TOTAL_EVENT_ID: - m = &rr->d->mbm_total[rmid]; - break; - case QOS_L3_MBM_LOCAL_EVENT_ID: - m = &rr->d->mbm_local[rmid]; - break; - default: - /* - * Code would never reach here because an invalid - * event id would fail in resctrl_arch_rmid_read(). - */ - return -EINVAL; - } - - if (rr->first) { - memset(m, 0, sizeof(struct mbm_state)); - return 0; - } - rr->val += tval; return 0;