Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp79318pxb; Thu, 21 Apr 2022 17:34:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzshYwwmMvVWX6kPlDcrjIL1gptxrQTU2uhDmspQ/4klAdF5ihKcwAUS90lWVBPJl1nnIaY X-Received: by 2002:a50:954b:0:b0:41a:c9cb:8778 with SMTP id v11-20020a50954b000000b0041ac9cb8778mr2192477eda.165.1650587683452; Thu, 21 Apr 2022 17:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650587683; cv=none; d=google.com; s=arc-20160816; b=wW4o6iuDR3Nf4+qeYUSZHewFkn50NgRGZzDYMbwGt9a7aCcvYH771riNVixiQcwCW4 YlyVcsYb8z5Xs++yYXhpwL6pqj5YjNBlxO1aeVsHSEV3L8vcSMgty1UY6tRKChjGbCor wa2fPbJzgLKpYb6AOOXTkx3yQd3lnGPsnf9KP6d9x9T2HuRYpCFPd7BzeVKJSG3HRKq5 0Zipm4kvx8c+zdnnKtjWK+ctbW17hyBNqYwzTuxHYsvVnsx7dVVKK7pTncQv+JqbISmU 911M/qXT7+93nPQ1v9ODxKHgli34A1nLHayPAYdPxslE5CK1C2xef8PUHm7enPSrgw/v e8cQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=K28ZszIq+QiHeei7bDvtjvKxO/gUup7E4EwBSEICmPI=; b=MTEfM/E5qhFb7SPdI/Ju9msptjnxIL89hiCJ538SRYShhLln0Eexs3+iMALrrgg/Al xQCDRIooQ8/6aSL4vspsbW/Ko99sauDFjYqL+bCC953OUwUUKCR0Yencw2pjerMTWB+a vj9KvFeUmw+yJPMX6+ZozDVtCUanU1H1R1ABjGfSAC1sPWzJahgu5xekEloMxLO9Sza0 ReiLFHp9Wajq54nRkW0Spl7cPRjDUpYFDHI1IkAaln3tPR3jFDldM6iwBcnJOb4ywlUc jqgnIMKOlxWEY+ieI6/kVu+dovQTsJ5m7CDPU0aq9eS8maC5JL+u2G9epVRRG4NfpLB5 +P6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WUpYfAEK; 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 v17-20020a50a451000000b00418c2b5bebasi4644479edb.412.2022.04.21.17.34.03; Thu, 21 Apr 2022 17:34:43 -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=@infradead.org header.s=casper.20170209 header.b=WUpYfAEK; 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 S1357865AbiDSVAo (ORCPT + 99 others); Tue, 19 Apr 2022 17:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355486AbiDSVAn (ORCPT ); Tue, 19 Apr 2022 17:00:43 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 949854132B; Tue, 19 Apr 2022 13:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=K28ZszIq+QiHeei7bDvtjvKxO/gUup7E4EwBSEICmPI=; b=WUpYfAEK9Zn9MxE4if1EFyd1MJ 2gGb89aNhOI17BdkguShlb1EWfF1maQm/qLJkrMzE59bxC/XFtah6Z0cCUmSfzLLghILF96mj4LER uHk7R4lHK+r7l0RQ10eSoiCUoX0eOlDDjSl5BLrt8PRanApn0dcsqUB602Bq4aO4sQQX44A/Etsx9 u7mRJaGnb/frLOcFE+XcH+eRYX8pUKCeD72/3pq3KxdxYzFVzLRc48Rt+R1Naxt2H/3WQR9yUeKx0 DLnSs8ucGSh7fR74oL1Ahp0PG9PD6dWgU/eI9Eq0OZLVgyHcypBARzETZVYR7yj0ElLwwYEqqFVUL xcnpNMXA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nguuq-003Uu9-7B; Tue, 19 Apr 2022 20:57:40 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 8BB6E9861A4; Tue, 19 Apr 2022 22:57:38 +0200 (CEST) Date: Tue, 19 Apr 2022 22:57:38 +0200 From: Peter Zijlstra To: Wen Yang Cc: Stephane Eranian , Wen Yang , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Thomas Gleixner , mark rutland , jiri olsa , namhyung kim , borislav petkov , x86@kernel.org, "h. peter anvin" , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH 2/2] perf/x86: improve the event scheduling to avoid unnecessary pmu_stop/start Message-ID: <20220419205738.GZ2731@worktop.programming.kicks-ass.net> References: <20220304110351.47731-1-simon.wy@alibaba-inc.com> <20220304110351.47731-2-simon.wy@alibaba-inc.com> <0c119da1-053b-a2d6-1579-8fb09dbe8e63@linux.alibaba.com> <271bc186-7ffb-33c8-4934-cda2beb94816@linux.alibaba.com> <05861b8c-2c7c-ae89-613a-41fcace6a174@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On Tue, Apr 19, 2022 at 10:16:12PM +0800, Wen Yang wrote: > We finally found that TFA (TSX Force Abort) may affect PMC3's behavior, > refer to the following patch: > > 400816f60c54 perf/x86/intel: ("Implement support for TSX Force Abort") > > When the MSR gets set; the microcode will no longer use PMC3 but will > Force Abort every TSX transaction (upon executing COMMIT). > > When TSX Force Abort (TFA) is allowed (default); the MSR gets set when > PMC3 gets scheduled and cleared when, after scheduling, PMC3 is > unused. > > When TFA is not allowed; clear PMC3 from all constraints such that it > will not get used. > > > > > > However, this patch attempts to avoid the switching of the pmu counters > > in various perf_events, so the special behavior of a single pmu counter > > will not be propagated to other events. > > > > Since PMC3 may have special behaviors, the continuous switching of PMU > counters may not only affects the performance, but also may lead to abnormal > data, please consider this patch again. I'm not following. How do you get abnormal data? Are you using RDPMC from userspace? If so, are you following the prescribed logic using the self-monitoring interface?