Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4816355ioa; Wed, 27 Apr 2022 11:44:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZlq9Qq0JYxU1igHezRwAN13DdFUQ/6OODqrP8TCUfRSInFml2zJ8E6Q7sRVF1rNuelMVn X-Received: by 2002:a17:907:1b1c:b0:6f0:10e2:7a9b with SMTP id mp28-20020a1709071b1c00b006f010e27a9bmr28261058ejc.58.1651085069553; Wed, 27 Apr 2022 11:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651085069; cv=none; d=google.com; s=arc-20160816; b=Ry6rPDwzM4B3OZrNtQ1eFm6NEH4hv2b3HclsmNmPGus8+gQfSOfGtMM63CDIJL1IYS atEm8o/N6tnlRvlizkMX7pgY9O5FcL0ib2iJZXAhgcpTvPoXazLPCAeg+SslLlaWN28v bVRrb+mxUMAIXzYcUNSnKVZ9XKYkj3cmzC6i4n9k45SaaBuRAGtjGhZvl7zRttGkDj0c zBOFaGc6t22YUN79z8iIulPm/4O3amWwPlVeBQuuqxPaVpG+2w6EZPUGNS9m3dpsbfXG r90Ai5UlXphReoTu2ggSL9uVzSBlWjga9Yagen8P1RedSp/b2qPV7vyXdy0OPS9HxTXd 12AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=qeSoISKEydPM4LAhn8UqmgfRicAEvFi1E2X9P5Nf5xI=; b=iE2gS5VQr8PCEJC59/FKEX0Xkg5F6i53NwEzo0zc8rs4pRmkyGyI6qrxPXDU+pl1el ttItewn2xxZm4tDSIZDmlTYEuznOU/0V0aACAKZTqpDdSgckqg3td7FLEHZIeFM47qfw ItrBMC6r5sqImLmkiMP+35hWZbomhTQ0efoT0GBelRcg+lxnrlc1qFpB1Q89KHbq+X+0 lko5ATZdFmmf6/NAxdyJW5whQ01cT0sBdoj7lw0hMla7K+EYN9mICaBGFCow8/xmMCr3 UrO8vvm/b/ahuu+vIJpwrKKrbvXG2ahuyw4BRlggKb+6bP3owLxMX2/OhhdUQrifMtSm GA2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TUa51QK1; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21-20020a1709062b9500b006f3a346719dsi1812967ejg.689.2022.04.27.11.44.05; Wed, 27 Apr 2022 11:44:29 -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=@linutronix.de header.s=2020 header.b=TUa51QK1; dkim=neutral (no key) header.i=@linutronix.de; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229569AbiD0SqU (ORCPT + 99 others); Wed, 27 Apr 2022 14:46:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbiD0SqG (ORCPT ); Wed, 27 Apr 2022 14:46:06 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C72E7A998; Wed, 27 Apr 2022 11:27:25 -0700 (PDT) Date: Wed, 27 Apr 2022 18:27:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1651084044; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qeSoISKEydPM4LAhn8UqmgfRicAEvFi1E2X9P5Nf5xI=; b=TUa51QK1AefrxkP2b8m0e72wdlGIXdgvfJ3fOVutoEAbrrxykzXcQ4lL6+5+1c9xJEzCK+ 4t4V04pUL/wHTZ5kxqQoJue6sEM7Xguqx7yUTq8BMyzoFJY4BmtunoeqBShjuJ9mZvZD2I OyKDjWGZuKKSO684LkrP/tiAKLWZALIFWDyd3NYxFw0GaX5MHbfaXPrxcb+UAU/AJoDWBA Kk16JjNvgpTEGUnSSSzAbemuOPi8cxSsJmxWI7m5NaRL4KaNU8CrxBPraKyJcDDZJO906G jfZyTCz8Agd6x3Aac+ue2OW97F4SdpD5/5IhwZA75Zn+xJOvW5QizYrIrqdPkA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1651084044; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qeSoISKEydPM4LAhn8UqmgfRicAEvFi1E2X9P5Nf5xI=; b=wRCVNkaHB/5gPsrykRXg7w+Rw+xjaiZl+fmTyahZBOAKpakkegt7Z+YpbvvQC1bnii/S0o GiZ1YO24fZzl+xBw== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cleanups] x86/aperfmperf: Store aperf/mperf data for cpu frequency reads Cc: Thomas Gleixner , "Rafael J. Wysocki" , "Peter Zijlstra (Intel)" , "Paul E. McKenney" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220415161206.817702355@linutronix.de> References: <20220415161206.817702355@linutronix.de> MIME-Version: 1.0 Message-ID: <165108404302.4207.11864273936460943270.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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_PASS 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 The following commit has been merged into the x86/cleanups branch of tip: Commit-ID: cd8c0e142daf9de9ce594e61b75509b0af7bfb26 Gitweb: https://git.kernel.org/tip/cd8c0e142daf9de9ce594e61b75509b0af7bfb26 Author: Thomas Gleixner AuthorDate: Fri, 15 Apr 2022 21:20:01 +02:00 Committer: Thomas Gleixner CommitterDate: Wed, 27 Apr 2022 20:22:19 +02:00 x86/aperfmperf: Store aperf/mperf data for cpu frequency reads Now that the MSR readout is unconditional, store the results in the per CPU data structure along with a jiffies timestamp for the CPU frequency readout code. Signed-off-by: Thomas Gleixner Acked-by: Rafael J. Wysocki Acked-by: Peter Zijlstra (Intel) Acked-by: Paul E. McKenney Link: https://lore.kernel.org/r/20220415161206.817702355@linutronix.de --- arch/x86/kernel/cpu/aperfmperf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/aperfmperf.c b/arch/x86/kernel/cpu/aperfmperf.c index df528a4..963c069 100644 --- a/arch/x86/kernel/cpu/aperfmperf.c +++ b/arch/x86/kernel/cpu/aperfmperf.c @@ -24,11 +24,17 @@ #include "cpu.h" struct aperfmperf { + seqcount_t seq; + unsigned long last_update; + u64 acnt; + u64 mcnt; u64 aperf; u64 mperf; }; -static DEFINE_PER_CPU_SHARED_ALIGNED(struct aperfmperf, cpu_samples); +static DEFINE_PER_CPU_SHARED_ALIGNED(struct aperfmperf, cpu_samples) = { + .seq = SEQCNT_ZERO(cpu_samples.seq) +}; struct aperfmperf_sample { unsigned int khz; @@ -515,6 +521,12 @@ void arch_scale_freq_tick(void) s->aperf = aperf; s->mperf = mperf; + raw_write_seqcount_begin(&s->seq); + s->last_update = jiffies; + s->acnt = acnt; + s->mcnt = mcnt; + raw_write_seqcount_end(&s->seq); + scale_freq_tick(acnt, mcnt); }