Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2369514rwj; Mon, 19 Dec 2022 03:45:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXslK63F1pJyGw8izri8wlf7Sb6X8JMpSlJRlj0FCTokJFUC7DkavKq0xhBIp7tWg5fuAj4X X-Received: by 2002:a17:90a:24f:b0:223:a473:fd75 with SMTP id t15-20020a17090a024f00b00223a473fd75mr10063971pje.19.1671450331268; Mon, 19 Dec 2022 03:45:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671450331; cv=none; d=google.com; s=arc-20160816; b=eXoSnNqwcQzM8tX1zhaoKX66zLo5cNDA8oi2kyR/MRZGh5YVvFtQxd/xbDCEdDqlya TV6qVrYIunXV0Xn+BRsWrQidSODd+C5TNFizHsSJLSLMqSfL+lYaEiGd/d9bJJURxIhf 9J0nMA2bsi3Ucmeu5V9Tee1rsdSz6ZX/oZgimnMydjnWXPEppu/ESy17kz2VxMy2YWW5 BpN7mn0WyMu4ACk1WgFdh9ReIfx0GysmbcUmBV5nHIInf7CK2Oq3EK7bqKx81StjKRGM T7LKLe6ulw61Ywu0ZrWPZ9al45VXcrERkmi4W8m6kVa9gXCOIYIU1c4vk+egen9vO46U ZP6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Wt1RBr25LOnXc4BczGcsScej9eUqJ1+Tj1lHRWHLLSw=; b=FsKW6otnFi05tfn/AHH59kN/deT+3/J8gbZ2Yijutfvcinr8UlKk6uz7YPgF9aVHmr yF1kJPQkNihXv1gNHW7XFopS5ikbq1ptxKsvuKUt36hq5eLTNCrb9REHVPoOCBTyG2r0 kTTWRfBgfibOoGadmpiR8FzQVHOW4FQtAMKM2zyn8irWeE/ZabiMjUB8smdPMCwL2bby 82/lDzfR3tj3hZRXDUTtmH4rKD4icK3+ObYikcYpow6rAuKA1M7fuEkT+ISimCcSkNja XCJIOb0Adil5+QcEf5yeLYsW8eH/OjEuCcrinUV78exN4jAYYb9niWysiPyUY1su7To+ 0U0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=A4zmGxgR; 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 mw13-20020a17090b4d0d00b00219315af541si11193795pjb.79.2022.12.19.03.45.20; Mon, 19 Dec 2022 03:45:31 -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=A4zmGxgR; 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 S231809AbiLSKcD (ORCPT + 71 others); Mon, 19 Dec 2022 05:32:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231833AbiLSKb6 (ORCPT ); Mon, 19 Dec 2022 05:31:58 -0500 Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B23B625D for ; Mon, 19 Dec 2022 02:31:57 -0800 (PST) Received: by mail-qv1-xf35.google.com with SMTP id h10so6007236qvq.7 for ; Mon, 19 Dec 2022 02:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Wt1RBr25LOnXc4BczGcsScej9eUqJ1+Tj1lHRWHLLSw=; b=A4zmGxgRJNNmNzj8lquXuBsd14s8jIDeYpru/NS6b6sDNO1ozp9Xp0RghAOZtm/GwY 9AxeLOuAYtanv/5lNbJIB/2unDyKwv6stRb86gmVfgtGvNJSNNKmhDANzH12WcQ1fdvw LshXniccmFsFKA1btgWqUUqbw6zNnizGYpGhCDUIVE+hCs8h2FKhZpDrR2aaypzgjlQr ggMunG5j6iEV1lk5JjRfR5KCurASdOTZUZok4p+usDkrSOiDvnYw+VcEk+pJtqAHIyua 9i50jrs1iUqewrDcTU/s4cB/cj1yvSLSflg+4kVT7bl4mw6ek4DgfZuondTJtKRgoTD4 qxNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=Wt1RBr25LOnXc4BczGcsScej9eUqJ1+Tj1lHRWHLLSw=; b=Aju8tjXNQoR3zEPOgeVTKnpp/jOjMqCj7dFhSSe51BEuHW2xlqOav6WobAXZFILF0p 2nSHg/qjGB7vbOzuEzEcbaTm6XqHzqSYpxOegUfxZfYbsdhChO55XeUJFvE8epa8KS7p YbB38ZMVjHyALWD38mhmr5RMsR/nWRzFLPDsA9uiM6jjuzrfHpo7eT6feIyst8KT1nhx l3UnvPHYH8enuPNndqxaB55X/G2K825QV0q8cXiV2Qxlg0MjN5STYSO/oHJxvGMprGF6 O2bQLqFpzXyv7l/VXkaqrxHtex4xdonWo4KmN2PSkWpQeLgJA3Xew6HQmYAIj4352blP Zotw== X-Gm-Message-State: ANoB5pnh6DGAl3UU07Rm9//sp974FhMai8rNAeQG271S49FiRx4eViU+ Bpcb4fYuWhUry2Z/vzbkhKTQSIHyZ1KYedHPIY0UUQ== X-Received: by 2002:a0c:ebc8:0:b0:4c6:e82b:93e1 with SMTP id k8-20020a0cebc8000000b004c6e82b93e1mr55262028qvq.124.1671445916614; Mon, 19 Dec 2022 02:31:56 -0800 (PST) MIME-Version: 1.0 References: <20221214160856.2164207-1-peternewman@google.com> In-Reply-To: From: Peter Newman Date: Mon, 19 Dec 2022 11:31:45 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] x86/resctrl: Fix event counts regression in reused RMIDs To: Reinette Chatre Cc: fenghua.yu@intel.com, 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 Content-Type: text/plain; charset="UTF-8" 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, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 Hi Reinette, On Sat, Dec 17, 2022 at 1:59 AM Reinette Chatre wrote: > On 12/14/2022 8:08 AM, Peter Newman wrote: > > 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 > > This does look like a candidate for stable? Yes, this bug is serious and reproducible. Every RMID reuse would have up to one overflow's-worth of measurement error. Should I elaborate on the impact more in the changelog? > > > --- > > It is helpful to have a summary here of what changed since previous version. ok, I'll add this > Thank you very much for catching and fixing this. > > Reviewed-by: Reinette Chatre Thanks, Reinette! -Peter