Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2714804rwd; Fri, 16 Jun 2023 07:20:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ngc0+q1h8ve2auqtOAoEjXLJtKwB1+xIW19KPAzV7J8cr+UnASYXLnu56LyMu8lQwalvs X-Received: by 2002:a17:902:e5d2:b0:1b5:18b7:85e4 with SMTP id u18-20020a170902e5d200b001b518b785e4mr2150625plf.32.1686925241013; Fri, 16 Jun 2023 07:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686925240; cv=none; d=google.com; s=arc-20160816; b=YOgS4mTLCMO/NbxgKgYfRH1caJ1zmbyHSsCwl/tJPNRkTmUtwtYvImiwK7k6md25de G6R3H2tCF/kjg2TG5MKtgbIefKKn0Dlpb89IwPMfNAUa8cWrFXhJyNQdzk/d+9sRTRyI oGnC+NvVr8Wr7iXiFZ2mm8iCzroFQ85ojQqAyHPCBAWvBOcZqQ1YxDt9UwY5Zq0erkkR U1ZO1jRHpiuafGZxumD4Qyawux6nvAHHV99Vj2yOMqSkyohsZKDjWZz5zpebhr7MIMZI PWJUecZb8NGms54VBqnG5NUQI8od+fvl9ZSkXPuI5gQFZS6UGASQ5Ux8bk95EH3/i0EO hG3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lX3qyAy2K9wVkyWquOfum4ksPZ0rfQWIAZiVU0Bgd5A=; b=gbTXSk+U26T+PS7Tprcz0eLluZiKTPBb/+vO8n96N/zbHx4x3UcO04qtnIulKYJo3b 5yjpgK+MrDN68iExjEtd9s40pCLWcKqLvESsEvoT+9n1K713+Ek7MQ4T9b583g9eTdpw NqA9y6e2WPOsokvOWIIX470dWNEnMd0eh0M9hsq75nv2z/myg39T2BclPKL7vgUxR1N5 O3Bl+uofbMF0DjNtMf/zZs0c+N+MZr+cgGX8shYH4CGUT7BxdXX6P0fkCZ43BwZKTrjy Ks45mCVDL/mw+n+WbjgVYyb4RKOFd13lemDeH+Hw0i6mAVU3xjkCY8QwZYLYGmWxe4UX VFzg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q14-20020a17090311ce00b001a974fc86casi12780263plh.592.2023.06.16.07.20.29; Fri, 16 Jun 2023 07:20:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233153AbjFPOFU (ORCPT + 99 others); Fri, 16 Jun 2023 10:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345817AbjFPOFP (ORCPT ); Fri, 16 Jun 2023 10:05:15 -0400 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D806F3C04; Fri, 16 Jun 2023 07:04:57 -0700 (PDT) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-30fcde6a73cso546665f8f.2; Fri, 16 Jun 2023 07:04:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686924233; x=1689516233; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lX3qyAy2K9wVkyWquOfum4ksPZ0rfQWIAZiVU0Bgd5A=; b=URU/pOUtPm3w80kQuQ4wL6uqCG4NtWX52oeSiLoQWe1lXgGy03pmZQAr4d1giaaXoV a4K8OTyTO5ZapmrlZdq7TdWsO6EjiDzzmBNgVwv9m4osakkIXfSEJU2as0Jl+FO8j5RK 9S/yHFHtCMaWCwDd2bQgib4cpSZlKIl76h5ZSZYbLLlCVDOjHKleul31J71GOQhsnwN7 UMC2cbN9+8Lf8C1V4Bn6I0cwj5J27ZgpHRmldAw002ESHzW/90VZC+nkxJgSg//iZKSI tgDb0ZCJK6plDKAtelnQU+tj7B9zhE8HSt6wWBcFjuCxLEVly0j/wJBluci2IBuTctGs VluQ== X-Gm-Message-State: AC+VfDzzX9YeM93NRq7NB6UpNz5H9kOEHM22T6Bhrr7Xi1QyP7XaXMvC 6IIWgoeJT5j4s6pLN/tYHMM= X-Received: by 2002:adf:e8c8:0:b0:30a:e9a9:a4e4 with SMTP id k8-20020adfe8c8000000b0030ae9a9a4e4mr1430634wrn.51.1686924233019; Fri, 16 Jun 2023 07:03:53 -0700 (PDT) Received: from gmail.com (fwdproxy-cln-014.fbsv.net. [2a03:2880:31ff:e::face:b00c]) by smtp.gmail.com with ESMTPSA id n11-20020adfe78b000000b0030fc666686bsm12802150wrm.85.2023.06.16.07.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 07:03:52 -0700 (PDT) Date: Fri, 16 Jun 2023 07:03:50 -0700 From: Breno Leitao To: Peter Zijlstra Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Thomas Gleixner , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Sandipan Das , leit@fb.com, dcostantino@meta.com, "open list:PERFORMANCE EVENTS SUBSYSTEM" , "open list:PERFORMANCE EVENTS SUBSYSTEM" Subject: Re: [PATCH] perf/x86/amd: Do not WARN on every IRQ Message-ID: References: <20230616115316.3652155-1-leitao@debian.org> <20230616132954.GG4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230616132954.GG4253@hirez.programming.kicks-ass.net> X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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, Jun 16, 2023 at 03:29:54PM +0200, Peter Zijlstra wrote: > On Fri, Jun 16, 2023 at 04:53:15AM -0700, Breno Leitao wrote: > > On some systems, the Performance Counter Global Status Register is > > coming with reserved bits set, which causes the system to be unusable > > if a simple `perf top` runs. The system hits the WARN() thousands times > > while perf runs. > > > > WARNING: CPU: 18 PID: 20608 at arch/x86/events/amd/core.c:944 amd_pmu_v2_handle_irq+0x1be/0x2b0 > > > > This happens because the "Performance Counter Global Status Register" > > (PerfCntGlobalStatus) MSR has bit 7 set. Bit 7 should be reserved according > > to the documentation (Figure 13-12 from "AMD64 Architecture Programmer’s > > Manual, Volume 2: System Programming, 24593"[1] > > Would it then not make more sense to mask out bit7 before: It is more than bit 7. This is the register structure according to the document above: Bits Mnemonic Description Access type 63:60 Reserved RO 59 PMCF Performance Counter Freeze RO 58 LBRSF Last Branch Record Stack Freeze RO 57:6 Reserved RO 5:0 CNT_OF Counter overflow for PerfCnt[5:0] RO In the code, bit GLOBAL_STATUS_LBRS_FROZEN is handled and cleared before we reach my changes That said, your approach is almost similar to what I did, and I will be happy to change in order to make the code clearer. > + status &= ~AMD_PMU_V2_GLOBAL_STATUS_RESERVED; > if (!status) > goto done; > > ? > > Aside from being reserved, why are these bits magically set all of a > sudden? That is probably a question to AMD.