Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1795736lqg; Mon, 4 Mar 2024 04:16:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4oIRiLibg1YGt4+fsCAdXycAC9/xpEH2B1R0N3UAXxanZl1pw2em+iuMxWxNRBoU+YulVe7ozl6rf/whYIlQT/RxGcPLW/5UU9Wi6Lw== X-Google-Smtp-Source: AGHT+IEICe7RJapAp/+rALppM70IsKnc5L691tKNIUNcaSD1vTwGA+aXPGxr9ZR+p4+4THxQu/qA X-Received: by 2002:a17:90a:1049:b0:29a:264b:8853 with SMTP id y9-20020a17090a104900b0029a264b8853mr6295925pjd.12.1709554609668; Mon, 04 Mar 2024 04:16:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709554609; cv=pass; d=google.com; s=arc-20160816; b=xkLNF5oZBrD9kwpbvxHQ8ZTTMKXJYuY0R2xLG/X1IcI5WAScpmGx7C88Dc4+LtbQKE LPbDEem/JX445Dz5rsXka5I/+AF3uRwWqYyujdXZfddzX72x0p5QXeIYh6QRgVDhWIxL qyNR79wJ1q4vqhOi+6eN2BCe1D5Cc44BE9NOcyPUh+HUjxzTljmORxgNpY+GjB49gDPz 8nt6f3DPmbDb0Agh2fEWOSA42L74xAFfBjxYCZsmvEiBjvVUlCp6SjP4mfX84VKQfDk3 nL8cMQPGzVbLVQd+4WiQdL37LkI7fBEC4D2S7b3PgLuQD4FUZlmHyrtu4WiomYVUyvCP 1QUA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=WWggXFl6uEUV2KrPyBZxmWrCftIgyB21SQjzfWt7kjk=; fh=ug+vbjx3hYEyfsB5aHBhxI+u027oSYAUfnsAoBvj5oA=; b=wOUty4megh5FMf10oBfHzlVOhb/koDes61IC/2cA0xCMJ3rO7UItCr1kZ5hyxckcwV xyKX+lC73PQDnX2I7KvGdo1muY+chjv/TaoLJAVwYc6yvG5tt8KcGKcDJOf62nrWJ+6P 7W3qETDeaoTc4kdYC84wBDJHs8ATiz35UfmYfh6APPUfU0ZgpJJn6/D/uyU7uBi350yA L19OjkvjYWhkjqBEShWEcOeElQzEcCDRMs6Qik5NeNIRRYpPiiPSdH7ag4nBmkrVO8oa pIldao4f4glWyr5Hfg/2ZdaflGfOjd7OB+96bR5GlSqcYUVuAT4BwdpYx9rIAQyAj/+B IN0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nTEHyS0c; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-90555-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90555-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id pm10-20020a17090b3c4a00b0029b1ba33f88si7119317pjb.160.2024.03.04.04.16.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 04:16:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90555-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=nTEHyS0c; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-90555-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90555-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3231EB21900 for ; Mon, 4 Mar 2024 12:16:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B35C13D972; Mon, 4 Mar 2024 12:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="nTEHyS0c"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Wm5uZKSA" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C031A3CF74; Mon, 4 Mar 2024 12:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709554511; cv=none; b=CNjbHq07BvN42xzpWyy+yWGfkI113HgtBmLdilPuAYq/eoA6uRmUZyq7iOj7gLQTd1KuIByVoDWECw/5AAbg4dlo0tW9RurJxa2/X8GvnbBXdmHCUnFfJgj8t4QiWJwQpFwmKvhumqzbCkFsc691mUd6VyKB8N8L0Lu7jWK2hIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709554511; c=relaxed/simple; bh=4e7c4XeoMoqErMEUvZy9LPZhvhSF317wV2byPficIbM=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=r9VIGtmC61FrvXyeEA6x4Dva22u7BmNRYb4tSB2pKZjVRNptK+q0SzZ9NAmzyYCkYwh2oLYjU3kAWImtnBPIIeWWvLg0O3yqgXI/P/7mNU/7tK/+fZxw3DAMc/Z2fZXWjO6P57j7tqKyMgOPOgVXHLdhmJMGUtuZIwEgKK4135Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=nTEHyS0c; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Wm5uZKSA; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 04 Mar 2024 12:15:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1709554508; 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=WWggXFl6uEUV2KrPyBZxmWrCftIgyB21SQjzfWt7kjk=; b=nTEHyS0cs83SLuAwdkPuqDt9rluQiU0JbTqqJIrUSHfBPMtYO7kSFicve5dWTGnIBoJPcn sPCdog1ekfJW/roabZKMVeeIX+tDmoSxJau76502mHpIUHXIY2K2+VFhlNU4Sb521JqOKH OkP487E+uY44Y/JZauNz+dlWTH/PBcb9pohsP4nnwNA6ZJFUhHw1ghA+s168due/GZnkK4 Onp42H62LA0CsaXL5yQCu4+Ew2JiYPntQWc2RHBqr8fzKYtJn7JScq+vgXiJHMkcqdxkOc wZnxxUF/FVvOPCAj/vzsv2YsYGKca+NUD5YE6owZsaW21lCoIbtI/W37pjoyvA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709554508; 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=WWggXFl6uEUV2KrPyBZxmWrCftIgyB21SQjzfWt7kjk=; b=Wm5uZKSAxjEzzIFxW5aTKWT12gT48v5ApyrRhYn87lK92NEX525hx4FIQ6X1KDzu+xr+sK VnEknZm7Df7Vr7Bw== 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/msr: Add missing __percpu annotations Cc: Thomas Gleixner , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240304005104.513181735@linutronix.de> References: <20240304005104.513181735@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170955450713.398.6405328311126408942.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/cleanups branch of tip: Commit-ID: 5323922f50ecdf9d10cdd2fabd06507e5b4f3feb Gitweb: https://git.kernel.org/tip/5323922f50ecdf9d10cdd2fabd06507e5b4f3feb Author: Thomas Gleixner AuthorDate: Mon, 04 Mar 2024 11:12:20 +01:00 Committer: Ingo Molnar CommitterDate: Mon, 04 Mar 2024 12:01:54 +01:00 x86/msr: Add missing __percpu annotations Sparse rightfully complains about using a plain pointer for per CPU accessors: msr-smp.c:15:23: sparse: warning: incorrect type in initializer (different address spaces) msr-smp.c:15:23: sparse: expected void const [noderef] __percpu *__vpp_verify msr-smp.c:15:23: sparse: got struct msr * Add __percpu annotations to the related datastructure and function arguments to cure this. This also cures the related sparse warnings at the callsites in drivers/edac/amd64_edac.c. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20240304005104.513181735@linutronix.de --- arch/x86/include/asm/msr.h | 26 ++++++++++++++------------ arch/x86/include/asm/processor.h | 1 - arch/x86/include/asm/tsc.h | 3 ++- arch/x86/lib/msr-smp.c | 12 +++++------- arch/x86/lib/msr.c | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h index 65ec196..4621e08 100644 --- a/arch/x86/include/asm/msr.h +++ b/arch/x86/include/asm/msr.h @@ -12,11 +12,13 @@ #include #include +#include + struct msr_info { - u32 msr_no; - struct msr reg; - struct msr *msrs; - int err; + u32 msr_no; + struct msr reg; + struct msr __percpu *msrs; + int err; }; struct msr_regs_info { @@ -305,8 +307,8 @@ static inline int wrmsrl_safe(u32 msr, u64 val) return wrmsr_safe(msr, (u32)val, (u32)(val >> 32)); } -struct msr *msrs_alloc(void); -void msrs_free(struct msr *msrs); +struct msr __percpu *msrs_alloc(void); +void msrs_free(struct msr __percpu *msrs); int msr_set_bit(u32 msr, u8 bit); int msr_clear_bit(u32 msr, u8 bit); @@ -315,8 +317,8 @@ int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); int rdmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 *q); int wrmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 q); -void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs); -void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs); +void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr __percpu *msrs); +void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr __percpu *msrs); int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); int rdmsrl_safe_on_cpu(unsigned int cpu, u32 msr_no, u64 *q); @@ -345,14 +347,14 @@ static inline int wrmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 q) return 0; } static inline void rdmsr_on_cpus(const struct cpumask *m, u32 msr_no, - struct msr *msrs) + struct msr __percpu *msrs) { - rdmsr_on_cpu(0, msr_no, &(msrs[0].l), &(msrs[0].h)); + rdmsr_on_cpu(0, msr_no, raw_cpu_ptr(&msrs->l), raw_cpu_ptr(&msrs->h)); } static inline void wrmsr_on_cpus(const struct cpumask *m, u32 msr_no, - struct msr *msrs) + struct msr __percpu *msrs) { - wrmsr_on_cpu(0, msr_no, msrs[0].l, msrs[0].h); + wrmsr_on_cpu(0, msr_no, raw_cpu_read(msrs->l), raw_cpu_read(msrs->h)); } static inline int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index d2ef4f5..a61f769 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -20,7 +20,6 @@ struct vm86; #include #include #include -#include #include #include #include diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h index 594fce0..405efb3 100644 --- a/arch/x86/include/asm/tsc.h +++ b/arch/x86/include/asm/tsc.h @@ -5,8 +5,9 @@ #ifndef _ASM_X86_TSC_H #define _ASM_X86_TSC_H -#include #include +#include +#include /* * Standard way to access the cycle counter. diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c index 40bbe56..acd463d 100644 --- a/arch/x86/lib/msr-smp.c +++ b/arch/x86/lib/msr-smp.c @@ -9,10 +9,9 @@ static void __rdmsr_on_cpu(void *info) { struct msr_info *rv = info; struct msr *reg; - int this_cpu = raw_smp_processor_id(); if (rv->msrs) - reg = per_cpu_ptr(rv->msrs, this_cpu); + reg = this_cpu_ptr(rv->msrs); else reg = &rv->reg; @@ -23,10 +22,9 @@ static void __wrmsr_on_cpu(void *info) { struct msr_info *rv = info; struct msr *reg; - int this_cpu = raw_smp_processor_id(); if (rv->msrs) - reg = per_cpu_ptr(rv->msrs, this_cpu); + reg = this_cpu_ptr(rv->msrs); else reg = &rv->reg; @@ -97,7 +95,7 @@ int wrmsrl_on_cpu(unsigned int cpu, u32 msr_no, u64 q) EXPORT_SYMBOL(wrmsrl_on_cpu); static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, - struct msr *msrs, + struct msr __percpu *msrs, void (*msr_func) (void *info)) { struct msr_info rv; @@ -124,7 +122,7 @@ static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no, * @msrs: array of MSR values * */ -void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) +void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr __percpu *msrs) { __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu); } @@ -138,7 +136,7 @@ EXPORT_SYMBOL(rdmsr_on_cpus); * @msrs: array of MSR values * */ -void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs) +void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr __percpu *msrs) { __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu); } diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c index 47fd9bd..4bf4fad 100644 --- a/arch/x86/lib/msr.c +++ b/arch/x86/lib/msr.c @@ -6,9 +6,9 @@ #define CREATE_TRACE_POINTS #include -struct msr *msrs_alloc(void) +struct msr __percpu *msrs_alloc(void) { - struct msr *msrs = NULL; + struct msr __percpu *msrs = NULL; msrs = alloc_percpu(struct msr); if (!msrs) { @@ -20,7 +20,7 @@ struct msr *msrs_alloc(void) } EXPORT_SYMBOL(msrs_alloc); -void msrs_free(struct msr *msrs) +void msrs_free(struct msr __percpu *msrs) { free_percpu(msrs); }