Received: by 10.223.176.46 with SMTP id f43csp659042wra; Wed, 24 Jan 2018 04:06:11 -0800 (PST) X-Google-Smtp-Source: AH8x226GXaw9oHKhddpUcAW+r4zQctCBNRn04hVVpI1wgOk9+bJuHdSRlsSTdLGezDLwxB7k3p+e X-Received: by 10.98.67.138 with SMTP id l10mr12663511pfi.72.1516795571296; Wed, 24 Jan 2018 04:06:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516795571; cv=none; d=google.com; s=arc-20160816; b=o0DREXv1FIfJ66r4Lrjv0p3JTKwM6xxiods+rU1QLuoxl1J4vwmafeTZVgdMsUOBdU Jvr/TF5X4OgUIwb1tWMh5jzK7XO7aH0/RqxBojsPIwhIZmgDNmh5gfEDXBAw3ZvdI7Dc PE14aE+buktsPhQbADpw3y6E1Vr/6SVfP3ip36W78rP+M7umFklwtRSvTCBtc24XJeKA pa3T35PsXBEybQD9QYdme7+wH3d6xhItMN9Mv67avtJLNqqFa2dDysH2AyHLF9bhhqv5 75DR5wfBrXmULPkWH/qOlxEnAd8csPzhb7syWEHZ3YEesUgQPqRaQkVGag6gG8nRtko0 OPKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=CFN9h+r1AvM3UYVpBGuI0MhcuTg4zLaSGHl20kQsb0w=; b=BAg9x4ncYzwdIGtAUacNZECgj2EgvdWyzI+LLcRHtk00uw3xmv1szF/fwEM9sT7mu9 ry2PlGnjok0GHg+TNU+4EbdLSEiPH1yctJz0yq8pgZlAsHwO5+a6t7UCpMAqcgnc3ecc 6LeG7mryMFz3xp0nRCZi4/tkmbnz60EuiPsFP/FwStPIw+TtPlYImvOgUmTsgDRi0Fu/ 7hvvvVNFxpUTl7UflX4Gtfu9ZbKi7w6/i2XEFVDxokIxkSScb04gLfk19VFh2iHvopPT iWQTrKkvzM22zLYxVkL6A2zM8OIph63fpo2hHGGJdkZj/z5IbfOOPZWnbB6EqF/XYM2Q zEpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e90-v6si91428plb.749.2018.01.24.04.05.52; Wed, 24 Jan 2018 04:06:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933503AbeAXMFT (ORCPT + 99 others); Wed, 24 Jan 2018 07:05:19 -0500 Received: from terminus.zytor.com ([65.50.211.136]:47047 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932953AbeAXMFS (ORCPT ); Wed, 24 Jan 2018 07:05:18 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w0OC4AjI009640; Wed, 24 Jan 2018 04:04:10 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w0OC49Cs009637; Wed, 24 Jan 2018 04:04:09 -0800 Date: Wed, 24 Jan 2018 04:04:09 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Xiao Liang Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, xiliang@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, xiliang@redhat.com, mingo@kernel.org In-Reply-To: <20180122061252.6394-1-xiliang@redhat.com> References: <20180122061252.6394-1-xiliang@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] perf/x86/amd/power: Do not load AMD power module on !AMD platforms Git-Commit-ID: 40d4071ce2d20840d224b4a77b5dc6f752c9ab15 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 40d4071ce2d20840d224b4a77b5dc6f752c9ab15 Gitweb: https://git.kernel.org/tip/40d4071ce2d20840d224b4a77b5dc6f752c9ab15 Author: Xiao Liang AuthorDate: Mon, 22 Jan 2018 14:12:52 +0800 Committer: Thomas Gleixner CommitDate: Wed, 24 Jan 2018 13:00:35 +0100 perf/x86/amd/power: Do not load AMD power module on !AMD platforms The AMD power module can be loaded on non AMD platforms, but unload fails with the following Oops: BUG: unable to handle kernel NULL pointer dereference at (null) IP: __list_del_entry_valid+0x29/0x90 Call Trace: perf_pmu_unregister+0x25/0xf0 amd_power_pmu_exit+0x1c/0xd23 [power] SyS_delete_module+0x1a8/0x2b0 ? exit_to_usermode_loop+0x8f/0xb0 entry_SYSCALL_64_fastpath+0x20/0x83 Return -ENODEV instead of 0 from the module init function if the CPU does not match. Fixes: c7ab62bfbe0e ("perf/x86/amd/power: Add AMD accumulated power reporting mechanism") Signed-off-by: Xiao Liang Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20180122061252.6394-1-xiliang@redhat.com --- arch/x86/events/amd/power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c index a6eee5a..2aefacf 100644 --- a/arch/x86/events/amd/power.c +++ b/arch/x86/events/amd/power.c @@ -277,7 +277,7 @@ static int __init amd_power_pmu_init(void) int ret; if (!x86_match_cpu(cpu_match)) - return 0; + return -ENODEV; if (!boot_cpu_has(X86_FEATURE_ACC_POWER)) return -ENODEV;