Received: by 10.223.176.46 with SMTP id f43csp2525564wra; Sun, 21 Jan 2018 22:15:46 -0800 (PST) X-Google-Smtp-Source: AH8x2261YsWNItB3rEDK3g03Hf3jGkTBd5qbHwMLsKC8grAUQw6rD3zuniHV/g1+XdMVgdnJxbu7 X-Received: by 10.101.65.9 with SMTP id w9mr6386157pgp.214.1516601746652; Sun, 21 Jan 2018 22:15:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516601746; cv=none; d=google.com; s=arc-20160816; b=wmKH/157ZyaupGS3O4M2Ud0gumjrYY9JVxDZ1LGlsb4jhPTCkVkZ9rp/f7A+lTze/m hqb8q7blZQc70kDsDoj3zZFnwfCgQvz94QSD8Jv+OUbOnAQG1NCmIIqNQhNWSVHS3mWS /IWzgo3H+IrhYYX0bPlULa+OTQr1JIUAFoh7Av5dX1JSQeS90wpYJILq+g+Q7ffGNdBA S/4poHkztrPpj0FCQ9XGMtlk+vU2pup2CaIY8AwZKkJQWnI1Ddg5OMy2tUT9noDCxwr3 MHQkX9tRt/IeQPz8dHJApQBn5wXTiNGHd124msAlI6CoI+297JJaVmYGfOyxL+ZiDYWy VIuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=SvlRzbALKAaA9sBLxgqU9dykaLCG/qyy5La7sviE3WU=; b=inEqM5HCGsFZMBA69mSZpgaz0BOFbHgH91jUKqxrQetPYSDm0gM5TOoNvQPIWpeTVD VMvVTwpjC8K0oZCuON9pbGfxjU6D2pujgckmMgQbZrSsJY4oShRNEUcC3bdF2Uk6PRAb U9QFQj59mwMfXFGXWZ1GL4coxYY9Vs9rI68ybyslKxnbsCgXyUTO2AD2ZXOA5QXtdps9 PDqY9x2hSx3+GNmr79FFP4ysfx9HnDXHYf62H46vEvf8S5IXXZCJZtLpyC5YBcUjuh1W 4bWKy3cVoA4nMNcFFLu2PiUXjuFGGJfKX7IJEFEPT7faNFZHlkjAf6zvZ5z5pjEoKghS pgYQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6si2934610pgd.282.2018.01.21.22.15.32; Sun, 21 Jan 2018 22:15:46 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751097AbeAVGNL (ORCPT + 99 others); Mon, 22 Jan 2018 01:13:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37456 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbeAVGNK (ORCPT ); Mon, 22 Jan 2018 01:13:10 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F52D883A4; Mon, 22 Jan 2018 06:13:10 +0000 (UTC) Received: from dhcp-2-242.nay.redhat.com (dhcp-2-242.nay.redhat.com [10.66.2.242]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 160EE9CB0; Mon, 22 Jan 2018 06:13:07 +0000 (UTC) From: Xiao Liang To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Xiao Liang Subject: [PATCH v1 1/1] perf/x86/amd/power: do not load amd power module in intel platform Date: Mon, 22 Jan 2018 14:12:52 +0800 Message-Id: <20180122061252.6394-1-xiliang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 22 Jan 2018 06:13:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "power" module can be loaded if it is not amd processor. And user cannot unload it after loaded it. The following call trace generated when tried to unload it. BUG: unable to handle kernel NULL pointer dereference at (null) IP: __list_del_entry_valid+0x29/0x90 PGD 0 P4D 0 Oops: 0000 [#1] SMP PTI CPU: 1 PID: 26046 Comm: modprobe Not tainted 4.14.13-300.fc27.x86_64 #1 Hardware name: Xen HVM domU, BIOS 4.9.1 12/12/2017 task: ffff9a138f8dddc0 task.stack: ffffb0ec41cbc000 RIP: 0010:__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 RIP: 0033:0x7fb67d78e5c7 Signed-off-by: Xiao Liang --- 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 a6eee5ac4f58..2aefacf5c5b2 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; -- 2.14.3